I am trying to use the PDF embed API but within a web component. When I put the id I get the above error. The id called content is withing the ShadowRoot of the web component. Is there any other way of passing the element where the previewFile can get rendered?
Please provide more information about the error that you are getting for us to help you.
Just yesterday I got this resolved but calling the function from within the iframe content window
Inside my component I create an iframe and inside it I call the viewsdk/main.js and refer to the iframe ele as above. I am just facing another problem which is posted in a new post where the PDF content is in base64 string.
Good to know that you were able to resolve the issue. PDF Embed API doesn't supprt base64 encoded content but you can still use it. We have posted a response on that post for how to make base64 encoded PDF work with Embed APIs.