Here is what I observe,
// Java Code render listener
public void renderText(TextRenderInfo renderInfo) {
float startX = renderInfo.getBaseline().getStartPoint().get(0);
float startY = renderInfo.getBaseline().getStartPoint().get(1);
float endX = renderInfo.getBaseline().getEndPoint().get(0);
float endY = renderInfo.getBaseline().getEndPoint().get(1);
// print them in file as (X1,Y1) and (X2,Y2)
}
//
For some text “A10036” rendered horizontally in map pdf, coordinates printed
in file are like this
" (X1,Y1) = (6479.63..,10073.64..) (X2,Y2) = (6479.63.., 10039.886..) "
Now I wonder for a horizontally aligned text, why their X1 and X2
coordinates are same, Y1, Y2 different. It should be other way around. But
any ways..
When I use (X1, Y1) to set PDfDestination like this
//
d = new PdfDestination(PdfDestination.XYZ,X1+200f, Y1+400f, 1); // later
used in action
//
so when this page rendered after action is performed, it moves to correct
location of "A10036" and zooms it nicely with text "A10036" in center of
screen.
HOWEVER when I use the same coordinates to set Absolute position like this :
//
Image image = Image.getInstance("pin3.png");
image.setAbsolutePosition(X1, Y1); //
//
image is rendered no where near the "A10036".
If I switch the value of X1 and Y1 (because of reason I mentioned at start)
i.e.
//
Image image = Image.getInstance("pin3.png");
image.setAbsolutePosition(Y1, X1);
//
Image is rendered on the SAME HORIZONTAL line A10036 is, but it is well off
the target vertically.
Here is my stamping code
//
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
PdfContentByte canvas;
canvas = stamper.getOverContent(1);
//get image object as mentioned above
canvas.addImage(image);
//
As per your advice “Make sure that an appropriate coordinate system is
selected when you are doing your image placement. “ I tried to do that by
playing with
canvas.concatCTM(a, b, c, d, e, f);
parameters but no success. Also I don’t believe origin of my pdf is
changed, its still lower left.
The thing bothering me is Why coordinates given (X1,Y1) works fine with
Pdfdestination but not with absolute Positioning of image?
Thanks for your time, please get me thru this..
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/renderInfo-getText-gives-empty-String-tp4656702p4656742.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
iText-questions mailing list
[email protected]
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