Hi Logan,
I’ve done it exactly like you explained it but it does not work. If you open the saved PDF the annotations can be moved around, edited and deleted.
Attached is the PDF merged through the API
Here’s the code:
const list = annotManager.getAnnotationsList();
list.forEach(item => {
item.ReadOnly = true
})
const xfdf = await annotManager.exportAnnotations({ links: false, widgets: false });
const fileData = await docViewer.getDocument().getFileData({});
const blob = new Blob([fileData], {type: 'application/pdf'});
const data = new FormData();
data.append('xfdf', xfdf);
data.append('file', blob);
data.append('license', xxxx);
// Process the file
const response = await fetch('https://api.pdfjs.express/xfdf/merge', {
method: 'post',
body: data
}).then(resp => resp.json());
const { url, key, id } = response;
// Download the file
const mergedFileBlob = await fetch(url, {
headers: {
Authorization: key
}
}).then(resp => resp.blob())
Regards,
Erhard