exportAnnotations not respecting param annotList

WebViewer Version: 8.12.0

Do you have an issue with a specific file(s)? No
Can you reproduce using one of our samples or online demos? Yes
Are you using the WebViewer server? No
Does the issue only happen on certain browsers? Not sure
Is your issue related to a front-end framework?
Is your issue related to annotations? Yes

Please give a brief summary of your issue:
annotationManager.exportAnnotations() always exports ALL annotations

Please describe your issue and provide steps to reproduce it:
No matter how I filter the annotations list from annotationManager.getAnnotationsList(), when I provide that to exportAnnotations({ annotList: […] }, the full XFDF export is returned. I have tried with multiple different documents in different parts in our app. It always returns the full annotation list.

Please provide a link to a minimal sample where the issue is reproducible:

const { annotationManager } = instance.Core;
    const fieldsToExport = annotationManager
      .getAnnotationsList()
      .filter((annot) => !annot.ReadOnly);
    const annots = await annotationManager.exportAnnotations({
      annotList: fieldsToExport,
      widgets: true,
      fields: false,
      links: false,
    });
    console.log(fieldsToExport);
    // [ea]
    console.log(annots);
    // xfdf with multiple <ffield> and <widget>s
1 Like

Update, I have tried upgrading to v10 and still run into this issue.

Here’s an example XFDF of an entire document:

<?xml version="1.0" encoding="UTF-8" ?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
    <pdf-info xmlns="http://www.pdftron.com/pdfinfo" version="2" import-version="4">
        <ffield type="Tx" name="DecedentName">
            <font name="Helvetica" size="10" />
        </ffield>
        <ffield type="Tx" name="FromWhere">
            <font name="Helvetica" size="10" />
        </ffield>
        <ffield type="Tx" name="Relationship1">
            <font name="Helvetica" size="10" />
        </ffield>
        <ffield type="Tx" name="Relationship2">
            <font name="Helvetica" size="10" />
        </ffield>
        <ffield type="Tx" name="Relationship3">
            <font name="Helvetica" size="10" />
        </ffield>
        <ffield type="Tx" name="Date">
            <font name="Helvetica" size="10" />
        </ffield>
        <ffield type="Sig" name="Signature1">
            <font name="Helvetica" size="10" />
        </ffield>
        <ffield type="Sig" name="Signature2">
            <font name="Helvetica" size="10" />
        </ffield>
        <ffield type="Sig" name="Signature3">
            <font name="Helvetica" size="10" />
        </ffield>
        <ffield type="Sig" name="Witness">
            <font name="Helvetica" size="10" />
        </ffield>
        <ffield type="Sig" name="EsignCertificate">
            <font name="Helvetica" />
        </ffield>
        <widget field="DecedentName" name="7e185488-3a43-ad25-a629-e1d78e326533" modified-date="D:20230719221010-07'00'" page="1">
            <rect x1="95.28" x2="285.28" y1="603.16" y2="618.16" />
            <border width="0.1">
                <color r="255" g="255" b="255" />
            </border>
            <trn-custom-data bytes="{&quot;trn-form-field-indicator-text&quot;:&quot;&quot;,&quot;trn-form-field-show-indicator&quot;:&quot;&quot;}" />
        </widget>
        <widget field="FromWhere" name="9ba70af0-1eb0-c38e-920f-22fe75074954" modified-date="D:20230719221010-07'00'" page="1">
            <rect x1="335.99" x2="525.99" y1="604.83" y2="619.83" />
            <border width="0.1">
                <color r="255" g="255" b="255" />
            </border>
            <trn-custom-data bytes="{&quot;trn-form-field-show-indicator&quot;:&quot;&quot;,&quot;trn-form-field-indicator-text&quot;:&quot;&quot;}" />
        </widget>
        <widget field="Relationship1" name="19acf0a3-9eb6-3877-a74c-c515251471d4" modified-date="D:20230719221010-07'00'" page="1">
            <rect x1="341.84" x2="556.84" y1="301.05" y2="331.05" />
            <border width="0.1">
                <color r="255" g="255" b="255" />
            </border>
            <trn-custom-data bytes="{&quot;trn-form-field-indicator-text&quot;:&quot;&quot;,&quot;trn-form-field-show-indicator&quot;:&quot;&quot;}" />
        </widget>
        <widget field="Relationship2" name="bc904f83-157f-cb20-1106-25ac915a996e" modified-date="D:20230719221010-07'00'" page="1">
            <rect x1="342.66" x2="557.66" y1="250.91" y2="280.91" />
            <border width="0.1">
                <color r="255" g="255" b="255" />
            </border>
            <trn-custom-data bytes="{&quot;trn-form-field-show-indicator&quot;:&quot;&quot;,&quot;trn-form-field-indicator-text&quot;:&quot;&quot;}" />
        </widget>
        <widget field="Relationship3" name="162f08f7-0e88-d74a-b9a8-fc9812163a20" modified-date="D:20230719221010-07'00'" page="1">
            <rect x1="341.81" x2="556.81" y1="201.61" y2="231.61" />
            <border width="0.1">
                <color r="255" g="255" b="255" />
            </border>
            <trn-custom-data bytes="{&quot;trn-form-field-show-indicator&quot;:&quot;&quot;,&quot;trn-form-field-indicator-text&quot;:&quot;&quot;}" />
        </widget>
        <widget field="Date" name="4b3f983a-cfca-2d26-b1cb-ec1fd4444104" modified-date="D:20230719221010-07'00'" page="1">
            <rect x1="343.51" x2="558.51" y1="150.61" y2="180.61" />
            <border width="0.1">
                <color r="255" g="255" b="255" />
            </border>
            <trn-custom-data bytes="{&quot;trn-form-field-indicator-text&quot;:&quot;&quot;,&quot;trn-form-field-show-indicator&quot;:&quot;&quot;}" />
        </widget>
        <widget field="Signature1" name="64808176-c1ac-8e0b-7a30-536c08aa7bd5" modified-date="D:20230510150216-04'00'" page="1">
            <rect x1="76.06" x2="280.83" y1="301.8" y2="333.56" />
            <border width="0.1" />
            <trn-custom-data bytes="{&quot;trn-signature-type&quot;:&quot;fullSignature&quot;,&quot;trn-form-field-show-indicator&quot;:&quot;&quot;,&quot;trn-form-field-indicator-text&quot;:&quot;&quot;}" />
        </widget>
        <widget field="Signature2" name="c2c698af-31b6-3a77-5b9e-7d7010375128" modified-date="D:20230719221010-07'00'" page="1">
            <rect x1="76.9" x2="280.83" y1="251.66" y2="282.58" />
            <border width="0.1" />
            <trn-custom-data bytes="{&quot;trn-signature-type&quot;:&quot;fullSignature&quot;,&quot;trn-form-field-show-indicator&quot;:&quot;&quot;,&quot;trn-form-field-indicator-text&quot;:&quot;&quot;}" />
        </widget>
        <widget field="Signature3" name="33fc1d35-d56e-1aac-3f80-3c13d569a535" modified-date="D:20230719221010-07'00'" page="1">
            <rect x1="77.73" x2="279.99" y1="204.01" y2="234.1" />
            <border width="0.1" />
            <trn-custom-data bytes="{&quot;trn-signature-type&quot;:&quot;fullSignature&quot;,&quot;trn-form-field-show-indicator&quot;:&quot;&quot;,&quot;trn-form-field-indicator-text&quot;:&quot;&quot;}" />
        </widget>
        <widget field="Witness" name="fb11917d-9984-d06c-d68e-6c65c3b4fd2b" modified-date="D:20230719221010-07'00'" page="1">
            <rect x1="76.9" x2="280" y1="154.71" y2="183.12" />
            <border width="0.1" />
            <trn-custom-data bytes="{&quot;trn-signature-type&quot;:&quot;fullSignature&quot;,&quot;trn-form-field-show-indicator&quot;:&quot;&quot;,&quot;trn-form-field-indicator-text&quot;:&quot;&quot;}" />
        </widget>
        <widget field="EsignCertificate" name="b43cec2e25161126-499c8775382155fd" flags="Locked" modified-date="D:20230719221010-07'00'" page="1">
            <rect x1="0" x2="0" y1="0" y2="0" />
        </widget>
    </pdf-info>
    <annots />
</xfdf>
1 Like

Hello zack,

Fields are somewhat different than annotations in the PDF spec. You cant filter out them during export, but what you can filter are Widgets. We have more information here: How do we export XFDF of particular fields similar to annotations? - #2 by system

Best regards,
Tyler

1 Like

Hi Tyler,

I am trying to export the widgets, not the fields. You can see the widgets in the example XFDF. I am only trying to export specific widgets from that list, and yet, providing that array to exportAnnotations is not working.

1 Like

Hello zack,

Apologies for the misunderstanding, I was able to reproduce this issue. The widgets: true parameter tells the return value to include all widgets.

I have raised this as a bug report to our development team. Thank you.

Best regards,
Tyler

1 Like