I am drawing text in a PDF page using iTextSharp, and I have two
requirements: 1) the text needs to be searchable by Adobe Reader and such 2)
I need character-level control over where the text is drawn.

I can draw the text word-by-word using PdfContentByte.ShowText(), but I
don't have control over where each character is drawn. I can draw the text
character-by-character using PdfContentByte.ShowText() but then it isn't
searchable. I'm now trying to create a PdfTextArray, which would seem to
satisfy both of my requirements, but I'm having trouble calculating the
correct offsets.

So my first question is: do you agree that PdfTextArray is what I need to
do, in order to satisfy both of my original requirements?

If so, I have the PdfTextArray working correctly (in that it's outputting
text) but I can't figure out how to accurately calculate the positioning
offset that needs to get put between each pair of characters (right now I'm
just using the fixed value -200 just to prove that the function works).

I believe the positioning offset is the distance from the right edge of the
previous character to the left edge of the new character, expressed in
"thousandths of a unit of text space". That leaves me two problems:

1) How wide is the previous character (in points), as drawn in the specified
font & height? (I know where its left edge is, since I drew it there)

2) How do I convert from points to "units of text space"?

I'm not doing any fancy scaling or rotating, so my transformation matrices
should all be identity matrices, which should simplify the calculations ...

Thanks, Chris

 

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to