Polygon annotation not displaying when merging xfdf

Which product are you using?
PDF.js Express Viewer

Detailed description of issue
Running into issues displaying “Polygon” annotation on PDFs (Adobe, Mac Preview, Chrome Preview). FYI - this was working before but something changed. Can you take a look at the xfdf snippet and let me know if you see any issues with it?

Expected behaviour

Does your issue happen with every document, or just one?
Every document with a polygon (e.g. cloud annotation).

Link to document
{Provide a link to the document in question if possible}

Code snippet

<?xml version="1.0" encoding="UTF-8"?> test 230,603;408,310;97,274;230,603

1

0.2196 0.6275 0 rg /Arial 8.5 Tf font: Arial 8.5pt; text-align:center; color:#FFFFFF

Hi there,

Thank you for contacting pdf.js express forums,

Could you please provide your pdf.js express version, the PDF file and the full XFDF of the annotation?

Are you able to reproduce the issue on our demo page? PDF.js Viewer Demo | PDF.js Express

Best regards,
Kevin Kim

Hi Kevin,

This might be an issue outside of pdf.js express. However, will you be able to provide a sample “polygon” code snippet that works for you on pdfs? The sample I attached was previously working but not anymore. I was hoping you can provide some insight . I also attached the sample pdf that has a cloud annotation, but is not visible.

COR 50 - box file [100 Red Street] [Business A] (12).pdf (147.0 KB)

<?xml version="1.0" encoding="UTF-8"?>
<xfdf xml:space="preserve" xmlns="http://ns.adobe.com/xfdf/">
<f href="sample_annotated_2.pdf"/>
<annots>
<polygon
xmlns="http://ns.adobe.com/xfdf/" page="0" rect="96,273,409,604" color="#E44234" flags="print" name="96c0cf9f-1edb-2924-44de-669fd3a0a9fe" title="Ryan Test" subject="Polygon" date="D:20230821141357-07'00'" creationdate="D:20230821141352-07'00'" style="cloudy" intensity="2">
<contents>test</contents>
<vertices>230,603;408,310;97,274;230,603</vertices>
</polygon>
<freetext color="#38A000" flags="print" page="0" rect="391,278,404,291" justification="left" subject="Text Box">
<contents-richtext>
<body style="font-size:8.5pt;text-align:center;color:#FFFFFF;font-weight:bold;font-style:normal;font-family:Arial;font-stretch:normal">
<p>1</p>
</body>
</contents-richtext>
<defaultappearance>0.2196 0.6275 0 rg /Arial 8.5 Tf</defaultappearance>
<defaultstyle>font: Arial 8.5pt; text-align:center; color:#FFFFFF </defaultstyle>
</freetext>
</annots>
</xfdf>

Thanks,
Ryan

Hi there,

I opened the attached document on the sample and looked at the annotationsList and it turns out to be empty, is this expected?

Importing the provided XFDF works as expected:

Please note that if you are just using pdf.js express viewer, it does not support annotations: PDF.js License Pricing for Commercial Viewer | PDF.js Express

Best regards,
Kevin Kim

Hi Kevin,

Thanks. Do you have a sample “polygon” code snippet of your pdf viewed in either Adobe or Mac Preview? The problem with the annotation is it disappears when viewed in another pdf viewer.

Thanks,
Ryan

Hi there,

If you would like to merge the annotation with the PDF, you would need to use the merge API endpoint:

Then the result document will have the annotations included (see attached pdf sample)
document.pdf (373.9 KB)

Best regards,
Kevin Kim