HTMLからPDFを生成しようとしていますが、角度のURLを使用して生成しますが、代わりに角度URLを使用してページの内容をリクエストします(requestify経由)。 index.html
ページ...誰もがHTMLコンテンツは、私は内容があるのindex.htmlのmediakit.html
テンプレートとしてではないコンテンツを(使用していますhttp://localhost:9000/mediakit/accountid
からコンテンツをしたいng-view
URLからHTMLコンテンツをロードするAngularJS
$routeProvider .when('/mediakit/:account', { templateUrl: 'app/mediakit/mediakit.html', controller: 'MediaKitCtrl' });
に生成取得する方法を知っています負荷ng-view
)
私は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();
});
});
を生成するために使用しているコードに私は私はあなたが生成されたPDFファイルの内容を表示するには、PDFビューアを探していると思う
これは私が探しているものではありません、angularjsディレクティブの下REFERE。 –