I have pdf files on my website that I would like to show on a page , I tried :
<iframe src="https://mywebsite.com/files/file.pdf" frameborder="0" width="600" height="550" style="margin:0px; padding:0px;"></iframe>
but the file is downloaded.
I tried using google drive :
<iframe src="https://drive.google.com/viewerng/viewer?embedded=true&url=http://mywebsite.com/files/file.pdf" ></iframe>
But I get the html of my login page , I think it automatically redirects to login page.
and I tried to use iframe to access the folder that contains the file:
<iframe src="https://mywebsite.com/files" ></iframe>
But I get forbidden message that tells me to edit my file permissions .
-Is there is a specific permission that I could use to access the folder or the file?
-Is there is a library , function in any web developing language or anything that could help?
Related
I have a link when pasted it would display as PDF
But when I embed in iframe its not displaying and refusing to connect.
I have tried with
<iframe src="https://docs.google.com/presentation/d/1s5kA0DXmxUGZ7Ydjk3Aa-wu7xhKyInM3s7p19XUfaFU/export/pdf?id=1s5kA0DXmxUGZ7Ydjk3Aa-wu7xhKyInM3s7p19XUfaFU&pageid=g9fbb3c24c3_0_71&attachment=false" title="IFRAME">
</iframe>
I realized that, when ceratin URLS have a XFRAME as sameorigin they don't allow to embed via iframe. Its evident here.
Make sure you have public access to view the pdf file. You can also use the Object tag to view pdf if the user has the pdf plugin installed. else it will display a Google doc file.
<object data="https://docs.google.com/viewerng/viewer?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true">
<iframe src="https://docs.google.com/viewerng/viewer?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true" frameborder="0" height="100%" width="100%"></iframe>
</object>
I have a static HTML site. It's for a little food shop. They need to upload their menus and other every month. SO they need to upload PDF documents somehow. I think uploading to google drive is better. No ? It's easy than creating a seperate admin view to upload files and all.
so anyone can tell me how can I upload PDF in google drive and embed the link in my code ? There are eight menus and they need to show as thumbnails. When users click on them, they will download.
You need to share the pdf file to "Public on the web"
The go to file > embedded this pdf file. This will give you the html code.
Copy and paate it in your html code
Refer http://www.mybloggerlab.com/2013/03/how-to-embed-pdf-and-other-documents-in-blogger-posts.html
It is simple to upload a PDF in Google Drive and embed a direct download link into your code. I have inserted an excerpt from labnol.org
Google Drive doesn’t offer a simple option for creating these “direct download” link but you can easily create them by slightly modifying the generated URLs. Here’s the trick.
A file hosted on Google Drive has a shared link that looks like this
https://drive.google.com/file/d/FILE_ID/edit?usp=sharing
When you access this link, it will render the file in the browser but if you can rewrite this URL slightly, the link, when clicked, will download the corresponding file in the user’s browser instead of opening it in the browser. The modified URL would be:
https://drive.google.com/uc?export=download&id=FILE_ID
All you have to do is make note of the FILE_ID in the original URL and use it in the modified URL. For example, here’s an image file hosted on Google Drive that will open in the browser and here’s the modified URL that forces the browser to download the file.
Just do...this and enjoy
INSERT_YOUR_ID_HERE = your pdf file id
1st solution below
<iframe src="https://drive.google.com/file/d/**INSERT_YOUR_ID_HERE**/preview" height="100%" width="100%" frameBorder="2" scrolling="auto" ></iframe>
2nd solution
<embed
src="https://drive.google.com/file/d/**INSERT_YOUR_ID_HERE**/preview"
height="100%"
width="100%"
></embed>
enter image description here
I am using the below code to open a pdf file but its not working-
<iframe src="file:///C:\Users\Downloads\0895custbill08132015.pdf" style="height: 638px;" frameborder="0"></iframe>
For a google doc the below code is working fine, I am not sure what is required to open a locally saved doc.
<iframe src="http://docs.google.com/gview?url=http://webshire-aioopsss.com/pdfs/sample_contract.pdf&embedded=true" style="height:638px;" frameborder="0"></iframe>
Most browsers won't let you open a locally stored file from a website for security reasons. Typically I will host the file on an IIS server and then retrieve it from there (which is what you're doing when you're retrieving it from googledoc).
You are using backslashes in your src. Please change them to slashes
<iframe src="file:///C:/Users/Downloads/0895custbill08132015.pdf" style="height: 638px;" frameborder="0"></iframe>
You can use
var pdf = $('\<\object type="application/pdf">');
pdf.attr('data', "you pdf scr");
append it in your iframe..
I hvae iframe code like this
<iframe id="iframe" align="left" style="background-color:#000000" src="//third party url" frameborder="0" height="85" width="300" scrolling="no">
Now it generates a link inside body.& i want to remove a link from that.
Any suggestions??
If the iframe src points to another server than yours, you cannot alter its HTML (the cross-domain restriction).
You can however hide the link by Javascript or CSS if you can control somehow the third party server (a method named JSONP).
You can't do that from the Javascript as it is from external site. Alternately you can do it from server side (either PHP/ASP.NET or others) using CURL or respective syntax to read the content and change before serving. It should work without any issues.
I am trying to load a page from a domain (say abc.com) to my website (say xyz.com). I would like to show a page from abc.com within xyz.com without showing the original URL. This means the site visitor will not be able to find out the original source URL (abc.com).
Make a page in your website and put an iframe in it and set the url of that iframe as url of the page of the other website, in this way the page will be loaded from other site and url will be of your site.
<iframe src="http://www.abc.com/thepage" style="border-width:0;width:100%; height:800px;"></iframe>
<iframe src="http://www.xyz.com/thepage" width="300" height="300" frameBorder="0"></iframe>
Then you need to configure you server to act as reverse proxy to abc.com for the /thePage