Adding New Content to Existing Page in PDF
Adding a new page or new content to an existing page in PDF using DynamicPDF Core Suite is simple and easy.
How to Add New Content to Page in C#
The following steps and sample code illustrate adding new content to an existing page in PDF using DynamicPDF Core Suite.
Steps for Adding new Content to an Existing PDF
- Create a
MergeDocument
object. - Create a
Page
object pointing to the specific page in the MergeDocument instance. - Add desired page element to the Page instance.
- Save the PDF document.
Sample Code - C#
MergeDocument document = new MergeDocument( pdfFilePath );
Page page = document.Pages[0];
page.Elements.Add( new Label( "New Content", 0, 0, 512, 12 ) );
document.Draw(@"Output.pdf");
How to Add New Page to PDF in C#
The following steps and sample code illustrate adding a new page to a PDF using DynamicPDF Core Suite.
Steps for Adding a New Page
- Create a
MergeDocument
object. - Create a
Page
object and set its PageSize and PageOrientation parameters. - Add a Label instance to the
Page
instance. - Add Page instance to the Document object instance.
- Call the
Append
method on the Document object. - Save the PDF document.
Sample Code - C#
MergeDocument document = new MergeDocument();
Page page = new Page( PageSize.Letter, PageOrientation.Portrait );
page.Elements.Add( new Label( "Cover Page", 0, 0, 512, 12 ) );
document.Pages.Add( page );
document.Append(@"DocumentA.pdf");
document.Draw(@"Output.pdf");
GitHub Project
Clone or view the example project at GitHub. This example code is contained in the Examples/AddNewContentExample.cs file.
Getting Started
NuGet Package
The easiest way to install DynamicPDF Core Suite is by using the Visual Studio Package Manager. DynamicPDF Core Suite is also available on NuGet and is part of the ceTe.DynamicPDF.CoreSuite.NET
package.
DynamicPDF Core Suite Information
More information on merging using DynamicPDF Core Suite can be found at the following web page.
Available on Other Platforms
The DynamicPDF Core Suite is also available for Java and COM/ActiveX. Refer to the respective product pages for more details.
- Java - DynamicPDF Generator for Java
- COM/ActiveX - DynamicPDF Generator for COM/ActiveX