pdf generation - How to set horizontal or vertical alignment Text in PDF? -
i generating pdf, , outputting text, e.g.:
bt /f1 7 tf 586 406 td (date shipped:) tj et
a quick primer on pdf programming language:
bt
: begin text block/f1 7 tf
: select font #1
(which in case helvetica), , use font size of7
point586 406 td
move current location (x=586
pt, y=406
pt)(date shipped:) tj
: render textdate shipped:
et
: end text block
that text rendered @ location (586,406), bottom left of text block @ location:
what want point define top center point:
because not know size of rendered text; cannot fudge things up/down/left/right try make it.
how can indicate in pdf text's "alignment"?
you cannot. pdf producing software needs know font metrics produce formatted output.
as know selected helvetica @ size 7 , know current character , word spacing values, can calculate size of rendered text.
the font metrics of standard 14 fonts available here.
you may want read pdf specification (made available here), chapter on text rendering.
Comments
Post a Comment