The first step is to grab an API key from https://portal.api2pdf.com. It only takes a minute. Once you have your API key, analyze the code below. This is a very simple AngularJs controller that has a function printToPdf(). This function sets your API key (which you should replace with the one you just acquired) and makes a POST call to the Api2Pdf REST API with the HTML specified. The response includes the payload and a URL to the generated PDF. It’s literally that simple.
Below is a link to a JS Fiddle that you can modify to include your own API key and play with.
Hope that helps!Tags: angularjs client side print to pdf, convert html to pdf angularjs, headless chrome angularjs, html to pdf angular, html to pdf angularjs, pdf generation angularjs, wkhtmltopdf angularjs
Comments are closed.