• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Embed API: Is the URL passed visible anywhere in the browser

Explorer ,
Sep 01, 2020 Sep 01, 2020

Copy link to clipboard

Copied

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

TOPICS
PDF Embed API

Views

485

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 02, 2020 Sep 02, 2020

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.

Votes

Translate

Translate
Community Expert ,
Sep 02, 2020 Sep 02, 2020

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 02, 2020 Sep 02, 2020

Copy link to clipboard

Copied

Thanks Joel. will do that

~R

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 02, 2020 Sep 02, 2020

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

LATEST
Yup. Have done that. Thanks for nudging that too.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources