PDF格式的字体颜色设置为文本 [英] Pdf setting the font color to the text

查看:188
本文介绍了PDF格式的字体颜色设置为文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加一些文本的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 here Modified pdf file clcik here

推荐答案

色彩运算符列在PDF规范的 ISO 32000-1:2008

The PDF color operators are listed in Table 74 of the PDF specification ISO 32000-1:2008.

在你的情况你添加的内容流

In your case your added content stream is

104 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
  ET
endstream
endobj 

如果如你想要的文字被用红色填充在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 < A HREF =htt​​p://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf相对=nofollow> 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.

q
0 1 -1 0 595.22 0 cm
q
BT
1 0 0 1 36 540 Tm
/Xi0 12 Tf
0.75 g
(Hello people!)Tj
0 g
ET
Q
Q

(从<复制的href="http://stackoverflow.com/questions/15151097/how-to-add-text-object-to-existing-pdf/15198301#15198301">How文本对象添加到现有的PDF )

这篇关于PDF格式的字体颜色设置为文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆