Why .doc automaticly downloads, but not shown in <iframe>? - html

The problem is - when I input url with .png or .pdf it has been shown in iframe>. I can scroll it, read etc.
But when I insert an url which has docx or xls file (ex. "http://www.exampleimage.docx") - it automatikly aploads by browser, and not shown in iframe>.But i want to see content of .docx file in iframe like i do with pdf.
What to do or where to search guys?
here is part of my code:
<iframe src={{attachmentUrl}} width="468" height="468" frameborder="0">
Click on attachment please.
</iframe>

You can edit your url i.e,
"https://docs.google.com/gview?url=${YOUR_URL}&embedded=true" and then add to iframe:
<iframe
className="doc"
src={`https://docs.google.com/gview?url=${YOUR_URL}&embedded=true`}
/>

Related

Prevent to download pdf using embed tag

I'm using php, I'm creating a detailed view page of a profile, which has a pdf document, I use the embed tag to display it, but when opened it does not display the pdf file and Automatically download the file. Therefore the user can not see the pdf file displayed.
<embed src="/vh/assets/image/java.pdf" type="application/pdf" width="500" height="500"/>
Is there a way to solve this problem?
PDF documents are not supported as a src in the HTML <embed> tag.
You can get around this issue by using the Google Chrome PDF viewer as the embed `src.
<embed
src="https://drive.google.com/viewerng/viewer?embedded=true&url=http://yourdomain.com/vh/assets/image/java.pdf"
width="500"
height="500"
/>
Note that your url in the src cannot be relative /vh/assets/image/java.pdf, it must be the full url http://yourdomain.com/vh/assets/image/java.pdf.
There also exist some third party libaries such as PDF.JS.
You can refer to w3schools embed tag,It is an html single tag,I can display pdf normally in chrome and firefox.Maybe you can check if your src is correct.
You can try below snippet #toolbar=0 helps disabling the options
<embed id="myObject1" src="file:///C:/Downloads/OoPdfFormExample.pdf#toolbar=0" type="application/pdf" width="1000px" height="600px">
This will disable download, print and other option of pdf viewer on browser

Make changes to a website written in HTML based on the content on a text file

So I've been looking around for an answer to this, without success.
So I'm looking to have the text inside of a .txt file to be inserted in a line in html5 code, I can't think of how this should be worded so here's an example.
<iframe type="text/html" frameborder="0" width="1920" height="1080" src="https://www.youtube.com/embed/TEXTFILECONTENT" allowfullscreen></iframe>
And is it possible to have it change every time the content of the text file changes?
Any questions please reply I'm sure I wrote this somewhat wrong.
Yes u can!, u must create your HTML5 with Ajax. example:
Client open ur HTML5 page
Client get fresh text
every 3 sec. ajax synchronize your text file from server or other
this can solve your problem because if u change text then each 3 sec. client get uptodate text..
just change src to your file.., replace 'TEXTFILECONTENT' with the file name YOUR.txt
Your IFrame's src should simply be set to the full url to the text file. In your example, replace 'TEXTFILECONTENT' with the file name, like 'MyTextFile.txt'. Then the browser should fetch the file and display it in the iframe. If your textfile is in a subdirectory, then add that to the url, like 'folder/textfile.txt'.
Edit:
You can add a link to your page that loads the textfile into the iframe. First give your iframe an id, like this:
<iframe id="myiframe" type="text/html" frameborder="0" width="1920" height="1080" src="https://www.youtube.com/embed/TEXTFILECONTENT" allowfullscreen></iframe>
Then give your link a target attribute, like this:
Discord server
Now when people click the link the textfile will be loaded into the iframe.

Embedding pdf file in HTML page

How do i embed a pdf file into a HTML document without scrollbars..?
I need to display the whole pages of pdf file in the HTML document.
if the pdf file have 10 pages then the i need to display the whole 10 pages in the HTML document without the scrollbars.
I have tried this code but not worked properly.
<iframe src="/Path to my pdf file#toolbar=0&navpanes=0&scrollbar=1&zoom=133" width="100%" height="100%" scrolling="no"></iframe>
Result of the above code
i got this result but i want to remove the scrollbar and display the full pad in my page.
please help..........

Can not print PDF insert into HTML

I have an html document and i inserted a pdf file with:
<iframe id="fred" style="border:1px solid #666CCC" title="PDF in an i-Frame" src="C:test.pdf" frameborder="1" scrolling="auto" height="100%" width="100%" ></iframe>
I can visualize my document and the pdf, but when i try to print it or send it by email, the pdf is not there anymore.
How can I make for don't lose the pdf file in any action I do with the document or if i want to open the file in a different server or different computer?
Thanks
Try it with Google Drive:
Go to drive.google.com
Upload the file
Embed it on your website

How to embed pdf file into books.google.com?

Hi I have problem that I want to embed my website pdf file in books.google.com by iframe. I have tried that answer but I dont know that how to give my site link to iframe
<iframe frameborder="0" scrolling="no" style="border:0px" src="https://books.google.com.kh/viewerng/viewer?embedded=true&url=website.com/test/CV.pdf" width="500" height=500></iframe>
So any suggestion or help would be very much appreciated. Thanks!
It does't seem that you ever uploaded your PDF to books.google. You will have to do so in order to get the embed code to include in you site.
With the direct link you provided, you can embed that like this:
<iframe src="http://www.softbroz.com/test/CV.pdf" style="width:718px; height:700px;" frameborder="0"></iframe>
If you want to embed a PDF from books.google, you will have to upload the PDF first, then follow these instructions:
Embed a PDF located on google drive
Select your PDF in Google Drive. In the toolbar click on the eye
icon to preview the PDF.
You need to pop out the PDF by clicking on the Pop-out icon (square
with an arrow).
The more options icon (3 dots) has the option to embed the PDF.
Copy the embed code. Use this in your site. Notice the default height and width in the code of
640 by 480 pixels. You may want to edit those values to show the
size you want in your embed.