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 trialVanessa Ferragut
479 PointsAttaching a PDF to a page for user download
Is there a way to "attach" a PDF of something to a web page? Something that people can click on and download? Is there a special widget or plugin I need to install for something like this? An example would be under our Deals Page or the merchant page if we wanted to add a PDF of a certificate or coupon that a registered user can click on to open/save/print.
3 Answers
Joe Powell
3,933 PointsIf you're using wordpress just go to the media section upload it to the library. Once uploaded it will appear in the library click it and in a panel to the right you will see the file URL (the path/web address to the file) copy this URL. Go to the page you'd like to add it to code in a basic link and link it to the URL you copied. As James said the PDF will automatically open in the browser window.
You can add a link also in the wisywig by clicking the link icon above the content field and copying the URL to the PDF into the designated field in the pop up window.
Hope that helps Vanessa
James Barnett
39,199 PointsJust upload the file to your site and then link to it. The browser will take care of the rest.
Vanessa Ferragut
479 PointsHi James,
You mean upload to the media files? And how would I link this? "Set Featured Image?" or "Upload Media?"
We don't want to upload this as a photo, but rather as an attachment that people can double click and open as a PDF on their computers. Thanks!
Elizabeth Naughton
374 PointsHaving issues printing PDF after it shows up in browser. When I hit command P it doesn't work. The only way to get it to preview correctly and print is to "right click" then hit print. My clients will not know to do this. Any suggestions?
James Barnett
39,199 PointsElizabeth Naughton - You can use JavaScript to make a print button. However, if you want it to print a PDF you need to use an iframe. There's a caveat though, as there is currently a bug in firefox for printing an iframe, so it's probably not a good idea to go that route.
further reading:
Vanessa Ferragut
479 PointsVanessa Ferragut
479 PointsThanks, all!