Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

PDF vs. jpg

If I want to upload a PDF of my resume, for example, and have it display in the same manner that the sample jpg images do in the html content section, how would I do that?

When I try to code it the same as the jpg files, the PDF doesn't appear on the web page. However, the link works just fine.

1 Answer

Not sure which lesson you're referring to as you posted in the "General Discusison" section, but I can try to help anyway. IMHO, it's best practice to display a link to a PDF by itself and not within HTML. so you just link to the PDF file, maybe with target=_blank to open it in a new window.

If you absolutely have to display a PDF inside of other html content, you could do that by loading the PDF into an iFrame. But this approach is somewhat "1999" and does not follow modern web development standards. What if someone looks at your page from a small screen (tablet or smartphone), or even worse uses a browser that doesn't support PDF at all?

Why not create a small image thumbnail of your resume's first page, include that image into the page and link the pdf to the original pdf file opening in a new browser window.

my 2 cents, ymmv - let me know of you want me to provide a code snippet for the approach described

Roger