Backgrounds & Foregrounds

You may want to use a specific background and foreground as you create and render your PDF documents in IronPDF. In such a case, you can use an existing or rendered PDF as the background or foreground for another PDF document. This is particularly useful for design consistency and templating.

This example shows you how to use a PDF document as the background or foreground of another PDF document.

You can do this in C# by loading or creating a multi-page PDF as an IronPdf.PdfDocument object.

You can add backgrounds using PdfDocument.AddBackgroundPdf. There are several background insertion methods and overrides in the IronPdf.PdfDocument documentation. This adds a background to each page of your working PDF. The background is copied from a page in another PDF document.

You can add foregrounds, also known as "Overlays," using PdfDocument.AddForegroundOverlayPdfToPage. There are several foreground insertion methods and overrides in the IronPdf.PdfDocument documentation.