After passing the url to the Preview method I found that in the resulting iframe I could not see the URL? I wish to confirm whether this is true. It suits my use-case where even though the PDF is a public resource I would not like it to be available on display. Hence. Thanks
Copy link to clipboard
If you pass the PDF as a URL, it will be visible in the page source even though it won't be apparent in the iframe. If you need to obfuscate the location of the PDF. Pass the content as a Promise and leverage some middleware to get the PDF and return just the bytes to your page.
Your suggestion worked Joel. I did the following.
1. "Fetched" the PDF. fetch(url-to-pdf)
2. On successful response converted into blob: response.blob()
3. Created localhost URL : URL.createObjectURL(blob)
4. Passed above URL to preview method.
Good to hear that you got it working. Be sure to disable both downloading and printing if you want to prevent people from getting to the PDF. Download is obvious but printing back to PDF is another way to get the PDF.