Skip to main content
Participant
July 26, 2022
Question

How can I check if the request has failed to load the PDF and then display my own error?

  • July 26, 2022
  • 0 replies
  • 139 views

I am fetching the PDF file from an API end point which is bringing the file to the client side and its working perfectly. Now I want to display a custom error whenever the operation has failed just like how It can be done using JQuery like the example code below:

 

success: function () {
//Do something

},
error: function () {

//Do something

}

 

The code for getting the document from the API end point is like below;

/* Invoke the file preview API on Adobe DC View object */
adobeDCView.previewFile({
/* Pass information on how to access the file */
content: {
/* Location of file where it is hosted */
location: {
url: "https://localhost:44382/api/Document/PDF/12",

headers: [
{
key: "Authorization",
value: "Bearer kasbdskajdbdsjdnnjsmdanksd",
}
],
type: "GET",
},
/* Pass meta data of file */
metaData: {
/* file name */
fileName: "@viewDocument.DocumentTitle"
}
}, {
defaultViewMode: "FIT_WIDTH", showAnnotationTools: true, showLeftHandPanel: false,
showDownloadPDF: false, showPrintPDF: false
});

 

Now how can I come up with an error function or success function using the above adobe code?

This topic has been closed for replies.