PDF .Net

PDF .Net

.NET library to work with PDF documents. No dependencies.

  • Create, Read, Write, Edit.
  • Draw Text and Graphics.
  • Split and Merge.
  • Redact.
  • Convert to Word, Images, PDF/A.
  • Interactive Forms and Annotations.
  • Extract Text, Tables, Images.
  • Pages and Navigation.
  • Password protection and Digital Signatures.
  • Attachments.
NET 8, 7, 6, 5, Standard 2, Core 2x & 3x, Framework 4.6.2+
AWS (EC2, Lambda) Kubernetes (All Versions) Azure (WebApps, Functions v3) Docker (All Versions)
Download (2024.10.30)

Latest Release Info

What's New in PDF .Net

Advanced PDF library for C# and .NET

SautinSoft.Pdf is a powerful library for working with PDF documents in .NET, including .NET Core and .NET Framework. This product is intended for developers who need to integrate PDF functionality into their applications.

Main features:

  1. Extract text from PDF: SautinSoft.Pdf allows you to extract text from PDF documents using a simple API, which makes it ideal for further data processing.
  2. Create and Write PDF: The library provides opportunities to create new PDF files, edit content, add images, change text formatting, delete pages and save the document in the desired PDF version.
  3. Image extraction: Using SautinSoft.Pdf You can extract raster and vector graphics from PDF documents, as well as filter images by minimum and maximum size.
  4. Merging and Splitting PDF Documents: The library provides tools for inserting, deleting, or reordering pages, as well as for merging, cloning, or splitting documents.
  5. Interactive forms: Users can fill in, edit and create new interactive forms, as well as pre-fill in data from any existing source. The process of "flattening" interactive PDF forms is supported, turning them into static content.

The advantages of using SautinSoft.Pdf:

  • Full-featured library: SautinSoft.Pdf allows you to perform any operations with PDF documents, including creating, reading, editing, printing, splitting and merging, digitally signing, extracting text and images, converting to PDF/A, compressing and protecting documents.
  • Independence and speed: The library does not depend on Adobe or other third-party programs, is completely written in managed C# and provides high processing speed.
  • Support for various platforms: SautinSoft.Pdf supports Windows (10, 11, Server 2016-2022), Linux (Debian, CentOS, Ubuntu), macOS (Intel + Apple silicon), as well as cloud platforms such as AWS, Kubernetes, Azure and Docker.

Licensing and Support:

SautinSoft offers three types of licenses, including free technical support and free updates for one year. Technical support includes assistance via web chat, email, and Skype group chats.

Conclusion:

SautinSoft.Pdf is an ideal solution for developers who need to integrate extensive PDF capabilities into their own.NET applications. With a simple API, high performance and support for multiple platforms, SautinSoft.Pdf greatly simplifies the development and expands the capabilities of applications working with PDF.

PDF .Net is a comfortable library to work with PDF documents. You can use it to create, read, write and edit PDF documents in any .NET app. You can redact, add annotations, fill interactive forms, set password, draw text and graphics, reorder pages.

It's completely written in C# code. The library supports all PDF versions from old 1.0 to newest 2.0 including PDF/A and subsequent.

Create PDF documents in C#

Use the library SautinSoft.Pdf for creating PDF documents in applications written on .NET Framework and .NET platforms.

You can add headers and footers, pages, tables and paragraphs. The SDK automatically divides the content into pages. Add text, images and vector graphics to your PDF files.

It is possible to work with Interactive PDF forms, including filling in, editing and creating new forms, annotations, bookmarks and layers. You can add both one signature and multiple signatures to PDF documents in C#, as well as password protect created PDF files.

using SautinSoft.Pdf;
using (var document = new PdfDocument())
{
    var page = document.Pages.Add();
    var formattedText = new PdfFormattedText();
    formattedText.FontSize = 15;
    formattedText.FontFamily = new PdfFontFamily("Calibri");
    formattedText.Color = PdfColor.FromRgb(1, 0, 0);
    formattedText.Append("Hello World!");
    page.Content.DrawText(formattedText, new PdfPoint(110, 650));
    document.Save("Hello World.pdf");
}
using SautinSoft.Pdf;
using (var document = PdfDocument.Load(pdfFile))
{
    foreach (var page in document.Pages)
    {
        var text = page.Content.GetText(new PdfTextOptions
        {
            FontFace = new PdfFontFace("Consolas"),
            Order = PdfTextOrder.Reading,
            Whitespaces = PdfTextWhitespaces.Space | PdfTextWhitespaces.Blank | PdfTextWhitespaces.NewLine
        }).ToString();
        Console.WriteLine(text);
    }
}
Extract Text from Pdf in C#

To convert PDF documents to text in .NET use the SautinSoft.PDF library. It can be used to extract formatted text and tables for further analysis.

It is also possible to extract additional information (coordinates, bounds, font, color, style) about each section of text, which makes it easier to find and highlight certain phrases in PDF documents.

The SDK also supports right-to-left and bidirectional text.

Find & Replace Text inside PDF in C#

The library SautinSoft.Pdf provides C# developers with convenient tools for finding and replacing text in PDF documents. The Find & Replace functionality allows you to locate specific text and replace it with new content, including setting the formatting of the new text.

The SDK makes it easy to integrate text replacement functions into PDF documents, ensuring efficient and accurate text manipulation.

using SautinSoft.Pdf;
using SautinSoft.Pdf.Content;
using (PdfDocument document = PdfDocument.Load("Find.pdf"))
{
    foreach (var page in document.Pages)
    {
        var search = page.Content.GetText().Find("North");
        foreach (var text in search)
        {
            var element = text.Elements.First();
            var font = element.Format.Text.Font;
            double size = Math.Min(text.Bounds.Height, font.Size * element.TextTransform.M11);
            using (var formattedText = new PdfFormattedText() { Font = font, Color = PdfColor.FromRgb(1, 0, 0), FontSize = size })
            {
                formattedText.Append("South");
                page.Content.DrawText(formattedText, new PdfPoint(text.Bounds.Left, text.Bounds.Bottom));
            }
            text.Redact();
        }
    }
    document.Save("Replace.pdf");
 }
Digital Signatures inside PDF in C#

Integration of the digital signature function into PDF documents, including the ability to add multiple signatures to a single PDF file. Using SautinSoft.Pdf in C#, protects the document from unauthorized changes and confirms its authenticity. The API, which is simple and intuitive, allows developers to easily implement this functionality into their software products.

The SDK provides features for adding a digital signature to a PDF document, including a handwritten image, fixing the signing time, the protecting with a password, and accessing signature attributes.

using SautinSoft.Pdf;
var document = PdfDocument.Load(pdfFile);
{
    // Add a signature field.
    var sig = document.Form.Fields.AddSignature(document.Pages[0], 10, 10, 250, 50);
    // Create new Signer.
    PdfSigner pdfSigner = new PdfSigner(@"..\..\..\sautinsoft.pfx", "123456789");
    // Configure signer.
    pdfSigner.Timestamper = new PdfTimestamper(@"https://tsa.cesnet.cz:5817/tsa");
    pdfSigner.SignatureFormat = PdfSignatureFormat.CAdES;
    pdfSigner.SignatureLevel = PdfSignatureLevel.PAdES_B_LTA;
    pdfSigner.HashAlgorithm = PdfHashAlgorithm.SHA256;
    pdfSigner.Location = "Test workplace";
    pdfSigner.Reason = "Test";
    var im = PdfImage.Load(@"..\..\..\JPEG2.jpg");
    sig.Appearance.Icon = im;
    sig.Appearance.TextPlacement = PdfTextPlacement.TextRightOfIcon;
    // Sign PDF Document.
    var si = sig.Sign(pdfSigner);
    // Save PDF Document.
    document.Save();
}
Redact Text from PDF in C#

Using SautinSoft.Pdf you can easily and efficiently edit text in PDF documents directly from C# application. The library provides convenient tools for hiding confidential information, correcting typos and making other changes to the text of PDF files.

Editing for security purposes involves the irreversible destruction of selected data in documents, which eliminates the chances of their subsequent recovery and guarantees strict compliance with information security standards.

using SautinSoft.Pdf;
using (PdfDocument document = PdfDocument.Load(@"Input.pdf"))
{
    string textToRedact = "the";
    foreach (var page in document.Pages)
    {
        var texts = page.Content.GetText().Find(textToRedact);
        foreach (var text in texts)
        {
            text.Redact();
            // Draw a green rectangle instead of removed text.
            var bounds = text.Bounds;
            var rectangle = page.Content.Elements.AddPath().AddRectangle(new PdfPoint(bounds.Left, bounds.Bottom), new PdfSize(bounds.Width, bounds.Height));
            rectangle.Format.Fill.IsApplied = true;
            rectangle.Format.Fill.Color = PdfColor.FromRgb(0, 1, 0);
        }
    }
    document.Save(@"Redacted.pdf");
}
using SautinSoft.Pdf;
using (var document = new PdfDocument())
{
    // Add a new page.
    var page = document.Pages.Add();
    double margin = 10;
    // Set up and fill the PdfFormattedText object.
    formattedText.TextAlignment = PdfTextAlignment.Left;
    formattedText.MaxTextWidth = 100;
    formattedText.Append("This text is left aligned, ").
    Append("placed in the top-left corner of the page and ").
    Append("its width should not exceed 100 points.");
    // Draw left-aligned text in the top-left corner of the page.
    page.Content.DrawText(formattedText, new PdfPoint(margin, page.CropBox.Top - margin - formattedText.Height));
    // Clear the PdfFormattedText object.
    formattedText.Clear();
}
Draw Text and Graphics inside PDF in C#

The library SautinSoft.Pdf provides C# developers with convenient tools for working with text and graphics in PDF documents. Drawing text and graphics allows you to set the location and formatting of the inserted text and images.

The SDK makes it easy to integrate text and graphics drawing functions into PDF documents.

Interactive Forms inside PDF in C#

Interactive PDF forms are a powerful tool for data collection and user interaction. The library SautinSoft.Pdf provides developers with convenient tools for working with these forms, allowing them to create, read and fill them in C# and .NET applications.

To create interactive forms SautinSoft.Pdf uses the PdfDocument class, which provides access to the Form property. Using this property, you can add various types of form fields, such as text fields, radio buttons, checkboxes, drop-down lists, signature fields, and buttons.

using SautinSoft.Pdf;
using (var document = PdfDocument.Load(pdfFile))
{
    foreach (var fieldGroup in document.Form.Fields.GroupBy(field => field.Name))
    {
        var field = fieldGroup.First();
        fieldType = field.FieldType;
        fieldName = '"' + field.Name + '"';
        fieldValue = field.Value;
        foreach (var widgetField in fieldGroup)
        {
            switch (widgetField.FieldType)
            {
                case PdfFieldType.CheckBox:
                case PdfFieldType.RadioButton:
                // Check box and radio button are toggle button fields.
                var toggleField = (PdfToggleButtonField)widgetField;
                fieldExportValueOrChoice = toggleField.FieldType == PdfFieldType.CheckBox ?
                writer.WriteLine(separator);
            }
            Console.Write(writer.ToString());
        }
    }
}

Why choose SautinSoft.Pdf?

PDF .Net- Complete PDF toolkit

Complete PDF toolkit

The library can do everything with PDF documents: read, write and edit.

PDF .Net- Independent and Fast

Fast and Independent

SautinSoft.Pdf is completely written in C# and has no dependencies. Fantastic speed.

PDF .Net- Windows, Linux, and macOS

Windows, Linux, and macOS

Develop for any .NET platform and major operating systems.

PDF .Net- Handy access to PDF structure

Handy access to PDF structure

Manipulate by basic PDF-objects (array, dictionary, stream etc) and high-level objects (page, text, graphics, links, annotations, fields etc).

PDF .Net- Form Fill, Edit, and Create

Interactive Forms and Annotations

Fill, edit, and create interactive forms and various annotations.

PDF .Net- Licensing and Free Support

Licensing and Free Support

Simple licenses with free technical support and updates during one year.

Feature Highlights

Extract Text

API to extract any text, tables, images with all info and ready for your further processing.

Redact

Redact confidential information in PDF permanently. Delete a specific data or text.

Create, Read, Write, Edit

The library has own parser and writer that support all PDF versions and standards.

Draw Text and Graphics

Allows to set location and formatting for inserted text and images.

Interactive Forms

Supports form fields, such as text, radio button, check box, combobox, and list box.

Digital Signatures

Add digital signature to PDF with a handwritten image.

Simple API

Control PDF inside your App:
  • Read text from PDF.
  • Create and write PDF.
  • Convert Images to PDF.
  • Print PDF documents.
  • Merge PDF files.
  • Split PDF by pages.
  • Find and Replace Text in PDF.
  • Fill in PDF interactive forms.
  • Encrypt PDF documents.
  • Sign PDF digitally.
  • Clone or import pages.
  • Format PDF content.
  • Add watermarks to PDF.
  • Get and set document properties.
  • Export and import images to PDF.
  • Add vector graphics content.
  • Get, create or edit bookmarks.
  • Add hyperlinks to PDF.
  • Manipulate streams and resources.

Let us say, to merge multiple PDF documents in C#:

using SautinSoft.Pdf;
class Program
{
	static void Main()
	{
		// List of source files.
		var fileNames = new string[]
		{
			"Doc1.pdf",
			"Doc2.pdf",
			"Doc3.pdf"
		};
		using (var document = new PdfDocument())
		{
			// Merge multiple PDF files into single PDF.
			foreach (var fileName in fileNames)
			    using (var source = PdfDocument.Load(fileName))
			        document.Pages.Kids.AddClone(source.Pages);
			document.Save("Merged.pdf");
		}
	}
}

Explore the Advanced Features

PDF .Net code-examples

Actually the component can provide you a lot of options to operate with PDF. See the Developer Guide to find out simple, advanced and complex examples, it contains many examples.

Easy Licensing and Distribution

Trusted by the World's Leading Companies

IBM
Intel
Cisco
Microsoft
Siemens
Uber
Indiana University – Purdue University Indianapolis
The University of Manchester
New York State
University of Pittsburgh
Western Standard - Translation and Library Technologies
United Graphic Expression Corporation
FoxyUtils
Talent management software
PROS
World Wrestling Entertainment
Moody's Investors Service
Nuance Communications