We are evaluating PDF.js Express and have seen some strange handling of hidden form fields - that is, they are initially visible, and we cannot discern from the widget it is in fact hidden, but we are not sure if it is because we don’t understand the API.
PDF.js Express Version
8.1.0
Detailed description of issue
For reference, we are using the PDFTron doc_to_sign.pdf used in the PDFTron viewer demo. This has a few hidden radio buttons.
When viewing in PDFTron demo, or say the latest version of Firefox/Chrome, or using PDF.js directly, these hidden fields are not visible.
The PDF.js Express demo itself also shows these fields.
We have inspected the annotations returned from the AnnotationManager, and the hidden/Hidden field is always false, so it appears this flag is not loaded correctly, or we have missed something basic such as not looking in the correct place.
Expected behaviour
Does your issue happen with every document, or just one?
We have tried creating a simple document with a hidden radio button in Foxit Editor, and the hidden field is still visible. The assumption is that hidden fields in all documents are visible.
Link to document
doc_to_sign-original.pdf (94.3 KB)
Code snippet
(<any>window).WebViewer({
path: 'Scripts/pdfjs-express',
initialDoc: 'PDFs/doc_to_sign-original.pdf'
}, document.getElementById('pdf-viewer'))
.then(function (instance) {
var docViewer = instance.docViewer;
var annotManager = instance.annotManager;
docViewer.addEventListener('annotationsLoaded', function () {
var annots = annotManager.getAnnotationsList();
for (var ix = 0; ix < annots.length; ix++) {
if (annots[ix].hidden || !annots[ix].isVisible()) {
console.log(`Field ${annots[ix].fieldName} is hidden`);
}
}
});
});