If you are not permitted to change the page orientation then why not create a landscape specific header? Before applying the header to any specific page, test to determine the page orientation and apply the correct header.
-----Original Message----- Message: 6 Date: Thu, 13 Dec 2012 14:05:50 -0500 From: Nelson Capote <kpo...@gmail.com> Subject: Re: [iText-questions] merge two pages in one with different orientation To: r...@btclick.com, Post all your questions about iText here <itext-questions@lists.sourceforge.net> Message-ID: <CAOLdnk=twi9t7agwljft0tr+67uqjiqg7z+apj45bh8ci9t...@mail.gmail.com> Content-Type: text/plain; charset="windows-1252" It is not allowed to change the orientation. This is a document a customer has with images attached to it in pdf format and we are not allowed to change the orientation. As I said before I'm new with Itext and I was not the one who created this code, I'm just trying to understand it and see how it can be changed to get the desired result. Thanks On Thu, Dec 13, 2012 at 11:03 AM, John Renfrew <r...@btclick.com> wrote: > 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 > -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ ------------------------------------------------------------------------------ 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 End of iText-questions Digest, Vol 79, Issue 20 ***********************************************
<<winmail.dat>>
------------------------------------------------------------------------------ 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