开发者

PDF format, word spacing

I'm implementing a pdf generator in PHP I have problem with word spacing, the option doesn't work or i'm not using word spacing parameter properly. I need this option to render text justified. The character spacing parameter works properly. This is how I'm rendering text:

BT

/F1 12 Tf

0 829 Td

5 Tw

(Hello w开发者_如何学Pythonorld) Tj

ET

Word spacing parameter is bold. What i'm doing wrong?


As BrianS mentioned, Tw isn't applied to multi-byte fonts according to the PDF Spec. That explains one of the text layout bugs I had to deal with Many Moons Ago. Ya learn something new every day.

There's another possibility. Word spacing is only applied to ASCII 0x20 (dec 32). If you're using a non-breaking space, tab, or whatever, instead of The ASCII Space, it won't work. Looking at the above text, that's not it, but your actual PDF output could differ.


thanks for your answers. yes i was using unicode font. i deal with it with TJ operator. now my text output looks like that:

[(Hello) -320 (world) -320] TJ

Btw i must improve my text justify algoritm because text right align is not on one level. And i write my own library because existing ones do not have a tools which i need and all code is in one class - i split objects and objects elements into differend classes like Zend_Pdf

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜