Pdfium.Net SDK 9.71.39
The C# PDF Library
Create PDFs from scratch, or from a bunch of scanned images
Edit, merge, split and manipulate PDFs, extract text and images
Embed standalone Winforms or WPF PDF Viewer
Supports: .Net 2.0+, .Net 6, Standard, Core, Mono, Azure
And it also works on Windows XP and Mac OS
Download Pdfium.Net SDK Install with NuGet
Advanced PDF Library for total control over your PDF creation workflow
Pdfium.Net SDK is the leading .Net library for generating, manipulating and viewing files in the portable document format. We are offering a high level c# / VB.Net API for dynamic pdf creation on a WEB server or any other server system, and to implement «Save as PDF» feature in existing desktop or WEB applications.

How to Create a PDF Dynamically With C#
- /// <summary>
- /// Create PDF Document on The Fly in C# using Pdfium.Net SDK Library
- /// </summary>
- public void CreatePdf()
- {
- // The PDF coordinate system origin is at the bottom left corner of the page.
- // The X-axis is pointing to the right. The Y-axis is pointing in upward direction.
- // The sizes and coordinates in this method are given in the inches.
-
- // Step 1: Initialize PDF library and create empty document
- // Return value: PdfDocument main class
- PdfCommon.Initialize();
- var doc = PdfDocument.CreateNew(); // Create a PDF document
-
- // Step 2: Add new page
- // Arguments: page width: 8.27", page height: 11.69", Unit of measure: inches
- // The PDF unit of measure is point. There are 72 points in one inch.
- var page = doc.Pages.InsertPageAt(doc.Pages.Count, 8.27f * 72, 11.69f * 72);
-
- // Step 3: Add graphics and text contents to the page
- // Insert image from file using standart System.Drawing.Bitmap class
- using (PdfBitmap logo = PdfBitmap.FromFile(@"e:\63\logo_square.png"))
- {
- PdfImageObject imageObject = PdfImageObject.Create(doc, logo, 0, 0);
- //image resolution is 300 DPI and location is 1.69 x 10.0 inches.
- imageObject.Matrix = new FS_MATRIX(logo.Width * 72 / 300, 0, 0, logo.Height * 72 / 300, 1.69 * 72, 10.0 * 72);
- page.PageObjects.Add(imageObject);
- }
-
- // Create fonts used for text objects
- PdfFont calibryBold = PdfFont.CreateFont(doc, "CalibriBold");
- // Insert text objects at 7.69"; 11.02" and font size is 25
- PdfTextObject textObject = PdfTextObject.Create("Sample text", 1.69f * 72, 11.02f * 72, calibryBold, 25);
- textObject.FillColor = FS_COLOR.Black;
- page.PageObjects.Add(textObject);
-
- // Step 5: Generate page content and save pdf file
- // argument: PDF file name
- page.GenerateContent();
- doc.Save(@"e:\63\sample_document.pdf", SaveFlags.NoIncremental);
- }