Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to select and display a PDF in an iframe in one page 1

Status
Not open for further replies.

mkrausnick

Programmer
Apr 2, 2002
766
US
That's probably confusing but here's the idea:

I want a row of links to PDF files across the top of the page, and an iframe below taking up the remainder of the page. When the user clicks one of the links, the PDF file will appear in the iframe on the same page.

What would the <a> tag look like and what would the <iframe> look like?

Related question: Would it be better to use an <object> rather than an <iframe> for this?

Mike Krausnick
Dublin, California
 
i'm not sure... but you could have the links that say
Code:
<a href="file.pdf" target="pdfframe">Click Here</a>

I think the iframe could be something like:

Code:
<iframe src="somewebpage.html" width="80%" height="80% name="pdfframe""></iframe>

there are some other atributes you can add to the iframe


frameborder="0"
setting the border to 0 gets rid of it, allowing the page to seamlessly integrate with your main page. Possible values are 1 (yes) and 0 (no), you cannot give it a bigger border.

marginwidth="x"
adds a margin to the sides of the framed page.

marginheight="x"
adds the margin to the top and bottom of the framed page. Added to any margins you've given the pages in their <body> tags.

scrolling="no"
if the framed page is too big for the dimensions you've specified a scrollbar will appear. This attribute will stop this from happening.

align="right"
like the image attribute, this will affect how the text around the frame aligns itself.

hspace="x"
sets a margin of white space around the frame to the sides.

vspace="x"
sets a white-space margin to the top and bottom.

i think you can also add styles to choose absolute positioning and other stuff...
 
Awesome - it worked perfectly! Well almost perfectly. Turns out the <iframe> SRC tag is not needed. Here's what worked:
Code:
<a href="full_path_and_pdf_filename" target="pdfframe">Click here</a>
and
Code:
<iframe name="pdfframe" width="80%" height="80%" frameborder="1"></iframe>

Sometimes I think HTML is voodoo.

Thanks - that one's definitely worth a star!


Mike Krausnick
Dublin, California
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top