Adding New Content to Existing PDFs
DynamicPDF Core Suite for .NET makes adding new elements to a page in an existing PDF a breeze. The following C# examples illustrate adding new elements to an existing page and then creating a new page to add to an existing PDF.
Watch the Video
How to Add New Content to Page
The following steps and C# sample code illustrate adding new content to an existing page in PDF using DynamicPDF Core Suite for .NET.
Steps for Adding New Content to an Existing PDF
- Create a
MergeDocument
object. - Create a
Page
object pointing to the specific page in theMergeDocument
instance. - Add desired page elements to the
Page
instance. - Add the
Draw
method to save the merged PDF.
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
The following steps and C# sample code illustrate adding a new page to a PDF using DynamicPDF Core Suite for .NET.
Steps for Adding a New Page
- Create a
MergeDocument
object. - Create a
Page
object and set its dimensions. - Add desired page elements to the
Page
instance. - Add the
Page
instance to theMergeDocument
instance. - Add the
Append
method on theMergeDocument
instance. - Add the
Draw
method to save the merged PDF.
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
Examples are provided in C# and VB.NET. Clone or view the example project at GitHub. This example code is contained in the following files.
- C# - AddNewContentExample.cs
- VB.NET - AddNewContentExample.vb
Getting Started
Get started easily by installing DynamicPDF Core Suite for .NET through NuGet or manually. Then, refer to the documentation for more information on using and purchasing the product.
NuGet Package
The easiest way to install DynamicPDF Core Suite is by obtaining the NuGet package using Visual Studio's Package Manager. You can also obtain the NuGet package by downloading it directly. Refer to the installation documentation for more information.
DynamicPDF Core Suite Information
DynamicPDF Core Suite for .NET combines creating, merging, and visual report creation into one powerful product for creating PDF documents. It is ideal for anyone who needs to generate PDF documents or reports or work with existing PDFs in their applications. With a free Evaluation Edition to try and with flexible and royalty-free licensing options, why not start using DynamicPDF Core Suite for .NET today!
More Information on Combining PDFs
- Refer to the Adding New Content documentation topic, or
- Chapter 22, Merging, in the book DynamicPDF Core Suite for .NET by Example available on GitHub.
Available on Other Platforms
DynamicPDF Core Suite is also available for the Java and COM/ActiveX platforms. Refer to the respective product pages for more details.
- DynamicPDF Generator
- Java - DynamicPDF Generator for Java
- COM/ActiveX - DynamicPDF Generator for COM/ActiveX
- DynamicPDF Merger
- Java - DynamicPDF Merger for Java
- COM/ActiveX - DynamicPDF Merger for COM/ActiveX