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


converting the web page to the pdf format in jscript

Hi Now am working in the resume builder application. In that everything is working fine. But unfortunately I cannot download the resumes in pdf formate. I dont know how to make it, but currently I have added the print friendly jscript plugin in my website. Its woking but It doesnt add the template css style in the pdf filw while dowwnload.

Am tottally stucked..

Here is my code....

Jscript Code for jscript: < script > var pfHeaderImgUrl = ''; var pfHeaderTagline = ''; var pfdisableClickToDel = 0; var pfHideImages = 1; var pfImageDisplayStyle = 'none'; var pfDisablePDF = 0; var pfDisableEmail = 0; var pfDisablePrint = 1; var pfCustomCSS = 'D:\xampp\htdocs\RB\styles\premium2.css'; var pfBtVersion = '1'; (function () { var js, pf; pf = document.createElement('script'); pf.type = 'text/javascript'; if ('https:' == document.location.protocol) { js = 'https://pf-cdn.printfriendly.com/ssl/main.js' } else { js = 'http://cdn.printfriendly.com/printfriendly.js' } pf.src = js; document.getElementsByTagName('head')[0].appendChild(pf) })(); < /script>

html code for plugin image and styling: <a href="http://www.printfriendly.com" style="color:#6D9F00;text-decoration:none;" class="printfriendly" onclick="window.print();return false;" title="Printer Friendly and PDF"><img style="border:none;-webkit-box-shadow:none;box-shadow:none;margin:0 6px" src="http://cdn.printfriendly.com/pf-print-icon.gif" width="16" height="15" alt="Print Friendly Version of this page" />Print <img style="border:none;-webkit-box-shadow:none;box-shadow:none;margin:0 6px" src="http://cdn.printfriendly.com/pf-pdf-icon.gif" width="12" height="12" alt="Get a PDF version of this webpage" />PDF</a>

please anyone help me to find it.. please thank you..

1 Answer

Aaron Troia
Aaron Troia
5,773 Points

I played around with your code, and was finally able to at least get the function to return in the Chrome's console. Not sure if it had to do with spaces, missing semicolons, or what the syntax issue was but this should at least return your function.

var pfHeaderImgUrl = ''; var pfHeaderTagline = ''; var pfdisableClickToDel = 0; var pfDisablePDF = 0; var pfDisableEmail = 0; var pfDisablePrint = 0; var pfCustomCSS = ''; var pfBtVersion='1'; (function(){ var js, pf; pf = document.createElement('script'); pf.type = 'text/javascript'; if('https:' == document.location.protocol){ js='https://pf-cdn.printfriendly.com/ssl/main.js'; }else{ js='http://cdn.printfriendly.com/printfriendly.js';} pf.src=js; document.getElementsByTagName('head')[0].appendChild(pf);});