There seems to be a bug in PdfStamperImp.ReplacePage that manifests itself when the origin of the MediaBox of the page being inserted is not (0,0).
If you run code like this : PdfDictionary Page = Reader.GetPageN ( NSeqPage ) ; PdfArray OldBox = Page.GetAsArray ( PdfName.MEDIABOX ) ; Page.Put ( PdfName.MEDIABOX, new PdfRectangle ( ((PdfNumber)OldBox[0]).FloatValue - 100, ((PdfNumber)OldBox[1]).FloatValue - 100, ((PdfNumber)OldBox[2]).FloatValue - 100, ((PdfNumber)OldBox[3]).FloatValue - 100 ) ) ; in such a way as to make the MediaBox origin, for example (-100,-100) then use ReplacePage to insert the reader's page into the stamper, the mediabox origin will be correctly set at -100, -100 but all the contents of the page will magically jump up to (100,100) from (0,0). The result is that the corresponding origin shift is in effect doubled. The reason is that in PdfStamperImp.ReplacePage the template is always added at (0,0) : cb.AddTemplate(p, 0, 0); whereas in fact it should be added at the Media box origin. -- View this message in context: http://itext-general.2136553.n4.nabble.com/Bug-in-PdfStamperImp-ReplacePage-when-MediaBox-origin-not-0-0-tp4658764.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ 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