We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Character encoding failed after updating the existing PDF file

Hello,

We’re trying to update the text from the existing PDF we’re able to update the text but when we check the accessibility of PDF in Adobe reader it shows the error regarding character encoding failed. Please see image.png (101.9 KB)
But the original PDF doesn’t contains this error. Please see image.png (102.8 KB)
. The code we’re using here to find and replace the text is as below.

// Instantiate Document object
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(fileStream);
string personalisedString = “Forrester Report Prepared For ###fullName### With ###organization###”.Replace("###fullName###", “Jignesh”).Replace("###organization###", “Savaliya”);
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(“Forrester Report Prepared For ###fullName### With ###organization###”);
doc.Pages.Accept(textFragmentAbsorber);
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;

// Loop through the fragments
foreach (TextFragment textFragment in textFragmentCollection)
{
textFragment.Text = personalisedString;
}
using (MemoryStream stream = new MemoryStream())
{
doc.Save(stream, SaveFormat.Pdf);
var file = ConvertStreamToBytes(stream);
return File(file, “application/pdf”, pdfName);
}
Also attaching both the file.

  1. Existing file: BASE PDF AMY_DTESTReport_with_VideoBuilding_Brands_With_Enduring_Resonance.pdf (701.5 KB)
  2. Updated file: Personalised AMY DTESTReport with VideoBuilding Brands With Enduring Resonance.pdf (708.5 KB)

Regards,
Synoptek

@siriussynoptek

Can you please check the attached PDF document for accessibility features at your end in Adobe Reader? It was generated using 21.6 version of the API and your sample code snippet:

output.pdf (703.7 KB)

still facing the same issue. image.png (105.5 KB)

Regards,
Synoptek

@siriussynoptek

We have logged an issue as PDFNET-50161 in our issue tracking system for the sake of investigation. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hello,

Any updates on this?

Regards,
Synoptek

@siriussynoptek

Regretfully, the ticket has not been yet resolved due to other issues in the queue logged prior to it. However, we will surely let you know once we have some definite updates regarding ticket resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.