Why does this place the imported page outside the new page.. the imported page is: 748,6 hight and 559,8 wide.
public String scaleToForm(String oldFileName, String scaledFile) { try { PdfReader reader = new PdfReader(oldFileName); int numberOfPages = reader.getNumberOfPages(); float newPageHeight = 1800; float newPageWidth = 1224; Document document = new Document(new Rectangle(newPageWidth,newPageHeight)); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(scaledFile)); PdfContentByte cb = writer.getDirectContent(); document.open(); for(int i = 1; i <= numberOfPages; i++) { document.newPage(); PdfImportedPage page = writer.getImportedPage(reader, i); int rotation = reader.getPageRotation(i); float origPageWidth = reader.getCropBox(i).width(); float origPageHeight = reader.getCropBox(i).height(); if(rotation == 180 || rotation == -180) { cb.addTemplate(page, -(newPageWidth/origPageWidth), 0, 0, -(newPageHeight/origPageHeight), 0, 0); } else { cb.addTemplate(page, newPageWidth/origPageWidth, 0, 0, newPageHeight/origPageHeight, 0, 0); } } document.close(); return scaledFile; } catch(Exception e) { e.printStackTrace(); return null; } } Regards, David Nielsen ------------------------------------------------------- This SF.net email is sponsored by: ValueWeb: Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions