Skip to main content
Participant
September 23, 2024
Question

Annotation APIs not enabled.

  • September 23, 2024
  • 1 reply
  • 890 views

Hello community. Hope you are all fine.

I need your help because i'm keeping gettting "Promise { <state>: "rejected", <reason>: "Annotation APIs not enabled." }" .

 

My script aimed to retreive updated data from fillable PDF file. This is my scricpt. 

 

 

<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>

 

    This topic has been closed for replies.

    1 reply

    Raymond Camden
    Community Manager
    Community Manager
    September 23, 2024

    While I don't think it is being run - where do you see getFormFields() documented? I don't believe we expose that functionality. 

    Participant
    September 23, 2024

    Hello Raymond.

    Thanks you for response.

    So can you guide me to the right documentation ?

    In my web application, user access a fillable PDF from your viewer. He fills the field then click on a button. The button action is to retreive all user's entered data and send it to our database.

    Best regards !

    Raymond Camden
    Community Manager
    Community Manager
    September 23, 2024

    We don't support that with Embed. We have APIs that let you set and read form fields, but that's not part of Embed.