Valentin Avksentyev wrote:
> I'm using the following code to scale PDF pages down to 8.5x11, however, for 
> some PDFs the page ends up being rotated 90 degrees after being scaled.  One 
> more detail, PDFs that are rotated seem to be created by scanners.
> 
> Here is part of the relevant part of the code that I use:
> 
> PdfContentByte cb = writer.getDirectContent();
> PdfImportedPage page = writer.getImportedPage(reader, i);
> com.lowagie.text.Image image = com.lowagie.text.Image.getInstance(page);
> Rectangle psize = reader.getPageSize(i);
> float area = psize.getHeight() * psize.getWidth();
> float areaDiffPercent = (letterArea / area) * 100;
> image.setAbsolutePosition(10, 20);
> cb.addImage(image)image.scalePercent(areaDiffPercent);
> 
> Any help is appreciated

You didn't take the page rotation into account.
reader.getPageRotation(i);

http://itextpdf.com/examples/index.php?page=example&id=111
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to