Core.PDFNet.DigitalSignatureField.setFieldPermissions 2nd parameter throws a typeerror

WebViewer Version:

8.9

Do you have an issue with a specific file(s)?

No

Can you reproduce using one of our samples or online demos?

Yes,
Digitally Sign PDF Files in JavaScript | PDFTron SDK

Are you using the WebViewer server?

No

Does the issue only happen on certain browsers?

No

Is your issue related to a front-end framework?

No

Is your issue related to annotations?

No

Please give a brief summary of your issue:
(Think of this as an email subject)
Whan 2nd parameter of setFieldPermissions is added a type error is thrown.

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)

Please code snippet and result below

            await PDFNet.runWithCleanup(async () => {
                // lock the document before a write operation
                // runWithCleanup will auto unlock when complete
                doc.initSecurityHandler();
                doc.lock();

                const hasSigs = await doc.hasSignatures();
                console.log('- has signature?', hasSigs);

                const page1 = await doc.getPage(1);

                logger.log('-----------------approval sig-----------------');
                const approvalSignatureField = await doc.createDigitalSignatureField(
                    'PDFTronApprovalSig' + sigString
                );
                const widgetAnnotApproval =
                    await PDFNet.SignatureWidget.createWithDigitalSignatureField(
                        doc,
                        new PDFNet.Rect(0, 100, 200, 150),
                        approvalSignatureField
                    );

                await approvalSignatureField.setFieldPermissions(
                    PDFNet.DigitalSignatureField.FieldPermissions.e_include,
                    []
                );

                if (!hasSigs) {
                    await approvalSignatureField.setDocumentPermissions(
                        PDFNet.DigitalSignatureField.DocumentPermissions
                            .e_annotating_formfilling_signing_allowed
                    );
                }

                await page1.annotPushBack(widgetAnnotApproval);
            }, '1');

image

Hello,

Thank you for contacting us regarding WebViewer and reporting this issue. I took a look at the setFieldPermissions code and was able to reproduce the issue. We’ve added the issue to our backlog to be worked on in the future. We don’t have a timeline for when it will be fixed but if it does get fixed we’ll let you know when it’s available in an experimental build to test out and the estimated official release date. If you have a desired timeline for having this issue fixed please let us know and we’ll do our best to work with you on how this can fit into the release schedule.

Best Regards,

Andrew Yip
Software Developer
PDFTron Systems, Inc.
www.pdftron.com

Hello,

The following build should fix the issue
Build with fix

Please let us know if that build works for you. The fix should be in our next release of WebViewer

Best Regards,

Andrew Yip
Software Developer
PDFTron Systems, Inc.
www.pdftron.com