Browse our Products

Aspose.PDF for .NET 25.8

Features and Enhancements

Starting from version 25.8, Aspose.PDF for .NET supports generating fully accessible Tagged Table of Contents (TOC) pages with proper navigation to corresponding sections, ensuring PDF/UA-1 compliance. This feature (ID PDFNET-59503) enables the creation of TOC pages with linked headers and nested sublists, thereby improving document accessibility.

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

    // Create PDF document
    using (var doc = new Aspose.Pdf.Document())
    {
        // Get tagged content for the PDF structure
        Aspose.Pdf.Tagged.ITaggedContent content = doc.TaggedContent;
        Aspose.Pdf.LogicalStructure.StructureElement rootElement = content.RootElement;
        content.SetLanguage("en-US");

        // Add the table of contents (TOC) page
        Aspose.Pdf.Page tocPage = doc.Pages.Add();
        tocPage.TocInfo = new Aspose.Pdf.TocInfo();

        // Create a TOC structure element
        Aspose.Pdf.LogicalStructure.TOCElement tocElement = content.CreateTOCElement();

        // Add the TOC element to the document structure tree
        rootElement.AppendChild(tocElement);

        // Add a content page
        doc.Pages.Add();

        // Create a header element and set its text
        Aspose.Pdf.LogicalStructure.HeaderElement header = content.CreateHeaderElement(1);
        header.SetText("1. Header");

        // Add the header to the document structure
        rootElement.AppendChild(header);

        // Create a TOC item (TOCI) element
        Aspose.Pdf.LogicalStructure.TOCIElement toci = content.CreateTOCIElement();

        // Add the TOCI element to the TOC element
        tocElement.AppendChild(toci);

        // Add an entry to the TOC page and link it to the TOCI element
        header.AddEntryToTocPage(tocPage, toci);

        // Add a logical reference to the header within the TOCI element
        toci.AddRef(header);

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

You can change the document size by automatically scaling the content on its pages. The PdfFileEditor.ResizeContents API supports resizing the entire document or specific pages, with flexible configuration for margins, content area, and page size.

// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ResizePage(Document document, int pageNumber, double targetWidth, double targetHeight, double width, double height)
{
    double marginWidth = (targetWidth - width) / 2;
    double marginHeight = (targetHeight - height) / 2;
   
    // Set the parameters
    var param = Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeParameters.PageResize(width, height);
    param.TopMargin = Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeValue.Units(marginHeight);
    param.BottomMargin = Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeValue.Units(marginHeight);
    param.LeftMargin = Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeValue.Units(marginWidth);
    param.RightMargin = Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeValue.Units(marginWidth);
    param.ChangeMediaBox = true;
    
    // Do resize
    new Aspose.Pdf.Facades.PdfFileEditor().ResizeContents(document, new int[] { pageNumber }, param);
}

Aspose.PDF for .NET 25.8 introduces style support for table borders, allowing you to set dashed, dotted, or custom border styles for tables. This feature (ID PDFNET-59287) enables you to create tables with visually distinctive borders using the GraphInfo properties such as DashArray, DashPhase, and LineWidth.

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

    // Create PDF document
    using (var doc = new Aspose.Pdf.Document())
    {
        var page = doc.Pages.Add();

        var table = new Aspose.Pdf.Table()
        {
            Border = new Aspose.Pdf.BorderInfo(
                Aspose.Pdf.BorderSide.Box,
                new Aspose.Pdf.GraphInfo
                {
                    DashArray = new int[] { 10, 10 },
                    DashPhase = 5,
                    LineWidth = 3
                })
        };

        var row = table.Rows.Add();
        row.Cells.Add("Dashed border cell");

        page.Paragraphs.Add(table);

        doc.Save(dataDir + "TableWithDashedBorder_out.pdf");
    }
}

Other notable enhancements and features

KeySummaryCategory
PDFNET-59857Setting the whole XMP blockEnhancement
PDFNET-60211Complete removal of digital signaturesEnhancement
PDFNET-60222Rotation not retained from XFDFEnhancement

Bug Fixing and Other Changes

KeySummaryCategory
PDFNET-51075HTML to PDF conversion file size too bigBug
PDFNET-60089KeyNotFoundException when converting PDF to HTMLBug
PDFNET-58838Crash when cloning a cellBug
PDFNET-60341Duplicate keys in ArrayTextSegment.NormalizeSegmentBug
PDFNET-60210PDF to PDF/A-2B: PDF becomes huge and has flawed imagesBug
PDFNET-60327Regression: Ligature symbols lost when converting Aptos Serif PDF to PDF/A-2BBug
PDFNET-60030PDF/UA compliance lost after Save() despite metadata-only changesBug
PDFNET-35440PDF document getting scrambled when printingBug
PDFNET-46073PDF/a files from Foxit are not detectedBug
PDFNET-47784Aspose.Pdf 20.2: Exception when trying to open particular Tex fileBug
PDFNET-54904Using XFA conversion without a license causes an exceptionBug
PDFNET-59762Aspose.Pdf.FontNotFoundException: Font Arial was not found on Linux App ServiceBug
PDFNET-48453API is not loading document with correct password - InvalidPasswordException is thrownBug
PDFNET-43801Import XPS - an argument exception error occurredBug
PDFNET-36401Exception while removing image from PDF fileBug
PDFNET-39312XPS to PDF - Exception during conversionBug
PDFNET-41037XFA to Standard Form - NullReferenceException is being generatedBug
PDFNET-41038XFA to Standard Form - NullReferenceException is being generatedBug
PDFNET-40203XPS to PDF - Exception during conversionBug
PDFNET-37478API throws exception while converting Dynamic PDF form to static PDF formBug
PDFNET-43367NullReferenceException occurs while converting dynamic form to standardBug
PDFNET-51572System.NullReferenceException Exception occurs while adding replacing Chinese TextBug
PDFNET-50517PDF to DOCX - System.NullReferenceExceptionBug
PDFNET-50977PDF to DOCX - an exception is thrownBug
PDFNET-51078System.ArgumentOutOfRangeException while saving PDF to DOCXBug
PDFNET-59162Problem convert PDF to PPTX with slides as imagesBug
PDFNET-59846“The given key was not present in the dictionary” exception in PDF_A_1A conversionBug
PDFNET-59163Freezing when converting PDF document to imageBug
PDFNET-40571PDF to JPEG: text characters rendered as squareBug
PDFNET-60332PS to PDF - Text converted into dots in the output PDFBug
PDFNET-59987PDF to TIFF: Output file is not rendered correctlyBug
PDFNET-60262Aspose.PDF 25.6: An exception is thrown when processing a page with the JpegDeviceBug
PDFNET-60263Aspose.PDF 25.6: Rendering a PDF page with the JpegDevice throws NullReferenceExceptionBug

Public API and Backward Incompatible Changes

Added APIs

  • Method: Aspose.Pdf.Cells.Add(Aspose.Pdf.Text.TextFragment) Aspose.Pdf.Cell
  • Property :Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeParameters.ChangeMediaBox System.Boolean
  • Method: Aspose.Pdf.LogicalStructure.HeaderElement.SetText(System.String) System.Void
  • Method: Aspose.Pdf.LogicalStructure.HeaderElement.AddEntryToTocPage(Aspose.Pdf.Page,Aspose.Pdf.LogicalStructure.TOCIElement) System.Void
  • Method: Aspose.Pdf.LogicalStructure.HeaderElement.AddEntryToTocPage(Aspose.Pdf.Page,Aspose.Pdf.LogicalStructure.ListLIElement) System.Void
  • Type: Aspose.Pdf.LogicalStructure.HeaderElementTextConflictException
  • Method: Aspose.Pdf.LogicalStructure.HeaderElementTextConflictException.#ctor(System.String) System.Void
  • Method: Aspose.Pdf.LogicalStructure.ListLIElement.AddRef(Aspose.Pdf.LogicalStructure.StructureElement) System.Void
  • Method: Aspose.Pdf.LogicalStructure.TOCElement.LinkTocPageTitleToHeaderElement(Aspose.Pdf.Page,Aspose.Pdf.LogicalStructure.HeaderElement) System.Void
  • Method: Aspose.Pdf.LogicalStructure.TOCIElement.AddRef(Aspose.Pdf.LogicalStructure.StructureElement) System.Void
  • Type: Aspose.Pdf.LogicalStructure.TOCpageHasNoTitleException
  • Method: Aspose.Pdf.LogicalStructure.TOCpageHasNoTitleException.#ctor(System.String) System.Void

Removed APIs

No removings.