I have a pdf file that the user has to see and click on the "I agree" button. How do you display a pdf inside a div?
src = 'bar. pdf'; ...it will work.
Using an iframe tag is the second way to embed a pdf file in an HTML web page. In web development, web developers use the iframe tag to embed files in various formats and even other websites within a web page. Due to its wide compatibility, the iframe tag is widely used for embedding pdf.
For example PDF/-A2-compliant PDFs support inserting other PDF/A-compliant files, while PDF/A-3-compliant PDFs can support any file type as an attachment. To attach a file, go to Insert > Attach File in PDF. To embed a file, go to Insert > Embed File in PDF.
Yes you can.
See the code from the following thread from 2007: PDF within a DIV
<div> <object data="test.pdf" type="application/pdf" width="300" height="200"> alt : <a href="test.pdf">test.pdf</a> </object> </div>
It uses <object>
, which can be styled with CSS, and so you can float them, give them borders, etc.
(In the end, I edited my pdf files to remove large borders and converted them to jpg images.)
Here is another way to display PDF inside Div by using Iframe like below.
<div> <iframe src="/pdf/test.pdf" style="width:100%;height:700px;"></iframe> </div> <div> <!-- I agree button --> </div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With