Browse our Products

Aspose.PDF for .NET 26.6

Improvements and Changes

Features and Enhancements

Integrated OCR for PDF Text Recognition

Aspose.PDF for .NET 26.6 introduces integrated OCR support for extracting plain text from PDF pages that need optical character recognition. This feature addresses issue PDFNET-58807 and adds the Aspose.Pdf.Ocr namespace with OcrTextAbsorber, OcrTextRecognitionOptions, and OcrLanguage.

The OCR absorber follows the familiar Aspose.PDF visitor pattern. You can recognize text from a single Page, from a whole Document, or by passing the absorber to Page.Accept or PageCollection.Accept. Recognition options allow you to configure the language, rendering resolution, and page separator used when text is recognized from multiple pages. By default, OCR uses OcrLanguage.English, 300 DPI, and a double line break between recognized page texts.

Here is an example of how to recognize text with OCR:

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

    // Open PDF document
    using (var document = new Aspose.Pdf.Document(dataDir + "input.pdf"))
    {
        // Configure OCR recognition options
        var options = new Aspose.Pdf.Ocr.OcrTextRecognitionOptions
        {
            Language = Aspose.Pdf.Ocr.OcrLanguage.English,
            Resolution = 300,
            PageSeparator = "\n\n"
        };

        // Recognize text from all pages
        var absorber = new Aspose.Pdf.Ocr.OcrTextAbsorber(options);
        document.Pages.Accept(absorber);

        // Save recognized text
        System.IO.File.WriteAllText(dataDir + "recognized-text.txt", absorber.Text);
    }
}

The recognized text is available through the OcrTextAbsorber.Text property. If you call Visit or Accept again with the same absorber instance, the previous recognition result is replaced by the latest result.

Signing with Certificate and TSA

Aspose.PDF for .NET 26.6 improves certificate-based signing workflows that use a timestamp authority (TSA). This enhancement addresses issue PDFNET-55205 and helps create signatures with timestamp settings when a signing certificate and TSA server are used together.

You can embed a timestamp in the digital signature that corresponds to the certificate of your choice. The timestamp settings are assigned to the signature object before calling PdfFileSignature.Sign.

The following example shows how to sign a PDF document with a certificate and a timestamp server:

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

    // Open PDF document
    using (var document = new Aspose.Pdf.Document(dataDir + "SimpleResume.pdf"))
    {
        // Create an instance of PdfFileSignature for working with signatures in the document
        using (var signature = new Aspose.Pdf.Facades.PdfFileSignature(document))
        {
            // Create a certificate-based signature
            var pkcs = new Aspose.Pdf.Forms.PKCS7(pfxFilePath, password);

            // Create timestamp settings
            var timestampSettings = new Aspose.Pdf.TimestampSettings("https://freetsa.org/tsr", string.Empty);
            pkcs.TimestampSettings = timestampSettings;

            var rect = new System.Drawing.Rectangle(100, 100, 200, 100);

            // Sign PDF document
            signature.Sign(1, "Signature Reason", "Contact", "Location", true, rect, pkcs);

            // Save PDF document
            signature.Save(dataDir + "DigitallySignWithTimeStamp_out.pdf");
        }
    }
}

Bug Fixing and Other Changes

KeySummaryCategory
PDFNET-47758PDF to PDF/A conversion memory issue in Aspose.PDFQuality issue
PDFNET-57270PDF to image: garbled charactersBug
PDFNET-42412Image to PDF conversion throws an error if Aspose.Pdf.dll is added from GACBug
PDFNET-42383Optimizing PDF disturbs content formattingBug
PDFNET-42269PDF to PDF/A conversion generates output with incorrect formattingBug
PDFNET-42273Content of page does not fit correctly inside page when converting HTML to PDFBug
PDFNET-59521System.NullReferenceException on the Visit() methodBug
PDFNET-58561Garbage characters appear in output TIFF after conversionBug
PDFNET-58683Memory leak in Aspose.PDF v23.11 and laterBug
PDFNET-62138Some text content is missing when converting PDF to PNG and HTMLBug
PDFNET-42379RadioButtonField causes an error when opened in Adobe Acrobat for AndroidBug
PDFNET-42424DropDown value is not completely visible when calling the Flatten() methodBug
PDFNET-42382PDF compression does not workBug
PDFNET-42291HTML to PDF conversion image position and text overwrite issueBug
PDFNET-42292Some fields become blank after FlattenAllFields()Bug
PDFNET-42285OptimizeResources() damages PDF documentBug
PDFNET-42293PDF document shows an error after FlattenAllFields()Bug
PDFNET-62262PDF/A conversion generates RGB OutputIntent for documents containing CMYK content and incorrectly passes internal validationBug
PDFNET-62197Regression: ZUGFeRD XMP metadata version value is incorrectly serialized during PDF/A saveBug
PDFNET-62136Text line is missing when rasterizing PDF page to imageBug
PDFNET-62179PDF to SVG conversion generates fragmented hyperlink text and incorrect clickable areasBug
PDFNET-49684PDF to PDF/A API throws an exceptionBug
PDFNET-62280PDF/A conversion succeeds in Aspose.PDF but output is rejected by veraPDF and AdobeBug
PDFNET-62198MediaBox and CropBox update cascades to pages that inherit shared boxesBug
PDFNET-59481Regression: loading HTML file consumes all memoryBug
PDFNET-42109HTML to PDF: black band in the generated PDFBug
PDFNET-42094Heading numbers are in reverse orderBug
PDFNET-42089PDF to PDF/A-3a conversion issueBug
PDFNET-42103Text formatting issue when converting XFA form to standard formBug
PDFNET-42104Data is lost when converting XFA form to standard formBug
PDFNET-42101Draw property removes some contents of TextStampBug

Public API and Backward Incompatible Changes

Added APIs

  • Type: Aspose.Pdf.Ocr.OcrLanguage
  • Type: Aspose.Pdf.Ocr.OcrTextAbsorber
  • Type: Aspose.Pdf.Ocr.OcrTextRecognitionOptions
  • Method: Aspose.Pdf.Ocr.OcrTextAbsorber.#ctor System.Void
  • Method: Aspose.Pdf.Ocr.OcrTextAbsorber.#ctor(Aspose.Pdf.Ocr.OcrTextRecognitionOptions) System.Void
  • Method: Aspose.Pdf.Ocr.OcrTextAbsorber.Visit(Aspose.Pdf.Document) System.Void
  • Method: Aspose.Pdf.Ocr.OcrTextAbsorber.Visit(Aspose.Pdf.Page) System.Void
  • Method: Aspose.Pdf.Ocr.OcrTextRecognitionOptions.#ctor System.Void
  • Method: Aspose.Pdf.Page.Accept(Aspose.Pdf.Ocr.OcrTextAbsorber) System.Void
  • Method: Aspose.Pdf.PageCollection.Accept(Aspose.Pdf.Ocr.OcrTextAbsorber) System.Void
  • Property: Aspose.Pdf.Ocr.OcrTextAbsorber.Options Aspose.Pdf.Ocr.OcrTextRecognitionOptions
  • Property: Aspose.Pdf.Ocr.OcrTextAbsorber.Text System.String
  • Property: Aspose.Pdf.Ocr.OcrTextRecognitionOptions.Language Aspose.Pdf.Ocr.OcrLanguage
  • Property: Aspose.Pdf.Ocr.OcrTextRecognitionOptions.PageSeparator System.String
  • Property: Aspose.Pdf.Ocr.OcrTextRecognitionOptions.Resolution System.Int32
  • Field: Aspose.Pdf.Ocr.OcrLanguage.Arabic
  • Field: Aspose.Pdf.Ocr.OcrLanguage.Auto
  • Field: Aspose.Pdf.Ocr.OcrLanguage.Chinese
  • Field: Aspose.Pdf.Ocr.OcrLanguage.English
  • Field: Aspose.Pdf.Ocr.OcrLanguage.French
  • Field: Aspose.Pdf.Ocr.OcrLanguage.German
  • Field: Aspose.Pdf.Ocr.OcrLanguage.Indonesian
  • Field: Aspose.Pdf.Ocr.OcrLanguage.Italian
  • Field: Aspose.Pdf.Ocr.OcrLanguage.Japanese
  • Field: Aspose.Pdf.Ocr.OcrLanguage.Kazakh
  • Field: Aspose.Pdf.Ocr.OcrLanguage.Korean
  • Field: Aspose.Pdf.Ocr.OcrLanguage.Polish
  • Field: Aspose.Pdf.Ocr.OcrLanguage.Portuguese
  • Field: Aspose.Pdf.Ocr.OcrLanguage.Russian
  • Field: Aspose.Pdf.Ocr.OcrLanguage.Spanish
  • Field: Aspose.Pdf.Ocr.OcrLanguage.Ukrainian

Removed APIs

No removings.

Backward Incompatible Changes

No changes.