Browse our Products

Aspose.PDF for .NET 26.3

Improvements and Changes

Features and Enhancements

Lossless Image Stream Recompression During PDF Optimization

Aspose.PDF for .NET 26.3 enhances PDF optimization by recompressing lossless image streams. As a follow-up to the previously resolved issue PDFNET-61177, the OptimizationOptions.CompressAllContentStreams property now also compresses image XObject streams with the lossless FlateDecode filter when no other filter has already been applied to an image.

This enhancement addresses PDFNET-61251 and helps further reduce optimized PDF file size while preserving image quality. It was introduced to narrow the optimization gap observed when comparing Aspose.PDF output with qpdf in lossless compression scenarios, especially for documents containing PNG, TIFF, RAW, and similar image streams.

Here is an example of how to use this enhancement:

// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void OptimizePdfWithLosslessImageStreamRecompression()
{
    // The path to the documents directory
    var dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments();

    // Open PDF document
    using (var document = new Aspose.Pdf.Document(dataDir + "input.pdf"))
    {
        // Configure optimization options
        var optimizeOptions = new Aspose.Pdf.Optimization.OptimizationOptions
        {
            SubsetFonts = true,
            AllowReusePageContent = true,
            CompressObjects = true,
            LinkDuplicateStreams = true,
            RemoveUnusedObjects = true,
            RemoveUnusedStreams = true,
            // Compress content streams and eligible image streams
            CompressAllContentStreams = true,
        };

        // Optimize PDF document
        document.OptimizeResources(optimizeOptions);

        // Save optimized PDF document
        document.Save(dataDir + "output.pdf");
    }
}

Image Compression Encoding During PDF Optimization

Aspose.PDF for .NET 26.3 improves image optimization behavior by encoding images in accordance with the value specified in ImageCompressionOptions.Encoding. This enhancement addresses PDFNET-61163, where optimized output images were previously stored as JPEG even when Jpeg2000 or Flate had been requested.

With this change, image recompression is now aligned with the selected encoding during optimization, making the results more predictable when resizing images, limiting resolution, and tuning quality settings.

Here is an example of how to use this enhancement:

// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void OptimizePdfImagesWithSelectedEncoding()
{
    // The path to the documents directory
    var dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments();

    // Open PDF document
    using (var pdf = new Aspose.Pdf.Document(dataDir + "input.pdf"))
    {
        // Configure optimization options
        var optimizeOptions = new Aspose.Pdf.Optimization.OptimizationOptions
        {
            AllowReusePageContent = false,
            CompressObjects = true,
            LinkDuplicateStreams = false,
            RemoveUnusedObjects = true,
            RemoveUnusedStreams = true,
            ImageCompressionOptions =
            {
                CompressImages = true,
                ResizeImages = true,
                MaxResolution = 150,
                ImageQuality = 90,
                Encoding = Aspose.Pdf.Optimization.ImageEncoding.Flate,
                Version = Aspose.Pdf.Optimization.ImageCompressionVersion.Mixed
            }
        };

        // Optimize PDF document resources
        pdf.OptimizeResources(optimizeOptions);

        // Save optimized PDF document
        pdf.Save(dataDir + "output.pdf");
    }
}

Render Comments When Saving as Image or HTML

Aspose.PDF for .NET 26.3 now supports rendering comments when saving PDF documents as an image or HTML. This new feature addresses PDFNET-42693 and makes it possible to preserve comment visibility in exported output formats instead of limiting them to PDF viewers only.

This feature is useful for review workflows where annotated documents need to be shared as PNG images or HTML pages while keeping comment information visible in the exported result.

Here is an example of how to use this feature:

// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void RenderCommentsToImageAndHtml()
{
    // The path to the documents directory
    var dataDir = RunExamples.GetDataDir_AsposePdf_Annotations();

    // Open PDF document
    using (var pdfDoc = new Aspose.Pdf.Document(dataDir + "pdf_with_comments.pdf"))
    {
        // Save the first page to PNG with comments rendered
        var device = new Aspose.Pdf.Devices.PngDevice();
        device.Process(pdfDoc.Pages[1], dataDir + "comments_out.png");

        // Save the first page to HTML with comments rendered
        var options = new Aspose.Pdf.HtmlSaveOptions
        {
            ExplicitListOfSavedPages = new[] { 1 },
            UseZOrder = true
        };

        pdfDoc.Save(dataDir + "comments_out.html", options);
    }
}

Improved PDF to TIFF Rendering Performance

Aspose.PDF for .NET 26.3 includes performance improvements for PDF to TIFF rendering. This enhancement addresses PDFNET-40575, where TIFF conversion had been reported as significantly slower than alternative tools for the provided sample document.

With this update, the same scenario shows a much faster conversion time in local verification, making high-volume rasterization workflows more efficient when exporting PDF pages to bitonal TIFF images.

Here is an example of how to use this enhancement:

// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ConvertPdfToTiff()
{
    // The path to the documents directory
    var dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion();

    // Open PDF document
    var pdfDocument = new Aspose.Pdf.Document(dataDir + "input.pdf");

    // Create Resolution object
    var resolution = new Aspose.Pdf.Devices.Resolution(300);

    // Create TiffSettings object
    var tiffSettings = new Aspose.Pdf.Devices.TiffSettings
    {
        Compression = Aspose.Pdf.Devices.CompressionType.CCITT4,
        Shape = Aspose.Pdf.Devices.ShapeType.None,
        SkipBlankPages = false,
        Depth = Aspose.Pdf.Devices.ColorDepth.Format1bpp
    };

    // Create TIFF device
    var tiffDevice = new Aspose.Pdf.Devices.TiffDevice(resolution, tiffSettings);

    for (int i = 1; i <= pdfDocument.Pages.Count; i++)
    {
        string targetFilename = dataDir + "Asposeout-" + i + ".tif";
        tiffDevice.Process(pdfDocument, i, i, targetFilename);
    }
}

Other Notable Enhancements

KeySummaryCategory
PDFNET-40691High memory usage with RemoveUnusedStreams optimization propertyEnhancement

Bug Fixing and Other Changes

KeySummaryCategory
PDFNET-40224Some objects are not converted to GrayScaleBug
PDFNET-40233Document resaved corrupts the documentBug
PDFNET-40245Flattening the PDF Form loses form field textBug
PDFNET-40267PDF to PDFA1b: text is missing in resultant PDFABug
PDFNET-40282PDF to JPEG: resulant image is blackBug
PDFNET-40314PDF to PDF/A - Resultant file is not PDF/A_1b compliantBug
PDFNET-40335PDF to XPS: font changed in resultant XPSBug
PDFNET-40338Exception when trying to convert Optimized PDF file to PDF/A formatBug
PDFNET-40341Text replacement issue using regular expressionBug
PDFNET-40376HTML to PDF conversion- display:none style is not honoredBug
PDFNET-40383HTMl to PDF - Tooltip is not properly renderingBug
PDFNET-40386PDF to HTML - Text in resultant file is garbledBug
PDFNET-40390Validate method is showing errors when validating PDF/A_1b compliant fileBug
PDFNET-40399PDF to PDF/A - Pages become black in resultant fileBug
PDFNET-40406HTML to PDF - TOC is having incorrect destination for linksBug
PDFNET-40431Loading and saving PDF document overlaps the charactersBug
PDFNET-40443PDF to PDF/A_3b - Text formatting in resultant fileBug
PDFNET-40483PDF to JPG conversion results in distorted imagesBug
PDFNET-40486PDF to PDF/A - Formatting issues in resultnat fileBug
PDFNET-40495PDF to HTML: background images are missingBug
PDFNET-40503Header object moves lower in every subsequent PDF pageBug
PDFNET-40516PDF to PDF_X_1A - Resultant file is not compliantBug
PDFNET-40522PDF to DOCX - Missing contents and misaligned fractionsBug
PDFNET-40534HTML to PDF: Large HTML file(5MB) is not convertedBug
PDFNET-40541PDF to XPS conversion generates invalid fileBug
PDFNET-40546PDF to DOC conversion throws OutOfMemmory ExceptionBug
PDFNET-40547XPS to PDF: vertical text is not rendered correctlyBug
PDFNET-40549PdfJavaScriptStripper is throwing NullReference ExceptionBug
PDFNET-40558PDF to DOCX - Formatting issues in resultant fileBug
PDFNET-40576Slow XPS loading when using X64 as target platformBug
PDFNET-40599Page contents become blank during file concatenationBug
PDFNET-40635Text searching hangs system by consumes its whole memoryBug
PDFNET-40658Exception when trying to concatenate PDF files generated by Aspose.WordsBug
PDFNET-40697ResizeContents results a blank documentBug
PDFNET-40714Incorrect page number for TOC elementsBug
PDFNET-40720HTML to PDF - Header and Footer not appearing on subsequent pagesBug
PDFNET-40729Concatenate method of PdfFileEditor object is throwing NullReference ExceptionBug
PDFNET-40738PDF to HTML: local hyperlinks are not renderedBug
PDFNET-40739PDF to HTML: bold text is being rendered as regular textBug
PDFNET-40740PDF to HTML: underlines are being rendered incorrectlyBug
PDFNET-40751PDF to Excel Conversion (Merged Columns are coming as one column)Bug
PDFNET-40752Unable to open concatenated PDF fileBug
PDFNET-40767Error viewing document after resizing pageBug
PDFNET-50318“Index was outside the bounds of the array.” exception when open documentBug
PDFNET-55002Mention important updates in documentationBug
PDFNET-60368File size increases drastically when embedding chinese fonts after filling form fieldsBug
PDFNET-61361PDF/A-2B conversion removes math characters when using OpenType MATH fontsBug
PDFNET-61455Overlay text with Unicode characters becomes corrupted after applying redaction annotationBug
PDFNET-61542Remove not used constBug
PDFNET-61707Harmful side effects in isolated code of Aspose.PdfBug
PDFNET-61724TextFragmentAbsorber rectangle coordinates do not align with visually rotated textBug
PDFNET-61801Text incorrectly detected as InvisibleBug
PDFNET-61808PDF/UA Conversion Hangs on Large PDF Files with Excessive Memory ConsumptionBug
PDFNET-61822Converting HTML to PDF Very Slow with Large HTML TextBug

Public API and Backward Incompatible Changes

Added APIs

  • Method: Aspose.Pdf.PageCollection.BeginUpdate System.Void
  • Method: Aspose.Pdf.PageCollection.EndUpdate System.Void

Removed APIs

No removings.

Backward Incompatible Changes

  • The compatibility package Aspose.PDF for .NET Framework 4.0 (DLLs only) is no longer published beginning with Aspose.PDF for .NET 26.3.