Skip to main content
Version: Version 1.7

.NET technical notes

Learn about specifics of the .NET interface of the Pdftools SDK.


For the full API reference for the Pdftools SDK, see the .NET API reference.

IDisposable objects

Objects that must be closed explicitly (e.g. PdfTools.Pdf.Document, PdfTools.Image.Document, PdfTools.Crypto.Providers.Provider, or sub-classes) implement the IDisposable interface. Instead of calling Dispose() directly, it is recommended that you use the “using” statement:

using (Document document = ...)
// document.Dispose() is called implicitly here

Error handling

Errors are reported using exceptions. Where applicable, the SDK maps errors to corresponding native exception classes, such as System.ArgumentException, System.InvalidOperationException, System.NotSupportedException, or System.IO.IOException. The remaining errors are modeled using exception classes that inherit from a base class PdfToolsException.


The native stream interface System.IO.Stream is used.

Lists & Iterables

The API uses different concepts for returning collections of elements depending on the context:

  • lists (System.Collections.Generic.IList<T>) are usually used when the elements are already in memory and random access is possible. Depending on the context manipulation (add, remove, etc.) might also be possible.
  • iterables (System.Collection.Generic.IEnumerable<T>) are usually used, when elements are retrieved on demand. They do not allow random access, but instead only allow iterating through the elements.


Maps implement the native dictionary interface System.Collections.Generic.IDictionary<K, V>.


The Pdftools SDK uses the namespace PdfTools.


We recommend to use a custom, company specific namespace for your code. Using the PdfTools namespace like the SDK can lead to problems with ambiguous class names, especially when using multiple of our SDKs in the same project.