This is an archived forum post. The information may be outdated. Contact us if you have any questions.
router.route('/pdf') .get(function(req,res){ /*do a bunch of things to generate the html. Mostly taking parameters from the req object to create the handlebars context */ res.render(view, context, function(err,html){ var client = new pdf.Pdfcrowd("MYUSERNAME", "MYAPIKEY"); client.convertHtml(html,pdf.sendHttpResponse(res),{ use_print_media:true, } ); }); })
<!DOCTYPE html> <html ng-app="MyAngularApp"> <head land="en"> <meta charset="UTF-8"> <title>MY SITE TITLE</title> <link href="/css/views/MyCSSFILE.css rel="stylesheet"/> <script type="text/javascript" charset="utf-8" src="/js/views/MYJSFILE.js"></script> </head> <body ng-controller="myAngularController"> <!-- My body code is here, looking as it should look --> </body> </html>
router.route('/pdf') .get(function(req,res){ /*do a bunch of things to generate the html. Mostly taking parameters from the req object to create the handlebars context */ res.render(view, context, function(err,html){ var client = new pdf.Pdfcrowd("MYUSERNAME", "MYAPIKEY"); client.convertHtml(html,pdf.sendHttpResponse(res),{ use_print_media:false, pdf_name:'My_PDF.pdf', no_images:false } ); }); })