I am using Aspose.pdf to merge a number of existing PDFs into one. The existing PDFs have different page margins and orientations - how can I preserve the page layout of each when creating the merged PDF?
Hi Rick,
Thank you for the response, but this code is not preserving the entire page layout of the source documents (this is the exact code I have been using). The page layout of the entire PDF appears to be established from the first PDF included in the merge.
If the first PDF is in Landscape, the page height of the entire document is fixed but the width does change; the pages in portrait are truncated at the top with the lower portion of each page kept in the merged document.
If the first PDF is in Portrait, the page width of the entire document is fixed but the height does change; the pages in landscape are truncated at the right with the left side of each page kept in the merged document.
Please help.
Hi Rick,
Here is the code I am running:
Dim licensePDF As Aspose.Pdf.License = New Aspose.Pdf.License licensePDF.SetLicense("Aspose.Total.lic")'Open first document
Dim pdfDocument1 As New Document(“C:\aatemp\Aspose\Test1.pdf”)
'Open second document
Dim pdfDocument2 As New Document(“C:\aatemp\Aspose\Test2.pdf”)'Add pages of second document to the first
pdfDocument1.Pages.Add(pdfDocument2.Pages)'Save concatenated output file
pdfDocument1.Save(“C:\aatemp\Aspose\output.pdf”)
I am attaching the two files I am attempting to merge as well as the merged pdf.
Hi Rick,
Thanks for sharing the resource files.
I have tested the scenario and I am able to reproduce the same problem. For the sake of correction, I have logged it in our issue tracking system as PDFNEWNET-38911. We will investigate this issue in details and will keep you updated on the status of a correction.
We apologize for your inconvenience.
Thanks for the response. This is a critical issue for us - we have a production move scheduled at the end of this month and we are replacing our existing document manager with the Aspose products. I can’t believe that no one has come across this problem before.
Hi Rick,
Aspose.Pdf.Facades.PdfFileEditor pdfEditor = new Aspose.Pdf.Facades.PdfFileEditor();
pdfEditor.Concatenate(@“C:\Test1.pdf”, @“C:\Test2.pdf”, @“C:\MergedOutput.pdf”);
Thank you for your quick response. This code worked great!
Rick
Hi Rick,