You are using addPage() which does as its name implies; it adds the imported 
page, as-is, into the document.  

There are examples in the book which show how to put imported content into a 
new document as you are trying to do.

-----Original Message-----
From: mingqiang yu [mailto:[email protected]] 
Sent: Tuesday, May 22, 2012 2:56 PM
To: [email protected]
Subject: [iText-questions] add margin to existing pdf/image

Hi,

I need to read in existing pdfs and images and put them into one pdf with fixed 
margin, say 1 inch left and right, 0.5 inch top and bottom.

I tried to use:

Document document = new Document(PageSize.LETTER, 72, 72, 36, 36); PdfReader 
reader = new PdfReader("margin.pdf"); PdfCopy copy = new PdfCopy(document, new 
FileOutputStream("test1.pdf")); document.open(); PdfImportedPage page = 
copy.getImportedPage(reader, 1); copy.addPage(page); document.close();

But the margin setting is ignored. The original pdf margin is kept.

Is there a way that I can achieve this goal?

Thanks a lot!

M.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat 
landscape has changed and how IT managers can respond. Discussions will include 
endpoint security, mobile security and the latest in malware threats. 
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
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



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
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