Skip to main content Skip to footer

What's New in Document Solutions for PDF .NET v9

v9.2 - September 1, 2026

Document Solutions for PDF .NET (DsPdf .NET) v9.2 expands its standards-focused and interactive PDF capabilities with new support for PDF/A-4 variants, PDF/UA-2 generation, PDF 2.0 structure enhancements, structure-based destinations, and a new 3D annotation object model. DsPdfJS v9.2 also introduces many of these capabilities while bringing additional established DsPdf .NET features, such as tagged content, output intents, associated files, and Form XObjects, to JavaScript developers.

Support for PDF/A-4, PDF/A-4e, PDF/A-4f, and PDF/UA-2

DsPdf .NET and DsPdfJS v9.2 add APIs for creating documents that target PDF/A-4, PDF/A-4e, PDF/A-4f, and PDF/UA-2.

PDF/A-4 is based on PDF 2.0 and is designed for long-term preservation. Its specialized variants extend the format for engineering content and embedded-file workflows:

  • PDF/A-4 supports the core PDF/A-4 archival profile.
  • PDF/A-4e supports engineering-oriented content and may include formats such as CAD, STEP, XML, and rich media.
  • PDF/A-4f supports arbitrary embedded-file attachments when the required association rules are followed.

PDF/UA-2 is the second generation of the PDF Universal Accessibility standard. It builds on PDF 2.0 and defines the document structure and metadata needed for reliable use with assistive technologies such as screen readers and braille displays.

For DsPdf .NET, v9.2 introduces new PDF/A-4 conformance levels and PDF/UA-2 generation support, along with APIs for PDF 2.0 namespaces, structure-tree relationships, revision metadata, and structure destinations. New APIs include PdfAConformanceLevel.PdfA4, PdfA4e, and PdfA4f; Namespace and NamespaceCollection; StructTreeRoot.Namespaces; StructElement.NS; ContentItem.StructElement; Metadata.PdfRev and Metadata.PdfUaRev; and new structure-destination overloads for DestinationXYZ, DestinationFit, DestinationFitH, DestinationFitV, DestinationFitR, DestinationFitB, DestinationFitBH, and DestinationFitBV that accept a StructElement.

DsPdfJS v9.2 provides corresponding standards-focused functionality while also making several capabilities already established in DsPdf .NET available to JavaScript developers, including tagged and marked content, output intents, associated files, and other PDF structure features.

The following example configures a document for PDF/UA-2 and initializes its PDF 2.0 structure tree. Additional tagging, alternative text, embedded fonts, and other required content-level details must be supplied for full conformance.

var doc = new GcPdfDocument();
doc.PdfVersion = "2.0";
doc.Lang = "en";
doc.Metadata.PdfUa = 2;
doc.Metadata.PdfUaRev = "2024";
doc.MarkInfo.Marked = true;
var ns = new Namespace("http://iso.org/pdf2/ssn");
doc.StructTreeRoot.Namespaces.Add(ns);
var documentElement = new StructElement("Document") { NS = ns };
doc.StructTreeRoot.Children.Add(documentElement);

As with existing PDF/A and PDF/UA support, these APIs enable applications to create documents that meet the standards. They do not automatically convert an arbitrary PDF into a conforming document or perform complete standards validation.

Help  | PDF/UA-2 Demo | PDF/A-4 Demo 

3D Annotation Support

DsPdf .NET and DsPdfJS v9.2 add support for representing 3D artwork through PDF 3D annotations.

3D Annotation Support | Included in Document Solutions for PDF .NET and JS Libraries

The new object model includes 3D annotations, 3D streams, views, activation and deactivation settings, presentation styles, toolbar visibility, transparency, animation behavior, lighting, rendering modes, and camera transformations.

These APIs support common embedded and windowed 3D viewing scenarios without requiring developers to manually construct the lower-level PDF dictionaries. Refer to the following code to create a 3D model annotation:

public class Annotation3D
{
    public int CreatePDF(Stream stream)
    {
        var doc = new GcPdfDocument();
        var page = doc.NewPage();
        // Load the 3D model (U3D format).
        var modelPath = Path.Combine(
            "Resources",
            "3DModels",
            "plane64x64_base.u3d");
        using var modelStream = File.OpenRead(modelPath);
        // Add a 3D annotation showing the model.
        var annotation = new Model3DAnnotation
        {
            Stream = new Model3DStream(
                modelStream,
                Model3DStreamFormat.U3D),
            ActivationCondition =
                Model3DActivationCondition.PageBecomesVisible,
            DeactivationCondition =
                Model3DDeactivationCondition.PageBecomesInvisible,
            Page = page,
            Rect = new RectangleF(
                rc.X,
                rc.Bottom + 18,
                72 * 5,
                72 * 4)
        };

        doc.Save(stream);
        return doc.Pages.Count;
    }
}

Help | Demo


Document Solutions PDF Viewer (DsPdfViewer)

Document Solutions PDF Viewer (DsPdfViewer) v9.2 improves touch interaction for PDF viewing on mobile devices and touch-enabled screens.

Improved Pinch-and-Zoom Behavior

Previously, pinch-to-zoom operations used the top-left corner of the document as the zoom focal point, regardless of where the user placed their fingers.

DsPdfViewer v9.2 corrects this behavior so that zooming remains centered around the user’s actual pinch location. This provides a more natural mobile experience, particularly when viewing large documents, technical drawings, maps, or detailed page content.

The improvement does not require a new public API and applies automatically when users pinch to zoom on supported touchscreen devices.

Demo


v9.1 - May 5, 2026

Document Solutions for PDF .NET (DsPdf .NET) v9.1 expands support for interactive PDF workflows with improvements to document-level JavaScripts and AcroForm field calculation order. These updates help developers build more capable PDF forms by making it easier to organize shared JavaScript logic at the document level and define calculation behavior more explicitly.

Together, these enhancements improve compatibility with standard PDF form behavior and give developers more control over how form logic is stored and managed. While v9.1 adds support for defining these scripts and calculation settings, it does not add support for executing document-level JavaScript in DsPdf .NET, DsPdfViewer, or DsPdfJS in this release.

Document-Level JavaScripts

DsPdf .NET v9.1 adds support for document-level JavaScripts, a standard PDF feature that allows reusable JavaScript functions to be stored at the document level and called from other JavaScript actions. This is especially useful in interactive forms, where shared validation or calculation logic can be defined once and reused across multiple fields or buttons.

The main API addition is GcPdfDocument.JavaScripts, a dictionary whose key is a unique script name and whose value is an ActionJavaScript object containing the associated script. This makes it easier to organize document-wide scripts in a way that aligns with the PDF specification and common Acrobat workflows.

var doc = new GcPdfDocument();
var p = doc.NewPage();
var fldA = AddTextField(p, "fldA", "fldA (should be less than 10)", 10, 10, 50);
fldA.Value = 5;
var fldB = AddTextField(p, "fldB", "fldB (should be greater than 1)", 10, 35, 50);
fldB.Value = 2;
var fldSum = AddTextField(p, "fldSum", "Sum of fldA and fldB", 10, 70, 50);
var btn = new PushButtonField();
doc.AcroForm.Fields.Add(btn);
btn.Widget.Page = p;
btn.Widget.Rect = new RectangleF(30, 120, 100, 30);
btn.Widget.ButtonAppearance.Caption = "Check & Calculate";
btn.Widget.Events.MouseDown = new ActionJavaScript("checkCalculate()");
string s =
"function checkCalculate()\r\n" +
"{\r\n" +
"    var fldA = this.getField('fldA');\r\n" +
"    var fldB = this.getField('fldB');\r\n" +
"    var fldSum = this.getField('fldSum');\r\n" +
"\r\n" +
"    var a = Number(fldA.value);\r\n" +
"    if (a >= 10)\r\n" +
"    {\r\n" +
"        app.alert('Invalid fldA.');\r\n" +
"        return false;\r\n" +
"    }\r\n" +
"\r\n" +
"    var b = Number(fldB.value);\r\n" +
"    if (b <= 1)\r\n" +
"    {\r\n" +
"        app.alert('Invalid fldB.');\r\n" +
"        return false;\r\n" +
"    }\r\n" +
"\r\n" +
"    fldSum.value = a + b;\r\n" +
"}\r\n";
doc.JavaScripts.Add("checkCalculate", new ActionJavaScript(s));
doc.Save("doc.pdf");

Help | Demo

Field Calculation Order Improvements

DsPdf .NET v9.1 also improves support for AcroForm field calculation order, making it easier to define which fields should be recalculated and in what sequence. Previously, this behavior depended on each field’s CalculationIndex, which was less intuitive and did not always reflect the intended PDF behavior when a field should be excluded from recalculation.

To simplify this, DsPdf .NET now adds the AcroForm.CalculationOrder property, which exposes the calculation order directly as an array of fields. Setting this property updates the corresponding field calculation indexes automatically. This provides a more straightforward way to manage the PDF /CO entry and makes form calculation behavior easier to inspect and control.

// This sample loads a document where the "fldSum" field is listed in AcroForm.CalculationOrder
// and replaces it with the "fldMin" field.
var doc = new GcPdfDocument();
var fs = new FileStream("DOC_7290.pdf", FileMode.Open);
doc.Load(fs);
var cf = doc.AcroForm.CalculationOrder;
Console.WriteLine(cf.Length.ToString());
Console.WriteLine(cf[0].Name);
doc.AcroForm.CalculationOrder = new Field[] { doc.AcroForm.Fields["fldMin"] };
doc.Save("doc.pdf");

Help | Demo

With support for document-level JavaScripts and a more user-friendly calculation order model, DsPdf v9.1 makes it easier to build and manage interactive PDF forms with behavior that more closely matches the PDF specification.


v9 - January 6, 2026

New Document Optimization API (Optimize)

The v9.0 release introduces a highly requested enhancement for PDF size reduction and cleanup: a new, unified Optimize() method on the GcPdfDocument class. This API brings together several existing optimization capabilities, such as image deduplication, font handling, stream compression, and object stream usage, into a single, customizable entry point. Developers can now compress and streamline PDFs with one call, significantly improving workflow efficiency and output file size.

Why a Unified Optimize Method?

DsPdf has long included multiple APIs for reducing document size, but developers often needed to combine them manually depending on the scenario. The new optimization pipeline simplifies this process by:

  • Consolidating compression and cleanup operations
  • Providing a single OptimizeDocumentOptions object to configure behaviors
  • Ensuring that optimization and saving happen together (required for options like PdfStreamHandling)
  • Making it easier to script automated processing and bulk PDF optimization workflows

This makes the new Optimize() method ideal for applications involving archiving, uploading, client-side delivery, and server-side document pipelines.

Optimize a PDF in One Line

The DsPdf v9.0 API adds two new overloads:

public void Optimize(Stream stream, OptimizeDocumentOptions options)
public void Optimize(string fileName, OptimizeDocumentOptions options)

Each performs all configured optimizations and then saves the result, ensuring optimizations that affect PDF structure take effect only on save.

Highly Configurable Optimization Options

The new OptimizeDocumentOptions class gives full control over how aggressive or conservative the optimization should be. Developers can fine-tune:

Compression & Stream Behavior
  • CompressionLevel – Overrides the document’s default compression.
  • PdfStreamHandling – Controls how existing streams are rewritten (especially useful for previously loaded PDFs).
  • UseObjectStreams – Enables single or multiple object streams to reduce size significantly.
Font Optimization
  • OptimizeFontsOptions – Shrink embedded fonts and remove unused glyphs.
  • RemoveEmbeddedFonts – Strip all embedded fonts for maximum size reduction (use with caution, as appearance may change).
Image Optimization
  • RemoveDuplicateImages – Consolidates identical image streams to reduce file size.
Document Cleanup
  • DiscardEmbeddedPageThumbnails
  • DiscardOutlines
  • DiscardSubmitImportResetActions
  • DiscardJavaScriptActions
  • DiscardEmbeddedFiles
One-Click Maximum Compression

For scenarios where smallest size is the only priority, such as archival or bandwidth-restricted environments, the SetForMinimumSize() method enables every aggressive optimization, including those not recommended for general use.

Example: Reduce PDF Size While Keeping Content Sharp

var doc = new GcPdfDocument();
using var stream = new FileStream("test.pdf", FileMode.Open);
doc.Load(stream);

var options = new OptimizeDocumentOptions
{
    DiscardEmbeddedPageThumbnails = true
};

doc.Optimize("optimized.pdf", options);

With the new Optimize() method, DsPdf v9.0 makes high-quality, automated PDF optimization easier and more powerful than ever.

Help | Demo