Console: Draw one PDF page on another PDF page.

Code samples for VintaSoft PDF .NET Plug-in. Here you can request a code sample.

Moderator: Alex

Post Reply
Alex
Site Admin
Posts: 2364
Joined: Thu Jul 10, 2008 2:21 pm

Console: Draw one PDF page on another PDF page.

Post by Alex »

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);
}
Post Reply