We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Merge contents of 2 pages to one page

Dear Support,


I have requirement where I have to merge contents of two PDF pages to one page. I tried following piece of code, it merges but I am unable to scale/position the content. Is there a way or perhaps a sample that does the same.
private static void MergePages()
{
Document pageLabel = new Document(@“pdfLabel.pdf”);
Document pdfPackingSlip = new Document(@“PackingSlip.pdf”);
Page pagePackingSlip = pdfPackingSlip.Pages[1];
Page pageLabel = pdfLabel.Pages[1];
foreach (var content in pagePackingSlip.Contents)
{
if (content is Operator.ConcatenateMatrix)
{
var contentMatrix = content as Operator.ConcatenateMatrix;
//do something to transform to the destination
}

pageLabel.Contents.Add(content as Operator);
}

pdfLabel.Save(@“PackingSlip_Combo.pdf”);
}

Regards,
Assam Zafar.

Hi Assam,

Thanks for your inquiry. You may use MakeNUp method of PdfFileEditor to merge two PDF pages to one page. Please check following documentation link for the purpose.

Please feel free to contact us for any further assistance.

Best Regards,

Hi Tilal,


Unfortunately that method doesn’t help me as it doesn’t give control over positioning of respective PDF’s in the merged page. Basically the printed output of my PDF will have 2 sections. One of them is peel of section(i.e. label) so the control over positioning is very critical for my need.
Just as a reference have a look at the following link:
https://www.pdftron.com/pdfnet/samplecode/ImpositionTest.cs.html
This exactly does what we need.

Regards,
Assam Zafar.

Hi Assam,


Thanks for your feedback. We will appreciate if you please share some sample input and desired output PDF documents to describe your requirement. So we will look into it and will guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,