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

Free Support Forum - aspose.com

Add annotation/comments to an existing pdf file

Hi, I am using Aspose.pdf.kit to add Annotation/Comments to an existing pdf. RichText is used in the comment field, but the comment does not show up. The following is the code snnipet. I would appreciate if anyone can help me out.
----------------------------------------------------------------------------------------------------
Aspose.Pdf.Kit.License lic = new License();
lic.SetLicense(“Aspose.Pdf.Kit.lic”);

byte[] xfdf = UtilBase.StringToByteArray(pstrMergedMarkup);
string tempPDFSubPath = Guid.NewGuid().ToString();
string tempFilePathDir = string.Format("{0}\{1}", pstrTempPDFPath, tempPDFSubPath);
MemoryStream streamXfdf = new MemoryStream(xfdf);
MemoryStream streamMergedPDF = new MemoryStream();

try
{
PdfAnnotationEditor editor = new PdfAnnotationEditor();

editor.BindPdf(string.Format("{0}\{1}", pstrPDFArchivePath, pstrArchive));
Enum[] annType = { AnnotationType.HightLight, AnnotationType.Line };
editor.ImportAnnotationFromXfdf(streamXfdf);

Directory.CreateDirectory(tempFilePathDir);

editor.Save(string.Format("{0}\{1}", tempFilePathDir, pstrArchive));

string MEGDomain = ConfigurationManager.AppSettings[“MEGDomain”];
string pdfPath = string.Format("{0}/tempPdf/{1}/{2}", ConfigurationManager.AppSettings[“MEGDomain”], tempPDFSubPath, pstrArchive);

return pdfPath;
}
finally
{
streamXfdf.Flush();
streamXfdf.Close();
streamMergedPDF.Flush();
streamMergedPDF.Close();
}
----------------------------------------------------------------------------------------------------

Hi Wang,

In order to properly understand and investigate this issue, we need to reproduce the problem at our end. And for that matter, we’ll need the input XFDF and PDF files or a small sample application which can help us reproduce this issue at our end.

We’re sorry for the inconvenience.
Regards,

Hi Shahzad, thanks for your reply. Here is the content of the xfdf file. The bold text is the content of the comment, but it does not display.

<?xml version="1.0" encoding="UTF-8"?>






Black Fox (105071) - Strip ratio









Hi Wang,

Please attach the input PDF file as well.

We’re sorry for the inconvenience and appreciate your cooperation.
Regards,

the pdf file is attached.

Hi Wang,

I have tested this issue at my end using the latest version and noticed that although the mentioned text is being shown, but not completely - only Black Fox (105071) is shown. Can you please try the latest version at your end and see if this is the result over there as well? Please share the results with us, so we could move forward accordingly.

We’re sorry for the inconvenience.
Regards,

Thanks, Shahzad. At our end, it shows nothing, only when expand it by clicking the plus sign, you can see the Black Fox (105071). I was wondering if this is the result you have seen, and why incomplete text is shown. Is there any workaround for this, since this is a very key requirement for our application.

Hi Wang,

I have noticed that the text I mentioned earlier is the ‘Subject’, not the actual comment text. I need to log this issue for further investigation by our team, because there is no workaround for this issue at the moment. However, before forwarding this issue to our development team, I just want to make sure that we are on the same page. Can you please share your output file as well, so I could have a look at it?

We’re sorry for the inconvenience.
Regards,