Console: Draw one PDF page on another PDF page.
Posted: Mon Apr 06, 2015 4:58 pm
Here is C# example that shows how to draw one PDF page on another PDF page:
Code: Select all
public void Test()
{
using (PdfDocument document1 = new PdfDocument("document1.pdf"))
{
using (PdfDocument document2 = new PdfDocument("document2.pdf"))
{
DrawPage(document1.Pages[0], document2.Pages[0], document1.Pages[0].MediaBox);
document1.SaveChanges();
}
}
}
public void DrawPage(PdfPage sourcePage, PdfPage topPage, RectangleF rect)
{
using (PdfGraphics g = sourcePage.GetGraphics())
g.DrawPageAsForm(topPage, rect);
}