PDF within a DIV
Hi. I have a page which currently contains just a paragraph of text. I now have a requirement to add a PDF in the middle of the page as well. Not a link to the PDF, but the actual open document itself. The PDF is a set number of pixels wide (roughly 75% of the page width) and is centered on the page.
Normally, I would create an IFrame in the middle of the page and set the source as the PDF, but for this particular project, Frames and IFrames are not possible. (The reason for this is very long and very complicated and out of my control. I won't bore you with the reason why, but please just accept i cannot use any kind of frame. Everything must be kept within a single page file).
Is it possible to have a DIV in the middle of the page and show the PDF in that? I have tried <div src="mypdf.pdf"> and other variations, but to no avail. I have also tried with CSS, but again, no joy
Any solution to this, or any other ideas are appreciated.
Not sure but I believe that PDFs are handled by the browser so I don't know how you would actually open one in a page itself. For instance, I have a Firefox extension that asks me how I want the PDF file handled. Even when it does open it within the browser, it's not in the page itself but as a separate document. Let's see if someone has a definitive answer.
Put a PDF in a DIV tag
Give this a try:
<object data="test.pdf" type="application/pdf" width="300" height="200">
alt : <a href="test.pdf">test.pdf</a>
Another option (albeit, not a good option, but one that can work in a pinch), is to create an iframe in your page and point the frame source to the pdf document. As long as the user has an Acrobat browser plugin installed, it should be displayed in the iframe. Of course, you have no control over whether or not they have the necessary plugin, so use with caution...
True, but you make it sound as if their computer will explode or something. -A link to Adobe to get the required-missing download is a standard Accessibility requirement anyway (document would throw a validation warning for Accessibility s. 508 if a plug-in is called for and no link to source it is given).
Originally Posted by Tweak4
-Actually, this is occasionally a good thing for the general computer-user to encounter..., -a file that requires a common plug-in/helper software. It ensures that they have adequate helper-software installed on their machines (and, installing it, the software probably 'calls home' occasionally asking about updates, fixes, etc).
Like, if I never went to Youtube or any other 'video' repository and tried to download / view things, -how would I ever know that I do not have "Quicktime" installed (for instance).
Myself, -I'm liking the "<object>" method mentioned above (that was going to be my reply but postee got to it first).
Last edited by WebJoel; 06-29-2007 at 04:27 PM.
What can I say? I love the drama of it all
Originally Posted by WebJoel
pdf in div - Thanks!
Originally Posted by geissingert
Exactly what I needed. Saved me so much time!
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)