This is more a logic question than an iText question This worked with y It stopped working because of x That is likely to be WHY it stopped working If I got x to be like y then I could assume it might work again.
Y was portrait X is landscape Make x (landscape) into y (portrait) and you will find that this will be fixed. How to make y portrait? Rotate it. You seem clever enough to read the part of the book on rotation first, don’t you think.... john renfrew Right Way Up -----Original Message----- From: kpot86 [mailto:kpo...@gmail.com] Sent: 12 December 2012 16:56 To: itext-questions@lists.sourceforge.net Subject: [iText-questions] merge two pages in one with different orientation Hi I’m using itext to merge pdf but i’m new on this and I’m facing the fallowing issue: I want to merge each page of a pdf file lets call it A with a header pdf file lets call it B. The issue is that when I merge pages that are portrait it works fine but now i have a page on A that is in landscape and the header page on B that is on portrait so my code is not working . this is my code … Thanks in advance for your help public static void iTextMerge(File baseFile, File bgFile, File outFile) throws IOException, DocumentException { PdfReader bgReader = new PdfReader(bgFile.getAbsolutePath()); PdfReader baseReader = new PdfReader(baseFile.getAbsolutePath()); FileOutputStream out = new FileOutputStream(outFile); PdfStamper stamp = null; stamp = new PdfStamper(baseReader, out); Rectangle bgSize = bgReader.getCropBox(1); PdfImportedPage bgContent = stamp.getImportedPage(bgReader, 1); PdfGState blend = new PdfGState(); blend.setFillOpacity(0.5f); // blend.setStrokeOpacity(0.5f); // blend.setBlendMode(PdfGState.BM_DARKEN); for (int i = 1; i <= baseReader.getNumberOfPages(); i++) { Rectangle pageSize; PdfContentByte content = stamp.getOverContent(i); // content.setGState(blend); pageSize = baseReader.getCropBox(i); float hScale = pageSize.getWidth() / bgSize.getWidth(), vScale = pageSize.getHeight() / bgSize.getHeight(), dominantScale = hScale < vScale ? hScale : vScale, hTrans = (float) (pageSize.getLeft() - bgSize.getLeft() * dominantScale + (pageSize.getWidth() - bgSize.getWidth() * dominantScale) / 2.0), vTrans = (float) (pageSize.getBottom() - bgSize.getBottom() * dominantScale + (pageSize.getHeight() - bgSize.getHeight() * dominantScale) / 2.0); content.addTemplate(bgContent, dominantScale, 0, 0, dominantScale, hTrans, vTrans); } stamp.close(); } -- View this message in context: http://itext-general.2136553.n4.nabble.com/merge-two-pages-in-one-with-different-orientation-tp4657124.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php