Skip to main content
Known Participant
February 26, 2023
Answered

APIs not allowed on this PDF

  • February 26, 2023
  • 1 reply
  • 1942 views

I'm trying to render the PDF and extract all the annotations (if available) of the following PDF file.

https://drive.google.com/file/d/1PiEcI0bcviYecwbzwVCs2rY_0tiqfj2F/view?usp=share_link

with the following code snippet:

 

try {
await viewSDKClient.ready();
const filePromise = Promise.resolve(file.arrayBuffer);

// Pass the filePromise and name of the file to the previewFile API
const adobeViewerPromise = viewSDKClient.previewFileUsingFilePromise(
`pdf-div-${file.name}`, filePromise, file.name, UploadSizedContainerConfig);

const adobeViewer = await adobeViewerPromise;
const annotationManager = await adobeViewer.getAnnotationManager();

const res = await annotationManager.removeAnnotationsFromPDF();
return Promise.resolve({
pdfBuffer: res["pdfBuffer"],
annotations: res["annotations"]
});
} catch (err) {
console.error(err);
return Promise.resolve({});
} finally {
...
}

 

And I keep getting this error: 

{code: 'FAIL', message: 'APIs not allowed on this PDF.'}

 

Please help. thanks

This topic has been closed for replies.
Correct answer Raymond Camden

I see. thank you for the reply and clarification. Does it mean that unless I find a way to remove all the security restrictions either with password or by some sort of third-party tools, I will not be able to do anything with the PDF right? thanks. 


Yes, as expected. If our Embed library blissfully ignored security that would be a bad thng. 😉

1 reply

tangyunAuthor
Known Participant
February 26, 2023
Cost-benefit_analysis_and_large-scale_infrastructure_projects.pdf
Raymond Camden
Community Manager
Community Manager
February 27, 2023

Looking at permissions, it says that changing the document is not allowed. This would stop you from removing annotations I'd imagine as that's a change. 

tangyunAuthor
Known Participant
March 2, 2023

I see. thank you for the reply and clarification. Does it mean that unless I find a way to remove all the security restrictions either with password or by some sort of third-party tools, I will not be able to do anything with the PDF right? thanks.