Please give a brief summary of your issue:
The orientation of vertical freetext annotations are being changed to horizontal on merging xfdf and pdf files.
Please describe your issue and provide steps to reproduce it:
For comments added vertically, the orientation is correct when viewed in webviewer:
but when we save the file , the orientation of freetext annotation is changed as shown:
We are saving the pdfDocument as shown:
using (var pdfDocument = new PDFDoc(pdfFileStream))
{
var xfdfString = new StreamReader(xfdfFileStream).ReadToEnd();
using (var fdfDoc = new FDFDoc(FDFDoc.CreateFromXFDF(xfdfString)))
{
pdfDocument.FDFUpdate(fdfDoc);
}
pdfDocument.RefreshFieldAppearances();
pdfDocument.RefreshAnnotAppearances();
pdfDocument.Save(pdfFileStream, pdftron.SDF.SDFDoc.SaveOptions.e_linearized);
}
What is causing the orientation change and what should I do to have correct orientations for annotations during save?
Hello, Iām AiRon, an automated tech support bot While you wait for one of our customer support representatives, I can help you with your question.
It seems like the orientation of free text annotations is being altered during the save operation, which could be due to how the annotations are being refreshed or updated in the PDF document. Free text annotations can have orientation issues if their appearance is not correctly set before saving.
Some things you can try:
Ensure that the annotation appearance is correctly set before refreshing by explicitly setting the necessary properties for the annotation.
Use the pdfDocument.RefreshAnnotAppearances() method carefully to ensure it does not override the intended orientation settings.
Check if the XFDF data contains any transformation matrix that might be affecting the orientation and adjust it accordingly.
After updating the FDF, iterate over the annotations to manually set their orientation if necessary.
Thank you for contacting us about this. Can you please provide us with the original PDF and XFDF input that you are merging that showcases this issue?
If you would not like to attach it to this public forum post, please send an email to support@apryse.com or open a ticket via our portal at support.apryse.com. Please reference this forum post in your ticket/email.
Thank you for the XFDF and the PDF files. I was able to reproduce the issue and have forwarded this to the development team for further investigation. I will get back to you once I have more information.
The development team got back to me regarding this issue. It appears that the annotations in the PDF have the rotation value defined in an incorrect key which goes against the PDF standard. Since the annotation information is extracted in to the XFDF, the incorrect rotation key is not included, resulting in the unexpected appearance.
Note that the same behavior is observed in Adobe Reader with this file. When the specific annotation is moved or resized, the appearance is regenerated the same way the Apryse SDK does.
Specifically, the rotation value is set in the key /Rotation. It should instead be /Rotate.
We recommend contacting the author of this document to correct this issue, as any further modifications to the annotations will result in an incorrect output.