What's new

What’s new in Aspose.PDF 23.8

From 23.8 support to add Incremental Updates detection.

The function for detecting Incremental Updates in a PDF document has been added. This function returns ‘true’ if a document was saved with incremental updates; otherwise, it returns ‘false’.

    var path = "C:\test.pdf";
    var doc = new Document(path);

Also, 23.8 supports the ways to work with nested checkbox fields. Many fillable PDF forms have checkbox fields that act as radio groups:

  • Create multi-value checkbox field:

    using (var document = new Document())
    var page = document.Pages.Add();

    var checkbox = new CheckboxField(page, new Rectangle(50, 50, 70, 70));

    // Set the first checkbox group option value
    checkbox.ExportValue = "option 1";

    // Add new option right under existing ones
    checkbox.AddOption("option 2");

    // Add new option at the given rectangle
    checkbox.AddOption("option 3", new Rectangle(100, 100, 120, 120));


    // Select the added checkbox
    checkbox.Value = "option 2";
  • Get and set value of a multi-value checkbox:

    using (Document doc = new Document("example.pdf"))
    Form form = doc.Form;
    CheckboxField checkbox = form.Fields[0] as CheckboxField;

    // Allowed values may be retrieved from the AllowedStates collection
    // Set the checkbox value using Value property
    checkbox.Value = checkbox.AllowedStates[0];
    checkboxValue = checkbox.Value; // the previously set value, e.g. "option 1"

    // The value should be any element of AllowedStates
    checkbox.Value = "option 2";
    checkboxValue = checkbox.Value; // option 2

    // Uncheck boxes by either setting Value to "Off" or setting Checked to false
    checkbox.Value = "Off";
    // or, alternately:
    // checkbox.Checked = false;
    checkboxValue = checkbox.Value; // Off

What’s new in Aspose.PDF 23.7

From Aspose.PDF 23.7 support to add the shape extraction:

    public void PDFNET_46298()
        var input1 = "46298_1.pdf";
        var input2 = "46298_2.pdf";

        var source = new Document(input1);
        var dest = new Document(input2);

        var graphicAbsorber = new GraphicsAbsorber();
        var area = new Rectangle(90, 250, 300, 400);
        dest.Pages[1].AddGraphics(graphicAbsorber.Elements, area);

Also supports the ability to detect Overflow when adding text:

    var doc = new Document();
    var paragraphContent = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras nisl tortor, efficitur sed cursus in, lobortis vitae nulla. Quisque rhoncus, felis sed dictum semper, est tellus finibus augue, ut feugiat enim risus eget tortor. Nulla finibus velit nec ante gravida sollicitudin. Morbi sollicitudin vehicula facilisis. Vestibulum ac convallis erat. Ut eget varius sem. Nam varius pharetra lorem, id ullamcorper justo auctor ac. Integer quis erat vitae lacus mollis volutpat eget et eros. Donec a efficitur dolor. Maecenas non dapibus nisi, ut pellentesque elit. Sed pellentesque rhoncus ante, a consectetur ligula viverra vel. Integer eget bibendum ante. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur elementum, sem a auctor vulputate, ante libero iaculis dolor, vitae facilisis dolor lorem at orci. Sed laoreet dui id nisi accumsan, id posuere diam accumsan.";
    var rectangle = new Rectangle(100, 600, 500, 700, false);
    var paragraph = new TextParagraph();
    var fragment = new TextFragment(paragraphContent);
    paragraph.VerticalAlignment = VerticalAlignment.Top;
    paragraph.FormattingOptions.WrapMode = TextFormattingOptions.WordWrapMode.ByWords;
    paragraph.Rectangle = rectangle;
    var isFitRectangle = fragment.TextState.IsFitRectangle(paragraphContent, rectangle);
    while (!isFitRectangle)
        fragment.TextState.FontSize -= 0.5f;
        isFitRectangle = fragment.TextState.IsFitRectangle(paragraphContent, rectangle);
    TextBuilder builder = new TextBuilder(doc.Pages.Add());

What’s new in Aspose.PDF 23.6

From Aspose.PDF 23.6 support to add the next plugins:

  • Aspose PdfConverter Html to PDF
  • Aspose PdfOrganizer Resize API
  • Aspose PdfOrganizer Compress API

Update the Aspose.PdfForm

  • add feature ‘Export “Value’s from fields in document to CSV file”
  • add the ability to set properties for a separate fields

Also support the add the ability to set the title of the HTML, Epub page:

    var document = new Document(Params.InputPath + "53357.pdf");

    var htmlSaveOptions = new HtmlSaveOptions
        ExplicitListOfSavedPages = new[] { 1 },
        SplitIntoPages = false,
        FixedLayout = true,
        CompressSvgGraphicsIfAny = false,
        SaveTransparentTexts = true,
        SaveShadowedTextsAsTransparentTexts = true,
        FontSavingMode = HtmlSaveOptions.FontSavingModes.AlwaysSaveAsWOFF,
        RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground,
        PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml,
        Title = "Title for page"   // <-- this added

    document.Save(Params.OutputPath + "53357-out.html", htmlSaveOptions);

What’s new in Aspose.PDF 23.5

From 23.5 support to add RedactionAnnotation FontSize option. Use the next code snippet to solve this task:

    Document doc = new Document(dataDir + "test_factuur.pdf");

    // Create RedactionAnnotation instance for specific page region
    RedactionAnnotation annot = new RedactionAnnotation(doc.Pages[1], new Aspose.Pdf.Rectangle(367, 756.919982910156, 420, 823.919982910156));
    annot.FillColor = Aspose.Pdf.Color.Black;

    annot.BorderColor = Aspose.Pdf.Color.Yellow;
    annot.Color = Aspose.Pdf.Color.Blue;
    // Text to be printed on redact annotation
    annot.OverlayText = "(Unknown)";
    annot.TextAlignment = Aspose.Pdf.HorizontalAlignment.Center;
    // Repat Overlay text over redact Annotation
    annot.Repeat = false;
    // New property there !
    annot.FontSize = 20;
    // Add annotation to annotations collection of first page
    // Flattens annotation and redacts page contents (i.e. removes text and image
    // Under redacted annotation)
    dataDir = dataDir + "47704_RedactPage_out_NETCORE.pdf";

What’s new in Aspose.PDF 23.4

Aspose.PDF announced the release of .NET 7 SDK.

What’s new in Aspose.PDF 23.3.1

From Aspose.PDF 23.3 support to add the next plugins:

  • Aspose.PdfForm
  • Aspose.PdfConverter PDF to HTML
  • Aspose.PdfConverter PDF to XLSX
  • Aspose.PdfOrganizer Rotate
  • Aspose.PdfExtrator for Images

What’s new in Aspose.PDF 23.3

Version 23.3 introduced support for adding a resolution to an image. Two methods can be used to solve this problem:

    var table = new Table
                ColumnWidths = "600"

            for(var j = 0; j < 2; j ++)
                var row = table.Rows.Add();
                var cell = row.Cells.Add();
                cell.Paragraphs.Add(new Image()
                    IsApplyResolution = true,
                    File = imageFile


And the second approach:

    page.Paragraphs.Add(new Image()
                IsApplyResolution = true,
                File = imageFile
            page.Paragraphs.Add(new Image()
                IsApplyResolution = true,
                File = imageFile

The image will be placed with scaled resolution or u can set FixedWidth or FixedHeight properties in combination with IsApplyResolution

What’s new in Aspose.PDF 23.1.1

From Aspose.PDF 23.1.1 support to add the next plugins:

  • Aspose.PdfOrganizer plugin
  • Aspose.PdfExtractor plugin

What’s new in Aspose.PDF 23.1

From 23.1 version support to create PrinterMark annotation.

Printer’s marks are graphic symbols or text added to a page to assist production personnel in identifying components of a multiple-plate job and maintaining consistent output during production. Examples commonly used in the printing industry include:

  • Registration targets for aligning plates
  • Gray ramps and colour bars for measuring colours and ink densities
  • Cut marks showing where the output medium is to be trimmed

We will show the example of the option with color bars for measuring colors and ink densities. There is a basic abstract class PrinterMarkAnnotation and from it child ColorBarAnnotation - which already implements these stripes. Let’s check the example:

var outFile = myDir + "ColorBarTest.pdf");

using (var doc = new Document())
    Page page = doc.Pages.Add();
    page.TrimBox = new Aspose.Pdf.Rectangle(20, 20, 580, 820);

void AddAnnotations(Page page)
    var rectBlack = new Aspose.Pdf.Rectangle(100, 300, 300, 320);
    var rectCyan = new Aspose.Pdf.Rectangle(200, 600, 260, 690);
    var rectMagenta = new Aspose.Pdf.Rectangle(10, 650, 140, 670);

    var colorBarBlack = new ColorBarAnnotation(page, rectBlack);
    var colorBarCyan = new ColorBarAnnotation(page, rectCyan, ColorsOfCMYK.Cyan);
    var colorBaMagenta = new ColorBarAnnotation(page, rectMagenta);
    colorBaMagenta.ColorOfCMYK = ColorsOfCMYK.Magenta;
    var colorBarYellow = new ColorBarAnnotation(page, new Aspose.Pdf.Rectangle(400, 250, 450, 700), ColorsOfCMYK.Yellow);


Also support the vector images extraction. Try using the following code to detect and extract vector graphics:

    var doc = new Document(input);


What’s new in Aspose.PDF 22.12

From this release support to convert PDF to DICOM Image

    Document doc = new Document("source.pdf");
    DicomDevice dicom = new DicomDevice();
    FileStream outStream = new FileStream("out.dicom", FileMode.Create, FileAccess.ReadWrite);
    dicom.Process(doc.Pages[1], outStream);

What’s new in Aspose.PDF 22.09

From 22.09 support adding property for modify the order of the subject rubrics (E=, CN=, O=, OU=, ) into the signature.

    using (var fileSign = new PdfFileSignature())
        var rect = new System.Drawing.Rectangle(100, 100, 400, 100);
        var signature = new PKCS7Detached(inputPfx, "123456789");
        signature.CustomAppearance = new SignatureCustomAppearance()
            UseDigitalSubjectFormat = true,
            DigitalSubjectFormat = new SubjectNameElements[] { SubjectNameElements.CN, SubjectNameElements.O }
            //DigitalSubjectFormat = new SubjectNameElements[] { SubjectNameElements.OU, SubjectNameElements.S, SubjectNameElements.C }
        fileSign.Sign(1, true, rect, signature);

What’s new in Aspose.PDF 22.6

From 22.5 support to extract SubScript and SuperScript text from PDF.

If the PDF document contains SubScript and SuperScript text such as H2O, then extracting the text from the PDF must also extract their formatting information (in the extracted plain text). If the PDF contains text in italics, it must also be included in the extracted content.

Document doc = new Document(input);
TextFragmentAbsorber absorber = new TextFragmentAbsorber("TM");

What’s new in Aspose.PDF 22.4

This release includes information for Aspose.PDF for .NET:

  • PDF to ODS: Recognize text in subscript and superscript;


Document pdfDocument = new Document("Superscript-Subscript.pdf");
ExcelSaveOptions options = new ExcelSaveOptions();
options.Format = ExcelSaveOptions.ExcelFormat.ODS;
pdfDocument.Save("output.ods"), options);
  • PDF to XMLSpreadSheet2003: Recognize text in subscript and superscript;

  • PDF to Excel: Recognize text in subscript and superscript;

  • Remove UR signatures while saving document;

  • Remove Suspects flag in MarkInfo while saving document;

  • Remove Info while saving document

What’s new in Aspose.PDF 22.3

This release includes the following updates:

  • Support for AFRelationship;

  • PDF header validation;

  • Remove adbe.x509.rsa_sha1 subfilter while saving document;

  • Format Field as Number and Date Format;

  • Prohibit use RC4 encryption in FDF 2.0ю

What’s new in Aspose.PDF 22.2

From the 22.2 version it is possible to sign a document using PdfFileSignature with LTV, and with being able to change the hashing from SHA1 to SHA256.

Example of using:
var inputPdf = "51168.pdf";
var inputPfx = "51168.pfx";
var inputPfxPassword = "111111";
var outputPdf = "51168.pdf";

using (var doc = new Document(inputPdf))
    using (PdfFileSignature signature = new PdfFileSignature(doc))
        var pkcs = new PKCS7(inputPfx, inputPfxPassword)
            UseLtv = true,
            TimestampSettings = new TimestampSettings("http://freetsa.org/tsr", string.Empty, DigestHashAlgorithm.Sha256)
        signature.Sign(1, false, new System.Drawing.Rectangle(300, 100, 1, 1), pkcs);

What’s new in Aspose.PDF 22.1

Now, Aspose.PDF for .NET supports loading documents from one of the most popular document formats, Portable Document Format (PDF) version 2.0.

What’s new in Aspose.PDF 21.11

Allow non-latin characters in password

Aspose.Pdf.Facades.PdfFileSecurity fileSecurity = new Aspose.Pdf.Facades.PdfFileSecurity();
fileSecurity.AllowExceptions = true;
 bool res = fileSecurity.EncryptFile("æøå", "æøå", Aspose.Pdf.Facades.DocumentPrivilege.Print, Aspose.Pdf.Facades.KeySize.x256, Aspose.Pdf.Facades.Algorithm.AES);
    catch(Exception e)
    Console.WriteLn("Exception: " + e.Message);

What’s new in Aspose.PDF 21.10

How to detect hidden text?

Please use TextState.Invisible to get information about invisibility of text out of rendering mode setting.

We used the following code for testing:

Document pdf = new Document(dataDir + "TestPage.pdf");
var page = pdf.Pages[1];
var textFragmentAbsorber = new TextFragmentAbsorber();
var textFragmentCollection = textFragmentAbsorber.TextFragments;
for (int i = 1; i <= textFragmentCollection.Count; i++)
    TextFragment fragment = textFragmentCollection[i];
    Console.WriteLine("Fragment {0} at {1}", i, fragment.Rectangle.ToString());
    Console.WriteLine("Text: {0}", fragment.Text);
    Console.WriteLine("RenderingMode: {0}", fragment.TextState.RenderingMode.ToString());
    Console.WriteLine("Invisibility: {0}", fragment.TextState.Invisible);

How do get information about the number of layers in a PDF document?

Please use code snippet:
var inFile = "1234.pdf";
Document doc = new Document(inFile);
List layers = doc.Pages[1].Layers;

What’s new in Aspose.PDF 21.9

Customize background color for signature appearance and the font color of the labels in the signature area with Aspose.PDF for .NET.

using (PdfFileSignature pdfSign = new PdfFileSignature())
    var rect = new System.Drawing.Rectangle(310, 45, 200, 50);
    var pkcs = new PKCS7(inPfxFile, "");
    pkcs.CustomAppearance = new SignatureCustomAppearance()
    {//set colors
        ForegroundColor = Color.DarkGreen,
        BackgroundColor = Color.LightSeaGreen,
    pdfSign.Sign(1, true, rect, pkcs);

What’s new in Aspose.PDF 21.8

How to change text color in Digital Signature?

In the 21.8 version ForegroundColor property, it allows changing text color in Digital Signature.

using (PdfFileSignature pdfSign = new PdfFileSignature())
    //create a rectangle for signature location
    System.Drawing.Rectangle rect = new System.Drawing.Rectangle(310, 45, 200, 50);
    PKCS7 pkcs = new PKCS7(inPfxFile, "");
    pkcs.CustomAppearance = new SignatureCustomAppearance()
    {//set text color
        ForegroundColor = Color.Green
    // sign the PDF file
    pdfSign.Sign(1, true, rect, pkcs);
    //save output PDF file

What’s new in Aspose.PDF 21.7

PDF creation based on XML and XLS with parameters

To add XSL params we need to create own XsltArgumentList and set as property in XslFoLoadOptions. The following snippet shows how to use this class with the sample files described above.

public static void Example_XSLFO_to_PDF()
        var XmlContent = File.ReadAllText(_dataDir + "employees.xml");
        var XsltContent = File.ReadAllText(_dataDir + "employees.xslt");

        var options = new Aspose.Pdf.XslFoLoadOptions();

        //Example of using XsltArgumentList
         XsltArgumentList argsList = new XsltArgumentList();
        argsList.AddParam("isBoldName", "", "yes");

        var pdfDocument = new Aspose.Pdf.Document(TransformXml(XmlContent, XsltContent, argsList), options);
        pdfDocument.Save(_dataDir + "data_xml.pdf");

 public static MemoryStream TransformXml(string inputXml, string xsltString, XsltArgumentList argsList=null)
            var transform = new XslCompiledTransform();
            using (var reader = XmlReader.Create(new StringReader(xsltString)))
            var memoryStream = new MemoryStream();

            var results = new StreamWriter(memoryStream);
            using (var reader = XmlReader.Create(new StringReader(inputXml)))
                transform.Transform(reader, argsList, results);

            memoryStream.Position = 0;
            return memoryStream;

What’s new in Aspose.PDF 21.6

With Aspose.PDF for .NET you can hide images using ImagePlacementAbsorber from the document:

public void PDFNET_49961()
   ImagePlacementAbsorber abs = new ImagePlacementAbsorber();
   Document doc = new Document("test.pdf");
   // Hide image on first page

   foreach (ImagePlacement imagePlacement in abs.ImagePlacements)


What’s new in Aspose.PDF 21.5

How to extract font full name from it description/resource at PDF?

You can get a full font with the prefix with BaseFont property for the Font class.

Document pdf = new Document(dataDir + @"testfont.pdf");

Aspose.Pdf.Text.Font[] fonts = pdf.FontUtilities.GetAllFonts();
foreach (Aspose.Pdf.Text.Font font in fonts)
    Console.WriteLine($"font name : {font.FontName} BaseFont name : {font.BaseFont}");

What’s new in Aspose.PDF 21.4

Add API for merging images

Aspose.PDF 21.4 allows you to combine Images. Follow the next code snippet:

private static void MergeAsJpeg()
   List<Stream> inputImagesStreams = new List<Stream>();
   using (FileStream inputFile300dpi = new FileStream(@"c:\300.jpg", FileMode.Open))
       using (FileStream inputFile600dpi = new FileStream(@"c:\49616_600.jpg", FileMode.Open))
           using (Stream inputStream =
                 PdfConverter.MergeImages(inputImagesStreams, ImageFormat.Jpeg, ImageMergeMode.Vertical, 1, 1))
               using (FileStream outputStream = new FileStream(@"c:\out.jpg", FileMode.Create))
                   byte[] buffer = new byte[32768];
                   int read;
                   while ((read = inputStream.Read(buffer, 0, buffer.Length)) > 0)
                       outputStream.Write(buffer, 0, read);

Also you may merge you images as Tiff format:

private static void MergeAsTiff()
   List<Stream> inputImagesStreams = new List<Stream>();
   using (FileStream inputFile300dpi = new FileStream(@"c:\300.tiff", FileMode.Open))
       using (FileStream inputFile600dpi = new FileStream(@"c:\600.tiff", FileMode.Open))
           using (Stream inputStream = PdfConverter.MergeImagesAsTiff(inputImagesStreams))
               using (FileStream outputStream = new FileStream(@"c:\out.tiff", FileMode.Create))
                   byte[] buffer = new byte[32768];
                   int read;
                   while ((read = inputStream.Read(buffer, 0, buffer.Length)) > 0)
                       outputStream.Write(buffer, 0, read);

What’s new in Aspose.PDF 21.3

Public expose of property to detect Azure Information Protection

With the next code snippet, you should be able to get access to the encrypted payload of your PDF files, protected with Azure Information Protection:

 public void Azure_Information_Protection()
     string inputFile = @"c:\pdf.pdf";
     Document document = new Document(inputFile);
     if (document.EmbeddedFiles[1].AFRelationship == AFRelationship.EncryptedPayload)
            if (document.EmbeddedFiles[1].EncryptedPayload != null)
              // document.EmbeddedFiles[1].EncryptedPayload.Type == "EncryptedPayload"
              // document.EmbeddedFiles[1].EncryptedPayload.Subtype == "MicrosoftIRMServices"
              // document.EmbeddedFiles[1].EncryptedPayload.Version == "2"

What’s new in Aspose.PDF 21.1

Add support of retrieving the background color of TextFragment

In this version of Aspose.PDF, the function became available to retrieve the background color. You need to specify searchOptions.SearchForTextRelatedGraphics = true; in the options of TextFragmentAbsorber object.

Please consider the following code:

Document pdfDocument = new Document(dataDir + "TextColor.pdf");
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber();

TextSearchOptions searchOptions = new TextSearchOptions(false);
searchOptions.SearchForTextRelatedGraphics = true;

textFragmentAbsorber.TextSearchOptions = searchOptions;

// Accept the absorber for all the pages

// Get the extracted text fragments
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;

// Loop through the fragments
foreach (TextFragment textFragment in textFragmentCollection)
    Console.WriteLine("Text: '{0}'", textFragment.Text);
    Console.WriteLine("BackgroundColor: '{0}'", textFragment.TextState.BackgroundColor);
    Console.WriteLine("ForegroundColor: '{0}'", textFragment.TextState.ForegroundColor);
    Console.WriteLine("Segment BackgroundColor: '{0}'", textFragment.Segments[1].TextState.BackgroundColor);

After conversion to HTML the font is fully embedded in the output

Also, in Aspose.PDF 21.1, after converting PDF to HTML, became available embedded fonts in an output HTML document. It is possible with the new boolean save option HtmlSaveParameter.SaveFullFont.

Here is the code snippet:

HtmlSaveOptions saveOptions = new HtmlSaveOptions();
saveOptions.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
saveOptions.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml;
saveOptions.LettersPositioningMethod = HtmlSaveOptions.LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss;
saveOptions.FontSavingMode = HtmlSaveOptions.FontSavingModes.AlwaysSaveAsTTF;
saveOptions.SaveTransparentTexts = true;
saveOptions.SaveFullFont = true;