My embed api is working fine. Now I want to know if there is any way to handle exeption occure in adobeDCView.previewFile() function, like 404 etc.
I donot find anything in documents. If I give wrong pdf url this function print code: "PREVIEW_RENDERING_FAILED" , but I do not know how to handle it.
I assume you are using location.url with a path to your PDF. My suggestion is to fetch the PDF first so you can handle the exceptions yourself and then when you know you have the file, pass the PDF content as a Promise that resolves to a ByteArray. I have a working example at this CodePen. The example also shows how to delay the creation of the embedded view until you have the PDF and then to delay displaying it until the PDF is rendered.
Thank you for reply. Is there any way to handle exception when we pass location.url. SDK is printing PREVIEW_RENDERING_FAILED, so there should be any callback or anything else to detect if there is any error in rendering, like APP_RENDERING_DONE.
You can use the PREVIEW_RENDERING_FAILED event to detect a failure to render (as it implies) but you have no idea as to why it failed. The file may not have been located or it may just have been bad or it might have not been a PDF at all.
While not documented as such, I consider it a best practice to fetch the PDF first, check the mime-type of the fetched file, and if it is a PDF, load the viewer. That way you are in full control of the error processing.
I have tried to add PREVIEW_RENDERING_FAILED event but it looks never fire.
As I stated, I consider it a best practice to fetch the PDF first. That's how to work around these issues.