简体   繁体   English

Adobe Acrobat 中的字体颜色 - Javascript

[英]Font Color in Adobe Acrobat - Javascript

I created an editable PDF through Adobe Indesign.我通过 Adobe Indesign 创建了一个可编辑的 PDF。 The editable text is in a text field and after exporting and opening in Adobe Acrobat I am able to edit text however it only uses black for the font color.可编辑文本位于文本字段中,在 Adobe Acrobat 中导出并打开后,我可以编辑文本,但它仅使用黑色作为字体颜色。 I was able to find a bit of code online to edit said text through Javascript which changes font size and family, however I'm struggling to find a way to edit the color of the font.我能够通过 Javascript 在线找到一些代码来编辑所述文本,这会改变字体大小和系列,但是我正在努力寻找一种方法来编辑字体的颜色。 I'm trying to get the color to be white and my knowledge of Javascript is minimal/non existant enter image description here , any help is much appreciated!我试图让颜色变成白色,我对 Javascript 的了解很少/不存在在这里输入图像描述,非常感谢任何帮助!

My code looks like this:我的代码如下所示:

for (var i = 0; i < numFields; i++) {

    var fName = getNthFieldName(i);

    var f = getField(fName);

    if (f.type === "text") {

//      f.alignment ="center";

        f.textSize = 75;

        f.textFont = "DINLIGHT";
        f.textcolor = ["CMYK","1.0 1.0 1.0"];

    ;
 
// Other properties go here
    
    }

}

I was trying to get my font color to change to white and allow others to edit this PDF and keep the same font size and family.我试图让我的字体颜色变为白色,并允许其他人编辑此 PDF 并保持相同的字体大小和系列。 It's currently black and everything I've tried doesn't work它目前是黑色的,我尝试过的一切都不起作用

f.textcolor = "white";

f.textcolor = ["CMYK","0, 0, 0, 0"]; 

enter image description here在此处输入图像描述

I dont use JS so for exact editing syntax in Acrobat your on your own, however to show you the target here is a mock total mash-up我不使用 JS,因此您可以自己在 Acrobat 中精确编辑语法,但是向您展示这里的目标是一个模拟的完全混搭

在此处输入图像描述 在此处输入图像描述

2 alternate decompressed forms are temporarily at https://transfer.sh/uX23WO/fillme%20101.zip 2个备用解压forms暂时在https://transfer.sh/uX23WO/fillme%20101.zip

TRY file 101 first and note it changes appearance, then try 111 and see if opening 101.pdf in a WordPad explains in RGb terms what /DA(1 0 1 rg does for form entry首先尝试文件 101 并注意它改变了外观,然后尝试 111 并查看在写字板中打开 101.pdf 是否以 RGb 术语解释了/DA(1 0 1 rg对表单输入的作用

Then you may well ask that explains a new colour change, but what about existing pre-filled colour, then you need to look at and file compare https://transfer.sh/LTNPhM/fillme%20100.pdf那么你可能会问解释新的颜色变化,但是现有的预填充颜色呢,那么你需要查看和文件比较https://transfer.sh/LTNPhM/fillme%20100.pdf

Now you have some idea why re-molding existing PDFs it is not easy to say where a change will need to be applied.现在您已经知道为什么重新塑造现有的 PDF 不容易说出需要应用更改的地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM