Answer is .... try {
PdfReader firstPdf = new PdfReader(mainFileWithPath); PdfReader secondPdf =new PdfReader(addFileNameWithPath); // create new pdf with the content from firstPdf PdfStamper stamp = new PdfStamper(firstPdf, new FileOutputStream(outputPDFFile)); stamp.setRotateContents(false); int totalNumOfPagesToInsert = secondPdf.getNumberOfPages(); int i =1; while (i<=totalNumOfPagesToInsert) { // Get a single page from secondPdf with the given pageNo PdfImportedPage page = stamp.getImportedPage(secondPdf,i); //Actual working code // insert new page in to the newly created pdf at specified page number. // choose page size bas stamp.insertPage(INSERT_AT_PAGE_NO + (i-1), secondPdf.getPageSizeWithRotation(i)); //Actual working code // copy the content of the page copied from secondPdf. stamp.getUnderContent(INSERT_AT_PAGE_NO + (i-1)).addTemplate(page, 0, 0); //Actual working code i++; } //close the new created pdf. stamp.close(); -- View this message in context: http://itext.2136553.n4.nabble.com/why-does-portrait-page-changes-to-landscape-page-automatically-after-inserting-pdf-using-iText-tp4661023p4661026.html Sent from the iText mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z _______________________________________________ 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