Browse our Products

Aspose.PDF for .NET 25.10

Improvements and Changes

Enhanced PDF Layer Visibility Control

This release introduces enhanced control over PDF layer visibility. You can now programmatically set the initial visibility state of a layer and lock it to prevent users from changing its visibility in a PDF viewer.

The bug with the Layer.Lock() method, which previously caused a NullReferenceException, has been fixed. Additionally, a new Layer.DefaultState property has been added. This property allows you to set the default visibility of a layer to either visible or hidden using the DefaultState enum.

Here is an example of how to create a hidden and locked layer:

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

    // Create a new PDF document
    using (Aspose.Pdf.Document doc = new Aspose.Pdf.Document())
    {
        // Add a page to the document
        Aspose.Pdf.Page page = doc.Pages.Add();
        page.SetPageSize(500, 500);

        // Load an image from a file stream
        using (Stream stream = new System.IO.FileStream(dataDir + "test.png", System.IO.FileMode.Open))
        {
            // Create a new layer with an ID and a name
            Aspose.Pdf.Layer layer = new Aspose.Pdf.Layer("1", "testlayer");

            // Set the initial visibility state of the layer to hidden
            layer.DefaultState = DefaultState.Hidden;

            // Add the image to the page's resources
            string imageName = page.Resources.Images.Add(stream);

            // Add operators to the layer's contents to display the image
            layer.Contents.Add(new Operators.GSave());
            layer.Contents.Add(new Operators.ConcatenateMatrix(500, 0, 0, 500, 0, 0));
            layer.Contents.Add(new Operators.Do(imageName));
            layer.Contents.Add(new Operators.GRestore());

            // Lock the layer to prevent its visibility from being changed in the PDF viewer
            layer.Lock();

            // Add the layer to the page
            page.Layers.Add(layer);
        }

        // Save the PDF document
        doc.Save(dataDir + "test_locked.pdf");
    }
}

Improved Dash Pattern Scaling

Aspose.PDF for .NET now correctly handles dash pattern scaling for lines of varying widths. Previously, dash patterns were sometimes scaled relative to the line width, which is inconsistent with the PDF standard and could lead to incorrect visual output when rendering to images. With this release, the rendering engine has been improved to use absolute units for dash patterns, ensuring that the appearance of dashed lines remains consistent regardless of line width, just as it does in Adobe Acrobat and other compliant PDF viewers.

Other notable enhancements and features

KeySummaryCategory
PDFNET-36257TEXT to PDF conversion: Move text with PagesizeEnhancement
PDFNET-35764PDF to Image - Improve conversion performanceEnhancement
PDFNET-35358XPS to TIFF - Conversion is slowEnhancement
PDFNET-33997Poor performance in PDF to Doc conversionEnhancement

Bug Fixing and Other Changes

KeySummaryCategory
PDFNET-36356XML to PDF - Extra table cell appearing on right sideBug
PDFNET-36221HTML to PDF - Formatting issues in resultant fileBug
PDFNET-36255Perfromance issue in PDF to TIFF conversionBug
PDFNET-36245HTML to PDF: using DOM approach misses imagesBug
PDFNET-35803Program Execution time difference in Aspose.Pdf.Generator and Aspose.Pdf.DocumentBug
PDFNET-36470Import of annotation increases output file sizeBug
PDFNET-58232Copy-pasting from resultant HTML produces malformed textBug
PDFNET-60217Extremely slow performance when converting PDF to HTMLBug
PDFNET-59514When converting an HTML document to PDF, an exception(s) occurs.Bug
PDFNET-60298PDF to XPS - Memory is not releasedBug
PDFNET-60818Generated PDF is not validated via PAC 2024Bug
PDFNET-35694XML to PDF - Corrupted PDF file when referenced font is not installedBug
PDFNET-35693XML to PDF - double border for first row appears on second pageBug
PDFNET-35828Margin issue with CropBoxBug
PDFNET-60201PDF to XPS to PDF: Misaligned characters and error message in outputBug
PDFNET-60860StackOverflowException occurs while extracting text using TextAbsorberBug
PDFNET-34354Error in opening the PDF document after Optimizing itBug
PDFNET-34414Attachments added usingFacades do not always openBug
PDFNET-34347Performance Issue: Conversion from HTML to PDFBug
PDFNET-34171Resizing an image not working properlyBug
PDFNET-34349HTML to PDF Conversion: Image not coming on right position in generated fileBug
PDFNET-34348Top border on every table missing when HTML is converted to PDFBug
PDFNET-34437CSS file as External Resource not applying to the generated PDF file.Bug
PDFNET-34438Issue with combining LTR text segments with RTL text segmentsBug
PDFNET-34436Table is not creating page breaksBug
PDFNET-34094Unable to delete page from PDF file once its saved in Byte ArrayBug
PDFNET-57465When inserting Svg with strikethrough text into Pdf, the strikethrough disappears.Bug
PDFNET-36155Content render outside the table when page breakBug
PDFNET-35234Html underline does not work when wrapping with italic tagBug
PDFNET-35293While adding and page break using replaceable symbol(#$NP) an additional line break added with page breakBug
PDFNET-35232Unable to find fields, while form created from inline HTML.Bug
PDFNET-35422Issue in Converting XFA form to PDFA1BBug
PDFNET-35328Concatenation method uses large MemoryBug
PDFNET-59978Multiple authors are not displaying and it is not possible to remove themBug
PDFNET-35952After scaling, the radion buttons lose the “selection”Bug
PDFNET-36002PDF to XPS: Conversion results in OutOfMemoryExceptionBug
PDFNET-60603Inconsistent Rendering Behavior with NaN Coordinates in Graphical ObjectsBug
PDFNET-59763Data tag being removed after PDF to TIFF conversionBug
PDFNET-60614Converting input PDF to raster formats or HTML produces completely broken resultsBug
PDFNET-60543Performance regression in SubsetFonts(FontSubsetStrategy.SubsetAllFonts)/Save() between 24.11 and later releasesBug
PDFNET-60825Regression: SaveAsync throws an exceptionBug
PDFNET-33994Replacing Text Issue when string is largeBug
PDFNET-33922Unable to concatenate PDF documentsBug
PDFNET-34033PdfFileEditor.Concatenate is not producing output when trying to save output in PDF_A_1A formatBug
PDFNET-60146Text Annotation is not appearing in output image with Aspose.Drawing 25.6 on LinuxBug
PDFNET-60538PDF to Excel - System.NullReferenceException: ‘Cannot access field ‘color’ of null.’Bug
PDFNET-60821PDF to Excel number formatting conversion issueBug
PDFNET-60171Inspect logs with Stack Overflow (2 cases) and resolve problemBug

Public API and Backward Incompatible Changes

Added APIs

  • Type: Aspose.Pdf.DefaultState
  • Field: Aspose.Pdf.DefaultState.Visible
  • Field: Aspose.Pdf.DefaultState.Hidden
  • Proerty: Aspose.Pdf.Layer.DefaultState Aspose.Pdf.DefaultState

Removed APIs

No removings.