This sample shows how to create XObjects (often used for watermarks and backgrounds) based on existing PDF document pages.

Use PdfDocument.CreateXObject(PdfPage) method to create PdfXObject based on existing page. You can use a page from any PDF document (the one you will put the XObject in or other).

You can use created XObject as a watermark or background for a page using one of PdfCanvas.DrawXObject methods.

You can also use this technique to impose (combine) PDF pages onto larger (or same size) sheets to make books, booklets, or special arrangements.

C#
using System.Diagnostics;

using BitMiracle.Docotic.Pdf;

namespace BitMiracle.Docotic.Pdf.Samples
{
    public static class CreateXObjectFromPage
    {
        public static void Main()
        {
            // NOTE: 
            // When used in trial mode, the library imposes some restrictions.
            // Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            // for more information.

            string pathToFile = "CreateXObjectFromPage.pdf";

            using (PdfDocument other = new PdfDocument(@"Sample Data\jfif3.pdf"))
            {
                using (PdfDocument pdf = new PdfDocument())
                {
                    PdfXObject firstXObject = pdf.CreateXObject(other.Pages[0]);
                    PdfXObject secondXObject = pdf.CreateXObject(other.Pages[1]);

                    PdfPage page = pdf.Pages[0];
                    double halfOfPage = page.Width / 2;
                    pdf.Pages[0].Canvas.DrawXObject(firstXObject, 0, 0, halfOfPage, 400, 0);
                    pdf.Pages[0].Canvas.DrawXObject(secondXObject, halfOfPage, 0, halfOfPage, 400, 0);

                    pdf.Save(pathToFile);
                }
            }

            Process.Start(pathToFile);
        }
    }
}
VB
Imports System.Diagnostics

Imports BitMiracle.Docotic.Pdf

Namespace BitMiracle.Docotic.Pdf.Samples
    Public NotInheritable Class CreateXObjectFromPage
        Public Shared Sub Main()
            ' NOTE: 
            ' When used in trial mode, the library imposes some restrictions.
            ' Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            ' for more information.

            Dim pathToFile As String = "CreateXObjectFromPage.pdf"

            Using other As New PdfDocument("Sample Data\jfif3.pdf")
                Using pdf As New PdfDocument()
                    Dim firstXObject As PdfXObject = pdf.CreateXObject(other.Pages(0))
                    Dim secondXObject As PdfXObject = pdf.CreateXObject(other.Pages(1))

                    Dim page As PdfPage = pdf.Pages(0)
                    Dim halfOfPage As Double = page.Width / 2
                    pdf.Pages(0).Canvas.DrawXObject(firstXObject, 0, 0, halfOfPage, 400, 0)
                    pdf.Pages(0).Canvas.DrawXObject(secondXObject, halfOfPage, 0, halfOfPage, 400, 0)

                    pdf.Save(pathToFile)
                End Using
            End Using

            Process.Start(pathToFile)
        End Sub
    End Class
End Namespace