Hello.
I am confused with the way image scaling works in PDF vs. RTF. I have
read the May 15th thread between Thomas Bickel and Mark Hall where
this is discussed:
http://www.mail-archive.com/itext-questions@(protected)
I am seeing a similar problem where JPEG images are created dynamically
and then output to both PDF and RTF files. In PDF, the images scale the way
I would expect when the following code is used:
com.lowagie.text.Image image = ...
// we need a 72 dpi image for PDF: usually the dpiX and dpiY values will
// be zero so the call to scalePercent will not even happen.
final int dpiX = image.getDpiX();
final int dpiY = image.getDpiY();
if (dpiX > 0 && dpiY > 0)
{
if (dpiX != 72 || dpiY != 72)
{ // this is 24 for 24%, thus we use 7200 rather than 72
image.scalePercent((7200 / dpiX), (7200 / dpiY));
}
}
For the images in question, dpiX and dpiY return 0 because the JPEGs have
no real DPI information, being merely dynamically generated rectangles of
pixels. So the scalePercent() call never happens (which should be OK).
However, when I generate RTF documents and view them in MS Word 2002 or 2007,
the images are too large as described in the email thread.
I have tried using similar code (both with 72 and 96 dpi assumptions) and have
used all 4 combinations of setImagePDFConformance + setWriteImageScalingInformation
with no luck.
Does it sound like I am missing something completely obvious here? Would it
be more helpful for me to create a short test program to demonstrate the problem?
Thanks,
Chad Loder
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/