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

Free Support Forum - aspose.com

Apostrophe and quotes rendering in Aspose.Pdf.Document.Info

Hi,

We’ve faced a problem with having apostrophe, single and double quote inside Aspose.Pdf.Document.Info property. The text with the characters mentioned is saved to Aspose.Pdf.Document.Info so that it appears in “Document Properties…” -> “Custom” window of Adobe Reader and serve as a pdf file metadata. The text originates from a docx, and originally looks like this:

We have troubles with special characters like apostrophe: ’ and single quote: ', and double quote: "

and when being read from Aspose.Pdf.Document.Info appears to be as

We have troubles with special characters like apostrophe: \u0090 and single quote: \u008f, and double quote: \u008d

if seen under debug in VS2019, and the special characters effectively render to empty strings in output.

But if the same data is read from Aspose.Pdf.Document.Metadata, then all the characters appear as expected. So, for now our workaround is to read from Metadata rather than from Info, but we still need to write to Info, because using Metadata only does not result in the data being shown in “Document Properties…” to the end user, which is our business rule.

Please, see the file attached.

1.pdf (21.4 KB)

@WorkZone,

Thanks for contacting support.

Can you please share sample project along with desired result so that we may further investigate to help you out.

Hi, please see code bellow:

{
	var pdf = new Aspose.Pdf.Document("1.pdf");
	var textWithIssues = pdf.Info["CustomData"];
	var textWithoutIssues = pdf.Metadata["pdfx:CustomData"].ToStringValue();

	Console.WriteLine(textWithIssues);
	Console.WriteLine(textWithoutIssues);
}

@WorkZone,

I have worked with sample code and source file shared by you and facing exception. Can you please share if you are facing such exception. Also please share which Aspose.PDF version you are using on your end.

Please try again, “pdfx” prefix was added to metadata key.

@WorkZone,

I have observed issue you mentioned and have logged it as PDFNET-47819 in our issue tracking system. We will further look into details of the issue and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.