Hello
I need to add some images to a rtf document, some of those images can be quite
large so I added some code that is supposed to scale down images that are
larger than a page.
The problem is that some images that would fit on a page actually get enlarged
with the following code:
final int docWidth = (int)(doc.getPageSize().width() - (doc.leftMargin() +
doc.rightMargin()));
final int docHeight = (int)(doc.getPageSize().height() - (doc.topMargin() +
doc.bottomMargin()));
...
com.lowagie.text.Image itImg =
com.lowagie.text.Image.getInstance(imgFile.toURL());
if((itImg.width() > docWidth) || (itImg.height() > docHeight)) {
itImg.scaleToFit(docWidth, docHeight);
}
There seems to be a discrepancy between the resolution the document uses and
the resolution that gets used for images.
Am I missing something here?
Regards,
Thomas
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/