spacing - How to Calculate Leading in PDF Document -


how calculate leading in pdf document?

for example:

48 0 0 48 72 677.28 tm (hello world) tj 0 -1.1075 td 

this renders text hello world @ 48pt/57.6pt (120% line height) in times-roman.

according pdf reference manual, "the leading parameter measured in unscaled text space units. specifies vertical distance between baselines of adjacent lines of text... number expressed in thousandths of unit of text space."

can please explain how 1.1075 , 57.6 related?

you pdf commands incorrect. suppose mean:

48 0 0 48 72 677.28 tm 0 -1.1075 td     (hello world) tj 

this code set text coordinate system (tm command):

scale x48 on x , x48 on y  start position (72, 677.28) 

then it's move position next line. next line in 1.1075 "text" pixels. , move start position -1.1075 "text" pixels on y coordinate. text pixel in example it's pdf pixel multiplyed 48. it's set tm command.

i may simplify pdf code. it's same:

48 0 0 48 72 570.096 tm (hello world) tj 

explanation: 677.28 - (1.1075*48) - (1.1075*48)

you should remember pdf it's language. calculate real coordinates shoud parse previous commands. there may before commands:

10 0 0 10 0 0 cm 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -