Hello stackoverflow community.
Hope you are all fine.
I need your help because i’m keeping gettting “Promise { : “rejected”, : “Annotation APIs not enabled.” }” with https://acrobatservices.adobe.com/view-sdk/viewer.js
My script aimed to retrieve user entered data from fillable PDF file. This is my script.
<script src="https://acrobatservices.adobe.com/view-sdk/viewer.js"></script>
<script type="text/javascript">
document.addEventListener("adobe_dc_view_sdk.ready", function() {
let res=null;
var adobeDCView = new AdobeDC.View({clientId: "d146718832cf4e97afcd8b6e27fb967b", divId: "adobe-dc-view"});
adobeDCView.previewFile(
{
content: {location: {url: "pdf.pdf"}},
metaData: {fileName: "Bulletin d'adhésion ",id: "aeef47fe-c473-4a6c-9e78-ec23d7790837"}
},
{
embedMode: "FULL_WINDOW",
defaultViewMode: "FIT_PAGE",
enableLinearization: true,
showDownloadPDF: true,
showPrintPDF: true,
showLeftHandPanel: false,
showAnnotationTools: false,
enableFormFilling: true,
enableAnnotationAPIs: true,
includePDFAnnotations: true,
showPageControls: false,
showZoomControl: true,
showRotateControl: false,
disableTextSelection: true,
annotationManagerEditMode: "READ",
showBookmarks:false,
showThumbnails:false,
}
).then((r)=>{
r.getAnnotationManager().then(function(a) {
console.log(a);
a.getFormFields().then(function(f) {
console.log('Form Fields:', f);
const d = {};
f.forEach(r => {d[r.name] = r.value;});
console.log(d);
});
});
}).catch((e)=>{
// Here i got error Promise { <state>: "rejected", <reason>: "Annotation APIs not enabled." }
console.log('res',e);
});
document.getElementById('save-button').addEventListener('click', function() {
//Here i got adobeDCView.getAnnotationManager() is not a function
adobeDCView.getAnnotationManager().then(function(a) {
a.getFormFields().then(function(f) {
const d = {};
f.forEach(r => {d[r.name] = r.value;});
}).catch((e)=>{
console.log('e',e);
});
});
});
</script>