本文介绍了PDF格式的字体颜色设置为文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我想添加一些文本的PDF文件manually.I能够与特定的字体添加新的文本。但我不能够设置字体颜色。那么,怎样才能我做手工?(我只是想手动更改这些,因为我已经有了code其中我写这些字节使PDF文件)另外我如何使用的PDF标准指定的图形状态来操作,这样的功能更改的文本不会影响颜色的变化etc.How正是我可以使用图形状态?I am trying to add some text to a pdf file manually.I was able to add new text with a specific font. But i am not able to set the font color. So how can i do it manually?(I just want to change these manually as i already have the code where i write these byte to make the pdf file)Also how can i use graphic states specified in the pdf standard to manipulate the text so that feature changes does not affect the color changes etc.How exactly i can use the graphic state?源代码的PDF文件点击此处修改PDF文件 clcik这里Source pdf file click hereModified pdf file clcik here推荐答案色彩运算符列在PDF规范的 ISO 32000-1:2008The PDF color operators are listed in Table 74 of the PDF specification ISO 32000-1:2008.在你的情况你添加的内容流In your case your added content stream is104 0 obj<</Length 105 0 R>>stream /Helv 8 Tf BT 1 0 0 1 15.67 150 Tm (l)Tj ET /Helv 8 Tf BT 1 0 0 1 17.88 190 Tm (abcdefghijklmnopqr)Tj ETendstreamendobj如果如你想要的文字被用红色填充在RGB色彩空间,您可以添加一个 1 0 0 RG :If e.g. you want the writing to be filled with red in a RGB color space, you add an 1 0 0 rg:104 0 obj<</Length 105 0 R>>stream BT 1 0 0 1 15.67 150 Tm /Helv 8 Tf 1 0 0 rg [...] 修改如果你害怕这种改变可能会影响以后的文字,记得使用图形状态栈操作符问:和问:(参见第8.4.2 PDF规范)。例如,If you are afraid that that change may affect later text, remember to use the Graphics State Stack operators q and Q (cf. section 8.4.2 of the PDF specification). E.g.q0 1 -1 0 595.22 0 cmqBT1 0 0 1 36 540 Tm/Xi0 12 Tf0.75 g(Hello people!)Tj0 gETQQ (从How文本对象添加到现有的PDF )的 这篇关于PDF格式的字体颜色设置为文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-23 11:07