Free Support Forum -

Create PageStamp in PDF - Add PDF Pages to PDF with different margins

Hi all,

I use almost the same code like the shown in your examples. So far so good. But now I would like to add pages of the second PDF file to the first. But this pages do have different margins. Is it possible to change these margins?`Reason to change it ist, that afterward an image as header sould be added on every page of the new PDF file. Without the change of the margin the image would be hide some text of the added pages.

Thank you,

doc.Save(pdfStream, Words.SaveFormat.Pdf)
Dim pdfDocument2 As New Aspose.Pdf.Document(pdfStream)

Dim PDFAnlage As Aspose.Pdf.Document
Dim ms As New MemoryStream([Document as Byte()])
PDFAnlage = New Aspose.Pdf.Document(ms)


Hi Thomas,

Sorry for the delayed response. You can re-size an existing Pdf document using ResizeContent method of PdfFileEditor class. Please check following documentation link for the details/code snippet. Hopefully it will serve the purpose.

Best Regards,

Hi Tilal,

thanks for your response. It's easier than my solution. But it would work too.

Dim pageStamp As PdfPageStamp()
For Each singlePage In sourcePDF.Pages
pageStamp = New PdfPageStamp(singlePage)
pageStamp.Background = True
pageStamp.XIndent = 50
pageStamp.YIndent = 72
'pageStamp.Rotate = Rotation.on180
pageStamp.Zoom = 0.82
destPDF.Pages.Insert(destPDF.Pages.Count + 1)

Best Reards,


Hi Thomas,

Thanks for your feedback. Its good to know that you have achieved your desired results. Furthermore, definitely your shared solution will provide another choice to some other Aspose community member for the purpose.

Please feel free to contact us for any further assistance.

Best Regards,