Product: WebViewer
Product Version: 10.10.1
Please give a brief summary of your issue: pdf with imported arc annotation xfdf does not render correctly
Please describe your issue and provide steps to reproduce it:
I used latest webViewer demo sample from
- download WebViewer.zip and extract to webViewer folder
- go to webViever\samples\viewing\viewing\viewing.js
- change it as follows:
const WebViewerConstructor = isWebComponent() ? WebViewer.WebComponent : WebViewer;
WebViewerConstructor(
{
path: '../../../lib',
initialDoc: '',
licenseKey: 'xxx',
},
document.getElementById('viewer')
).then(instance => {
samplesSetup(instance);
document.getElementById('select').onchange = e => {
instance.UI.loadDocument(e.target.value);
};
document.getElementById('file-picker').onchange = e => {
const file = e.target.files[0];
if (file) {
instance.UI.loadDocument(file);
}
};
document.getElementById('url-form').onsubmit = e => {
e.preventDefault();
instance.UI.loadDocument(document.getElementById('url').value);
};
const {documentViewer} = instance.Core;
documentViewer.addEventListener('documentLoaded', () => {
registerAnnotationListeners(instance);
});
});
function registerAnnotationListeners(instance) {
const {annotationManager} = instance.Core;
annotationManager.addEventListener("annotationChanged", (annotations, action, { imported }) => {
if (annotations[0] instanceof instance.Core.Annotations.ArcAnnotation) {
setTimeout(() => {
exportAnn(annotationManager, annotations);
}, 1000);
}
});
}
function exportAnn(annotationManager, annotations) {
annotationManager.exportAnnotations({
annotList: annotations,
widgets: true,
fields: true,
links: true,
useDisplayAuthor: true,
generateInlineAppearances: true
}).then( txt => console.log(txt));
}
-
run ‘npm install’
-
run ‘npm start’
-
in browser go to http://localhost:3000/samples/viewing/viewing/
-
open test.pdf
-
in webViewer drop-down select Measure
-
select arcAnnotation
-
add annotation
-
go to JS console
-
copy paste xfdf output into text.xfdf file
-
open test.pdf in adobe reader
-
drag and drop test.xfdf into adobe reader window
-
specify test.pdf as source pdf file
-
observe opened xfdf - arc annotation is ok
-
go to menu → save as → test-xfdf-merged.pdf
-
open test-xfdf-merged.pdf in adobe to make sure that arc annotation is present
-
open test-xfdf-merged.pdf
-
no annotation is visible
-
I’ve attached also test2-merged-using-java-api.pdf It’s same file but merged with same xfdf programmatically, using pdfTron java lib. It also rendered incorrectly but in a different way