Add text stamp in PDF document using Aspose.PDF in C# - document becomes corrupted

Hi,

I’ve got a PDF file. In C# .net, I add a text stamp on it according to Add Text and Image Stamp|Aspose.PDF for .NET.

The file is successfully converted but when I try to open it with Adobe Acrobat Reader DC (v 2019.021.20061), I get the following error:

image.png (5.0 KB)

In the stamp, the text is displayed with bullets:

image.png (43.5 KB)

Could you please tell me what might be causing this issue?

I used the following code:
using Aspose.Pdf.Facades;
using Aspose.Pdf.Text;
using System;
using System.IO;
using System.Text;

public static void ToPdf(string sourcePath, string targetPath)
{
  var fileStamp = new PdfFileStamp();
  fileStamp.BindPdf(sourcePath);

  // Create stamp.
  var stamp = new Aspose.Pdf.Facades.Stamp();
  stamp.BindLogo(new FormattedText("Hello world!", System.Drawing.Color.Blue, System.Drawing.Color.Gray, "Arial", EncodingType.Winansi, true, 28));
  stamp.SetOrigin(200, 200);
  stamp.Rotation = 90.0F;
  stamp.IsBackground = false;

  // Add stamp to PDF file.
  fileStamp.AddStamp(stamp);
  fileStamp.Save(targetPath);
}

AdobeError1.png (5.4 KB)
image.png (5.0 KB)
Input.pdf (160.1 KB)
Output.pdf (186.0 KB)

@directum,

Thanks for contacting support.

I have observed your issue and like to inform that I have created investigation ticket with ID PDFNET-47559 in our issue tracking system to investigate and resolve this issue as soon possible.

Hi,
Any news about this issue?
How can i check status of PDFNET-47559?
Thanks.

@directum

Regretfully, earlier logged issue has not been yet resolved. The issue is logged in our internal issue management system and you cannot access it. However, we will keep you updated with its status in this forum thread. You will be notified once investigation of the ticket is done and a fix has been added. We highly appreciate your patience and cooperation in this matter.

We are sorry for the inconvenience.

Hi,
I have some more information about PDFNET-47559.
I’m currently using Aspose libraries for .net version 21.5.0.
The problem occurs regularly if a source PDF document has version 1.2 (%PDF-1.2 mark in the document head).
After conversion, the document has the same version 1.2. Moreover, the converted document has embedded fonts. I suppose that embedded fonts are required for the added stamp to be displayed correctly.
I guess that version 1.2 does not support the format of fonts that are embedded with the stamp in the converted document. If I manually change the version of the converted document to 1.3 (in the head mark), it successfully opens in Adobe Acrobat Reader DC.
How can I add a stamp in the PDF document version 1.2 without changing its version? It’s important to my customers.
Can you suggest any solution or work-around in this case?
Thanks.

@directum

Thanks for sharing the details about what you have observed. We have logged the provided information along with the ticket and will perform the investigation from this perspective as well. We will surely inform you as soon as we can offer some workaround to bypass this issue. Please spare us some time.

We apologize for the inconvenience.