Created
June 13, 2019 22:19
-
-
Save apexdodge/b382ea0596e1abede5b4aaef0a0b37e9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function HtmlToPdfController($scope, $http) { | |
| $scope.printToPdf = function () { | |
| $http.defaults.headers.common.Authorization = 'YOUR-API-KEY'; //replace with our API key from portal.api2pdf.com | |
| var endpoint = "https://v2018.api2pdf.com/chrome/html" | |
| var payload = { | |
| html: "<p>Hello from AngularJS</p>", //set your HTML here! | |
| inlinePdf: true | |
| } | |
| $http.post(endpoint, payload).then( | |
| function(response) { | |
| console.log(response) //your PDF is in this response. Do something with it! | |
| }, | |
| function(error) { | |
| }); | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment