Configure maximum file size for annotations?

Product: PDFTron WebViewer

Product Version: 8.0.1

Please give a brief summary of your issue:
Is there a way to limit the size of annotations users are able to add to a document? For example, images or attachment annotations, is there a way to configure a max size of 3MB, and if one was to try to add a larger file we could display an error of some sort?

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,

You can use the ‘ACCEPTED_FILE_SIZE’ in FileAttachmentCreateTool to configure this. And you can listen to the ‘fileRejected’ event for error case.

For example:

const fileTool = instance.Core.documentViewer.getTool(instance.Core.Tools.ToolNames.FILEATTACHMENT);
fileTool.ACCEPTED_FILE_SIZE = 10;
fileTool.addEventListener(instance.Core.Tools.FileAttachmentCreateTool.Events.FILE_REJECTED, (e) => { console.log(e); })

Thanks.

Wanbo

Good day,

As of v10.3, I cannot find this instance.Core.Tools.FileAttachmentCreateTool.Events.FILE_REJECTED property anymore. Was this affected by the global namespace changing which I think occured in v9 or v10?

Thank you!

Hi,

I just tested and it should be there in the latest v10.5, you can try it out here - http://localhost:3000/samples/viewing/viewing

Thanks

Wanbo