Added signatures to a document can be manipulated when loading the document into viewer again

WebViewer Version: 8.7.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? No
Is your issue related to a front-end framework? No
Is your issue related to annotations? Yes

Please give a brief summary of your issue:
(Think of this as an email subject)

after creating and adding a signature to a document, if you load that signed document into the web viewer to add another signature or do something else the previously added signature is not static but can be moved and deleted, I need to prevent this and make that signature static so no one can change it after document is saved

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hi,

Thank you for reporting this issue. We will investigate and let you know when we have further information.

Wanbo

Hi,

You can try the following code to set the created signature ReadOnly.

instance.docViewer.getTool(instance.Core.Tools.ToolNames.SIGNATURE).addEventListener('signatureReady', (signature) => {
    signature.ReadOnly = true;
  });

Thanks.

Wanbo

is exactly what i needed but not in this way, however i was able to adapt it to my needs and now is working just fine, so thank you for this code but i have another issue, right now i’m developing a function that allows customers to invite other people to sign a document, and the way i thought about doing that is to allow other people to see the document that needs to be signed and when they click con “continue” button system that the information of that signature and save it to the database then it checks if everyone has signed, if yes a final version of the document with all signatures should be send to all invited signer, if not wait until everyone has signed, so my problem is that after saving the signature and other data like page number, width, height, pos_x and pos_y i don’t know how to use that info to put the signature in the same location where invited signer put it, and i can’t save the document with the added signature because the document will be send to multiple people at the same time, so if they all sign at the same time i won’t be able to put the signatures in the document, so can you provide some instructions as to how to put a signature into a document using position related info from the database? by the way i’m using laravel 8 and vue 2

Hi,

The signature is just an annotation, so you can set the page number, width/height, x/y position for it.

Wanbo

well what i needed was this function

that.annotationManager.exportAnnotations().then( xfdfData => {
// code to use annotation data
});

that xfdf data is exactly what i need in order to export all the signatures present in the document with location info, and then i can use importAnnotations to apply the signatures where they were placed by the user, and i can call the same function with different xfdf strings and apply as much signatures as needed

Please check the code sample below to see how to update the annotations in the xfdf data:

const parser = new DOMParser();
const data = parser.parseFromString(xfdf, 'text/xml');
const annotations = data.querySelector('annots');

for (let i = 0; i < annotations.children.length; i++) {
  const annotation = annotations.children[i];
  const oldPage = annotation.getAttribute('page');
  annotation.setAttribute('page', oldPage + 1);
}

const serializer = new XMLSerializer();
const updatedXFDF = serializer.serializeToString(data);

instance.Core.annotationManager.importAnnotations(updatedXFDF);

Thanks.

Wanbo

hi, thank you for this code, I ended up resolving it in a similar but different way, however once again I have a new issue, i’m getting some cors errors when loading a document, here is how it works, i have a site in localhost:8765 and i have another site in 127.0.0.1:8000, now the site in 8765 is the main site that makes a call to 8000 site and loads the content in an iframe, so for other functionalities i have it works fine because the file that is being used is stored in 8000 server however in this case i have a file saved in 8765 server and i try to load the pdftron in this way, 8765 calls 8000 and then 8765 renders 8000 in an iframe but since the file is not in 8000 server but 8765 the file path throws a cors error 'missing header CORS ‘Access-Control-Allow-Origin’, so i was reading about the topic and i even used Access-Control-Allow-Origin: * in both sites and still have the issue, however if i use the test file provided in the docs ‘https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf’ i don’t get any errors, so i would like to know what i’m doing wrong in this case, thank you for your time and have a good day

Hi,

Please take a look at this guide for the CORS support. For your case, you may need to configure your 8765 server to enable CORS.

Wanbo