Add PDF Cover Page in C#

When working with PDFs in C#, we sometimes have to add a cover page. We found IronPDF to be a seamless solution, providing the ability to add a cover page without using any other programs and in just two simple lines of code. Here's how.


Step 1

1. Install C# Library to Visual Studio

The easiest way to start is to install the C# Library from IronPDF to your Visual Studio. It takes under 5 minutes and gives you free access to the classes and functions you need for working with PDF documents in your development project.

Either download the package directly or through NuGet.


Install-Package IronPdf

How to Tutorial

2. Add C# PDF Cover Page

Cover Page

Whether you've merged 2 PDF files or just need to add a page to one, it's easy to add a cover page to your C# PDF document now that you have IronPDF. All it takes is 2 lines of code.

In the below example, we have one PDF as a cover page, and another PDF which hosts the main content.

We have downloaded the NuGet page as an example.

Then we created our own cover page using the “ChromePdfRenderer” class, and later on used the “Merge()” function to embed the two PDFs and create a single new one. See below for the code and explore for yourself in your project.

/**
Add PDF Cover Page
anchor-add-c-pdf-cover-page
**/
using IronPdf;
using System.Windows.Forms;

namespace readpdf
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            //Here we're Converting the HTML Page to PDF
            var Renderer = new ChromePdfRenderer();

            //As we need to embed our own Cover Page, we're going to remove the 1st page of HTML-PDF
            Renderer.RenderingOptions.FirstPageNumber = 2; // '2' means the page will start from 2nd

            //Downloaded & Converted to PDF in Just One Line !
            Renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf/").SaveAs("online.pdf");

            //Created Sample Cover using RenderHtmlAsPdf method
            var Cover = new ChromePdfRenderer();
            Cover.RenderHtmlAsPdf("<h1> This is Cover Page</h1>").SaveAs("cover.pdf");

            //BELOW IS THE CODE FOR ADD or MERGE Cover / Custom PDF
            //Only ONE Line command to merge two PDF's.
            PdfDocument.Merge(new PdfDocument("cover.pdf"), new PdfDocument("online.pdf")).SaveAs("combined.pdf");

            //cover.pdf = Custom Cover PDF
            //online.pdf = 2nd PDF
            //Combined.pdf = Merged PDF
        }
    }
}
/**
Add PDF Cover Page
anchor-add-c-pdf-cover-page
**/
using IronPdf;
using System.Windows.Forms;

namespace readpdf
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            //Here we're Converting the HTML Page to PDF
            var Renderer = new ChromePdfRenderer();

            //As we need to embed our own Cover Page, we're going to remove the 1st page of HTML-PDF
            Renderer.RenderingOptions.FirstPageNumber = 2; // '2' means the page will start from 2nd

            //Downloaded & Converted to PDF in Just One Line !
            Renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf/").SaveAs("online.pdf");

            //Created Sample Cover using RenderHtmlAsPdf method
            var Cover = new ChromePdfRenderer();
            Cover.RenderHtmlAsPdf("<h1> This is Cover Page</h1>").SaveAs("cover.pdf");

            //BELOW IS THE CODE FOR ADD or MERGE Cover / Custom PDF
            //Only ONE Line command to merge two PDF's.
            PdfDocument.Merge(new PdfDocument("cover.pdf"), new PdfDocument("online.pdf")).SaveAs("combined.pdf");

            //cover.pdf = Custom Cover PDF
            //online.pdf = 2nd PDF
            //Combined.pdf = Merged PDF
        }
    }
}
'''
'''Add PDF Cover Page
'''anchor-add-c-pdf-cover-page
'''*
Imports IronPdf
Imports System.Windows.Forms

Namespace readpdf
	Partial Public Class Form1
		Inherits Form

		Public Sub New()
			InitializeComponent()

			'Here we're Converting the HTML Page to PDF
			Dim Renderer = New ChromePdfRenderer()

			'As we need to embed our own Cover Page, we're going to remove the 1st page of HTML-PDF
			Renderer.RenderingOptions.FirstPageNumber = 2 ' '2' means the page will start from 2nd

			'Downloaded & Converted to PDF in Just One Line !
			Renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf/").SaveAs("online.pdf")

			'Created Sample Cover using RenderHtmlAsPdf method
			Dim Cover = New ChromePdfRenderer()
			Cover.RenderHtmlAsPdf("<h1> This is Cover Page</h1>").SaveAs("cover.pdf")

			'BELOW IS THE CODE FOR ADD or MERGE Cover / Custom PDF
			'Only ONE Line command to merge two PDF's.
			PdfDocument.Merge(New PdfDocument("cover.pdf"), New PdfDocument("online.pdf")).SaveAs("combined.pdf")

			'cover.pdf = Custom Cover PDF
			'online.pdf = 2nd PDF
			'Combined.pdf = Merged PDF
		End Sub
	End Class
End Namespace
VB   C#

3. Merge PDFs for Result

As in the below output, there are two PDF files, i.e. first and second, to act as your cover page and content. So with the “Merge()” function, the two PDFs get merged with a single code functionality.

~ 1st PDF ~

~ 2nd PDF ~

~ Merged / Combined ~


Library Quick Access

Share Documentation

Share the documentation used in this tutorial and others by accessing the API Reference.

Share Documentation