I'm trying to generate PDF from the HTML I generate using angularjs but when I use the angular URL to request (via requestify) instead the content of the page, I'm getting the content of index.html page...does anyone know how to get the HTML content generate on the ng-view
$routeProvider
.when('/mediakit/:account', {
templateUrl: 'app/mediakit/mediakit.html',
controller: 'MediaKitCtrl'
});
I want the content from http://localhost:9000/mediakit/accountid that uses mediakit.html as template not the content of index.html (where the contents are load through ng-view)
The code I'm using to generate PDF
let pdf = require('html-pdf');
let requestify = require('requestify');
let outputPath = './server/public/';
//req.body.mediaKitURL --> is the URL that I load the content when I open in the browser
requestify.get(req.body.mediaKitURL).then(function (response) {
// Get the raw HTML response body
let html = response.body; --> //the content here is the content from index.html,
//I would like to get the content from the my angular route that uses mediakit.html (same when I open the URL in the browser)
let config = {format: 'letter'};
// Create the PDF
pdf.create(html, config).toFile(outputPath + '/media_kit_'+req.params.account+'.pdf', function (err, result) {
if (err) return console.log(err);
console.log(result); // { filename: '/pathtooutput/generated.pdf' }
res.status(200).json();
});
});
I hope that's clear...