I am trying to display TIFF images in PDF and there are some (minor) issues:
1. There are 2 pages in a TIFF each with a dimension of 500 x 100 pixels and
Resolution of 200.0 x 200.0 pixels/inch.
These images are alwayed displayed towards the bottom of the PDF page
irrespective of setAlignment(TOP). The remainder of the page is white.
2. There is another TIFF of dimension 1728 x 1082 pixels and Resolution:
204.0 x 98.0 pixels/inch. With scaleToFit(document.getPageSize().width(),
document.getPageSize().height()), I'm able to display the image fully
(without that only part of the image is displayed) but its again aligned to
the bottom and more than top quarter of the page is white.
I create the document with dimension: PageSize.A4, 50, 50, 50, 50.
Thanks,
Shobana
The code:
PdfContentByte cb = writer.getDirectContent();
SeekableStream s = new FileSeekableStream(inputFile);
TIFFDecodeParam param = null;
ImageDecoder dec = ImageCodec.createImageDecoder("tiff",s,param);
for (int imageToLoad = 0; imageToLoad < dec.getNumPages();++imageToLoad) {
PlanarImage im = new NullOpImage(dec.decodeAsRenderedImage(imageToLoad),
null,OpImage.OP_IO_BOUND, null);
BufferedImage bufim = im.getAsBufferedImage();
com.lowagie.text.Image image = com.lowagie.text.Image.getInstance(bufim,
null);
image.setAbsolutePosition(0, 0);
//I check the dimensions of the image here and they are correct.
//Now, if the dimensions exceed the page dimensions, I call scaleToFit()
img.scaleToFit(rect.width(), rect.height());
img.setAlignment(Image.TOP);
cb.addImage(image);
document.newPage();
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
No, I will not fix your computer.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions