Edit PDF files using incremental updates in C# and VB.NET

PDF .Net allows users to modify PDF documents. Users do not have to wait for the entire file (which may contain hundreds of pages or more) to be rewritten each time changes to the document are saved.

The PDF format allows changes to be made to a file while leaving the original data intact. The appendices added when the file is incrementally updated will only contain the objects that were actually added or changed.

Since the original content of the document remains in the file, it is possible to undo saved changes by deleting one or more addenda. The ability to recover the exact contents of an original document is critical when digitally signing a PDF file with multiple signatures.

For more information about PDF incremental update in PDF .Net, see File Structure help page.

The following example shows how to load a PDF document, add pages containing text, and save the changes using the incremental update feature.


If you need a new code example or have a question: email us at support@sautinsoft.com or ask at Online Chat (right-bottom corner of this page) or use the Form below:



Questions and suggestions from you are always welcome!

We are developing .Net components since 2002. We know PDF, DOCX, RTF, HTML, XLSX and Images formats. If you need any assistance with creating, modifying or converting documents in various formats, we can help you. We will write any code example for you absolutely free.

Complete code

using System;
using System.IO;
using SautinSoft;
using SautinSoft.Pdf;
using SautinSoft.Pdf.Content;

namespace Sample
{
    class Sample
    {
        /// <summary>
        /// Edit PDF files using incremental updates.
        /// </summary>
        /// <remarks>
        /// Details: http://sautinsoft/products/pdf/help/net/developer-guide/incremental-update.php
        /// </remarks>
        static void Main(string[] args)
        {
            string pdfFile = Path.GetFullPath(@"..\..\..\simple text.pdf");
            // Load a PDF document from a file.
            using (var document = PdfDocument.Load(pdfFile))
            {
                // Add a page.
                var page = document.Pages.Add();

                // Write a text.
                using (var formattedText = new PdfFormattedText())
                {
                    formattedText.Append("Hello World again!");

                    page.Content.DrawText(formattedText, new PdfPoint(100, 700));
                }

                // Save all the changes made to the current PDF document using an incremental update.
                document.Save();
            }
        }
    }
}

Download