You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by "Hesham G." <he...@gmail.com> on 2010/07/26 19:00:38 UTC

importPDF wrong dimensions

Hello ,

I have used PDDocument.importPage(...) to import a page from a PDF to another one. The page is imported fine, but its dimensions appear wrong ... A small part at the top of the imported page does not appear !
Here is my code :

String path = "C:\\old.pdf";
String importPath = "C:\\merge.pdf";

PDDocument oldPDF = PDDocument.load( path );
PDDocument importPDF = PDDocument.load( importPath );
PDPage pageToImport = (PDPage)importPDF.getDocumentCatalog().getAllPages().get( importPDF.getNumberOfPages() - 1 );
oldPDF.importPage( pageToImport );

oldPDF.save( path );
oldPDF.close();

And here is the input and output PDFs : http://www.4shared.com/file/j0YA8XkA/PDFs.html

Can someone tell me what is the cause of this ?

Best regards ,
Hesham