Skip to main content
Participant
June 28, 2020
Question

Registercallback in Adobe DC View (SAVE_API)

  • June 28, 2020
  • 1 reply
  • 1120 views

Hi, 

I've got an error message when I put a callback with SAVE_API type.

 

Error message:

ViewSDKInterface.js:1 Uncaught TypeError: Cannot read property 'then' of undefined
at CallbackService._handleCallbackMessage (ViewSDKInterface.js:1)
at ViewSDKInterface.js:1
at Array.forEach (<anonymous>)
at MessagingService._receiveMessageHelper (ViewSDKInterface.js:1)

 

My code:

document.addEventListener("adobe_dc_view_sdk.ready", function(){
var adobeDCView = new AdobeDC.View({
clientId: "<adobe_id>",
divId: "adobe-dc-view",
locale: "fr-FR",
 
});
adobeDCView.previewFile({
content:{
location: {url: "pdf/doc1.pdf"}
},
metaData:{fileName: "doc1.pdf"}
},
{
embedMode: "FULL_WINDOW",
defaultViewMode: "FIT_PAGE",
showDownloadPDF: true,
showPrintPDF: true,
showLeftHandPanel: false,
showAnnotationTools:true
});
 
const saveOptions = {
//
}
adobeDCView.registerCallback(
AdobeDC.View.Enum.CallbackType.SAVE_API,
function(metadata, content, options) {
console.log(content)
}
);
});
 
Anybody have an idea what's wrong?
 
Thanks
This topic has been closed for replies.

1 reply

Adobe Employee
June 29, 2020

Hi, SAVE_API callback function needs to return a Promise. We will update our documentation for making it more apparent.

Participant
June 29, 2020

Hi.

Thanks for the tip it works great