Product: Webviewer
Product Version: 11.6.1
documentViewer.getDocument().getFileData() fails when I attempt to get the raw file data of an office document, even when downloadType: 'pdf'
was specified.
I have a custom print handler defined so:
const handlePrint = useCallback(async () => {
if (!webviewerInstance.current) return;
const { documentViewer, PDFNet, annotationManager } = webviewerInstance.current.Core;
await PDFNet.initialize();
const xfdfString = await annotationManager.exportAnnotations();
const document = documentViewer.getDocument();
const fileData = await documentViewer.getDocument().getFileData({
xfdfString,
flatten: true,
downloadType: 'pdf',
});
const blob = new Blob([fileData], { type: 'application/pdf' });
const blobUrl = URL.createObjectURL(blob);
const printWindow = window.open(blobUrl, '_blank');
if (printWindow) {
printWindow.onload = () => {
printWindow.focus();
printWindow.print();
};
}
}, []);
I get:
webviewer-core.min.js:1391 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'password')
at ma.<anonymous> (webviewer-core.min.js:1391:264)
at a (webviewer-core.min.js:66:50)
at Object.next (webviewer-core.min.js:64:323)
at w (webviewer-core.min.js:64:92)
The document is not password-protected.
I would greatly appreciate any inputs on this.