There sure is.  
 
Option 1: PdfImportedPage is a subclass of PdfTemplate.  Rather than simply 
using PdfCopy.addPage(), you can create a new blank page of the correct 
dimensions, then draw your page as a PdfTemplate with specific coordiates via 
PdfContentByte.  The downside here is that you lose any annotations from the 
original page.
 
Option 2: With a PdfStamper, set the UnderContent to do a transformation to 
accomplish the same thing.   You should change the Rect of any annotations on 
the page to match.  This would probably require two passes over the offending 
PDFs. 
 
 
--Mark Storer
  Senior Software Engineer
  Cardiff.com
 
import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;
 
 


________________________________

        From: AndrĂ© Lemay [mailto:[email protected]] 
        Sent: Friday, June 24, 2011 8:42 AM
        To: [email protected]
        Subject: [iText-questions] Shifting content of a page
        
        
        Strange problem, but I'll do my best to explain it.
        
        What I'm needing to do, is take pages from an existing pdf, and stitch 
them into a pdf that I'm generating. This is working fine, and I have no 
problem with it, but the pdf that gets stitched in (or rather certain pages of 
it) has a quirk which is causing problems.
        
        It's MediaBox is set to 27,27,639,819 (so 8.5x11, but shifted 27 point 
up and right). It has no CropBox defined. The reason it's like this, is that 
this pdf (from what I'm led to understand, it's created by a third party, so I 
can't do anything about it) is itself stitched together from other pdfs, and 
certain pages of it come from source pdfs that are oversized.
        
        Normally, this isn't a problem, as the mediabox is set correctly to the 
part of the pdf that needs to be viewable, and the resultant pdf (after I've 
stitched things together) looks fine in readers. The problem is that these get 
sent to a printer (as in a printing company), in a batch (several pdfs 
generated the same way), and the printer does something to them that changes 
the cropbox and ends up screwing up the way it comes out.
        
        I've checked the raw pdfs in a text editor, and the media/crop boxes 
for the bad pages are as follows :
        What I get from the third party : media[27,27,639,819], no cropbox 
defined
        What I generated (after stitching it in) : media[27,27,639,819], 
crop[0,0,612,792]
        The pdf coming out of whatever the printer is doing : 
media[27,27,639,819], crop[27,27,639,819]
        
        The result of this is that the bottom and left edges of these pdfs are 
getting cut off.
        
        I've tried playing around with changing the media/crop boxes, but with 
no success, I just end up generating pdfs that have edges cut off or have extra 
edges that we don't need.
        
        What i'd like to know, is if there's some way of shifting all the 
content of the page down and left by 27 points (then I could just adjust the 
media box, and still end up showing the correct content), or if there's some 
way of copying the content within the mediabox of these pages onto a new page 
(and in so doing, resetting the mediabox coordinates to be 0-based).
        
        Thanks
        

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
iText-questions mailing list
[email protected]
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

Reply via email to