Set Acroform to be readonly in Webviewer

Hello,
Thanks, this solution worked fine for me on my machine with WebViewer version 6.3.1.
But on distant machines where we have Webviewer version 6.3.5 the ‘readonly’ attribute is not present (exact same code).
Did you make a change on this feature between these two version ?
Thanks,
Alicia

Hi Alicia,

I don’t think we changed this feature between these two versions. I just verified that in WebViewer 6.3.6 the above approach still works. Maybe you could try upgrading to 6.3.6 both locally and on remote to see if the issue is fixed?

The following is the code I’m using in the config file:

window.addEventListener(‘viewerLoaded’, function() {
var annotManager = readerControl.docViewer.getAnnotationManager();
annotManager.on(‘annotationChanged’, function(annotations, action, { imported }) {
if (imported) {
annotations.forEach(function(annot) {
if (annot instanceof Annotations.WidgetAnnotation) {
annot.fieldFlags.set(‘ReadOnly’, true);
}
});
}
});
})

Note that the code snippet Matt shared works only for WebViewer 5 and below.

Best Regards,
Zhijie Zhang
Software Developer
PDFTron Systems Inc.

Hi Zhijie,

We eventually found the issue : one thing did change between 6.3.1 and 6.3.5 : to access the id on an input, one has now to do annotation.Oa.kd and not annotation.Oa.jd anymore.
Do you know if that is to change again ?

Thanks,
Alicia

Hi Alicia,

The production build of WebViewer is generated by the Google Closure Compiler, and properties like Oa, kd, jd are obfuscated by it. This means every time WebViewer is built they will be different, and external code(in your application) that depends on obfuscated properties will be very likely broken the next time you update WebViewer.

I’m not very sure what the value of Oa.jd or Oa.kd is but if you would like to access the id of a file you can do widgetAnnot.fieldName

Best Regards,
Zhijie Zhang
Software Developer
PDFTron Systems Inc.

Hi Zhijie,
Thank you, this is much clearer, we will implement a more stable solution knowing this.
Best,
Alicia