Best practices for loading and processing large PDF documents using Syncfusion PDF
The Syncfusion Essential PDF is a .NET PDF library used to create, read, and edit PDF documents. It is also capable of processing large PDF documents. From assembly version 16.4.0.52 and above, you can load and process PDF documents larger than 2GB in size using the Syncfusion PDF library.
On saving larger sized PDF to a new document, the saving time may increase depending on the file size since the whole file stream needs to be copied to a new file stream. To avoid it, save the changes in the same loaded PDF document that will reduce the saving time. Refer to the code sample given below.
Include the following namespaces:
using Syncfusion.Pdf; using Syncfusion.Pdf.Graphics; using Syncfusion.Pdf.Parsing; using System.Drawing;
C#
//Load the PDF file stream to PdfLoadedDocument PdfLoadedDocument document = new PdfLoadedDocument(filePath); //Create standard PdfFont PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 15); //Load some pages and draw string to each page for (int i = 0; i < 5; i++) { PdfLoadedPage page = document.Pages[i] as PdfLoadedPage; page.Graphics.DrawString("Testing string", font, PdfBrushes.Black, new PointF(20, 20)); } //Save the modified document to the loaded file document.Save(); //Close the saved document document.Close(true);
A complete working sample can be downloaded from Sample.zip
Take a moment to peruse the documentation, where you will explore different options to create a PDF from scratch, adding text and images to a PDF document, filling the form fields in an existing PDF document, and merging multiple PDF documents with code examples.
Click here to explore the rich set of Essential Studio PDF features.
Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.
Conclusion
I hope you enjoyed learning about best practices for loading and processing large PDF documents using Syncfusion PDF.
You can refer to our WinForms PDF’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms PDF documentation to understand how to present and manipulate data.
For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms PDF and other WinForms components.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!