Browse our Products

Aspose.PDF for .NET 26.2

Improvements and Changes

Features and Enhancements

RTF to PDF Conversion

Aspose.PDF for .NET now supports direct conversion of Rich Text Format (RTF) files to PDF format. RTF is a widely compatible, cross-platform file format developed by Microsoft to enable easy document sharing between different word processors. It supports basic text formatting such as fonts, colors, bold, and italics, as well as images, offering more styling options than plain text.

The conversion can be achieved by using the RtfLoadOptions class, which should be passed as a parameter when creating an instance of the Document class.

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 ConvertRtfToPdf()
{
    // The path to the documents directory
    var dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion();

    // Initialize RTF load options
    var options = new Aspose.Pdf.RtfLoadOptions();

    // Open RTF document
    using (var document = new Aspose.Pdf.Document(dataDir + "ConvertRtfToPdf.rtf", options))
    {
        // Save the document as PDF
        document.Save(dataDir + "ConvertRtfToPdf_out.pdf");
    }
}

Table Placement After Last Page Element

Aspose.PDF for .NET now allows tables to be added precisely after the last content element on a page. By using the Page.CalculateContentBBox() method to determine the bounding box of existing content, developers can calculate the exact position where the last element ends and place tables immediately after it. When table data exceeds the available space on the current page, the table automatically flows to the next page, starting at the top rather than continuing from the same position as the original table.

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 AddTableAfterLastElement()
{
    // The path to the documents directory
    var dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments();

    // Load source PDF document
    using (Aspose.Pdf.Document doc = new Aspose.Pdf.Document(dataDir + "HelloWorld.pdf"))
    {
        // Initializes a new instance of the Table
        Aspose.Pdf.Table table = new Aspse.Pdf.Table();

        // Determine the existing content area on the page
        double contentAreaLLY = doc.Pages[1].CalculateContentBBox().LLY;
        float topMargin = 20;

        // Add the table after the existing content, with the 20pt margin before the table.
        table.Top = (float)(doc.Pages[1].Rect.Height - (contentAreaLLY - topMargin));

        // Set the top margin for the new pages added.
        doc.PageInfo.Margin.Top = topMargin;

        // Create a loop to add 10 rows
        for (int row_count = 1; row_count < 10; row_count++)
        {
            // Add row to table
            Aspose.Pdf.Row row = table.Rows.Add();
            // Add table cells
            row.Cells.Add("Column (" + row_count + ", 1)");
            row.Cells.Add("Column (" + row_count + ", 2)");
            row.Cells.Add("Column (" + row_count + ", 3)");
        }

        // Add table object to first page of input document
        doc.Pages[1].Paragraphs.Add(table);

        // Save updated document containing table object
        doc.Save(dataDir + "document_with_table.pdf");
    }
}
// Load source PDF document
using (Aspose.Pdf.Document doc = new Aspose.Pdf.Document(myDir + "HelloWorld.pdf"))
{
    // Initializes a new instance of the Table
    Aspose.Pdf.Table table = new Aspose.Pdf.Table();

    // Determine the existing content area on the page
    Aspose.Pdf.Rectangle contentArea = doc.Pages[1].CalculateContentBBox();

    // Add the table after the existing content, with the 20pt margin before the table.
    table.Top = (float)(doc.Pages[1].Rect.Height - (contentArea.LLY - 20));

    // Set the top margin for the new pages added.
    doc.PageInfo.Margin.Top = topMargin;

    // create a loop to add 10 rows
    for (int row_count = 1; row_count < 10; row_count++)
    {
        // add row to table
        Aspose.Pdf.Row row = table.Rows.Add();
        // add table cells
        row.Cells.Add("Column (" + row_count + ", 1)");
        row.Cells.Add("Column (" + row_count + ", 2)");
        row.Cells.Add("Column (" + row_count + ", 3)");
    }

    // Add table object to first page of input document
    doc.Pages[1].Paragraphs.Add(table);

    // Save updated document containing table object
    doc.Save(myDir + "document_with_table.pdf");
}

Complete Deletion of Invisible Text Objects

Aspose.PDF for .NET now supports the complete deletion of invisible text objects from PDF documents. The TextFragmentAbsorber class can now properly identify and remove text fragments that have their TextState.Invisible property set to true, or have a RenderingMode of TextRenderingMode.Invisible, or have a foreground color with zero alpha channel. Previously, attempting to remove invisible text using TextFragments.Remove() did not fully remove the text objects from the document. Now the original code snippet works as expected and successfully removes invisible text fragments from the document.

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

    Document pdfDoc = new Document(dataDir + "test.pdf");

    foreach (Page page in pdfDoc.Pages)
    {
        TextFragmentAbsorber absorber = new TextFragmentAbsorber();
        page.Accept(absorber);

        var fragmentsToRemove = absorber.TextFragments
            .Where(x => x.TextState.Invisible
                || x.TextState.RenderingMode == TextRenderingMode.Invisible
                || (x.TextState.ForegroundColor != null && x.TextState.ForegroundColor.A == 0))
            .ToList();

        foreach (var fragment in fragmentsToRemove)
        {
            absorber.TextFragments.Remove(fragment); // Now properly removes text from document
        }
    }

    pdfDoc.Save(dataDir + "output.pdf");
}

Other Notable Enhancements

KeySummaryCategory
PDFNET-39329Add Java script support to Annotations(PolygonAnnotation)Feature

Bug Fixing and Other Changes

KeySummaryCategory
PDFNET-40069PDF to HTML: incorrect position and formatting symbolsBug
PDFNET-40067PDF to HTML - Font is not applied for converted html file when viewing in IEBug
PDFNET-39179Image to PDF throws Out of Memory exceptionBug
PDFNET-39180TIFF to PDF - Resultant file is too largeBug
PDFNET-39187Issues with Table of Contents GenerationBug
PDFNET-39363In evaluation mode PDF to DOCX throw OutOfMemoryException instead evaluation exceptionBug
PDFNET-39378When calling GetHeight() method, the formatting of Table cell is changedBug
PDFNET-39430Image DPI is being set different in different OSBug
PDFNET-39438Pdf to Image does not render annotationsBug
PDFNET-39448PDF to PDF/A - Form fields and values inside them are removedBug
PDFNET-39450Slow printing on 64 bit OsBug
PDFNET-39456Image to PDF: only first page honor the page margin and image widht/heightBug
PDFNET-39462PDF to PDF/A - Process hangs during conversionBug
PDFNET-39487PDF to Excel: Columns in table shiftedBug
PDFNET-39489PDF to Excel: columns are shifted in resultant ExcelBug
PDFNET-39496TextAbsorber dies with OutOfMemory exceptionBug
PDFNET-39509HTML to PDF - img with CSS display:none stylesheet is not being honoredBug
PDFNET-39533PDF export to PNG treats inner glow like a tint for the frameBug
PDFNET-39558PCL to PDF - Incorrect resultant fileBug
PDFNET-39559PCL to PDF - Missing contents and Formatting issues in resultant fileBug
PDFNET-39560PCL to PDF - Formatting issues in resultant fileBug
PDFNET-39570PDF to HTML - Contents overlap table borderBug
PDFNET-39575Optimizing Merged PDF document results in a corrupt PDF documentBug
PDFNET-39596PDF to PDF/A - Resultant file is not PDF/A_2b compliantBug
PDFNET-39599PDF to HTML: link is not being rendered incorrectlyBug
PDFNET-39613API throws InvalidValueFormatException upon updating empty creation date fieldBug
PDFNET-39630Unable to detect corrupted PDF fileBug
PDFNET-39645XML to PDF - More time is being consumed to convert XML to PDFBug
PDFNET-39646Adding table in rotated page results incorrect rendering of tableBug
PDFNET-39666Seems infinite loop when trying to open attached documentBug
PDFNET-39667PDF to PDF/A - Resultant file is not PDF/A_1a compliantBug
PDFNET-39672Optimization issue: UnembedFonts property of OptimizeResources throws exceptionBug
PDFNET-39715Problem when trying to extract tables from PDFBug
PDFNET-39731HTMl to PDF - Image from URL is not being rendered in PDFBug
PDFNET-39733Printing of PDF created with Aspose.Pdf takes much timeBug
PDFNET-39736Problem when trying to extract tables from PDFBug
PDFNET-39738Image to PDF conversion throws OutOfMemoryExceptionBug
PDFNET-40024Text overlapping problem when updating hyperlink text with long textBug
PDFNET-40025PDF to XPS - Contents missing in resultant fileBug
PDFNET-40031PDF to XPS - Colors are inverted in resultant fileBug
PDFNET-40034Unable to convert PDF from RGB colorspace to GrayscaleBug
PDFNET-40063Adobe Acrobat shows error once GoToRemoteAction is addedBug
PDFNET-40067PDF to HTML - Font is not applied for converted html file when viewing in IEBug
PDFNET-40069PDF to HTML: incorrect position and formatting symbolsBug
PDFNET-40070PDF Compression corrupts the documentBug
PDFNET-43045PDF to PDF/A-3A - Resultant file did not pass the compliance test in PreflightBug
PDFNET-43046PDF to PDF/A-3B - Resultant file did not pass the compliance test in PreflightBug
PDFNET-49989“Index was out of range. Must be non-negative and less than the size of the collection. (Parameter ‘index’)” exception when open EPS fileBug
PDFNET-50043EPS Document freezes on openBug
PDFNET-50465“Invalid Base.” exception when open PS documentBug
PDFNET-50785“Method is not implemented” exception when open EPS documentBug
PDFNET-50790“Attempted to divide by zero.” exception when open EPS fileBug
PDFNET-55002Mention important updates in documentationBug
PDFNET-60735Background strips are incorrectly rendered when converting PDF to HTML in AsExternalPngFilesReferencedViaSvg modeBug
PDFNET-60892NullReferenceException: “Object reference not set to an instance of an object.” occurs when concatenating two PDF documents.Bug
PDFNET-61025PDF becomes invalid after optimization with ImageCompressionOptions.CompressImages = trueBug
PDFNET-61179PDF Conversion to TIFF - an exception is thrownBug
PDFNET-61536PdfExtractor.ExtractText throws ArgumentNullExceptionBug
PDFNET-61542Remove not used constBug
PDFNET-61600Regression: TextAbsorber throws ArgumentNullException on specific page starting from 25.12.0Bug
PDFNET-61647Regression: Accepting absorber raises ArgumentNullExceptionBug

Public API and Backward Incompatible Changes

Added APIs

No addings.

Removed APIs

No removings.

Backward Incompatible Changes

No changes.