1
AngularJSとElectronでライブラリpdfmakeを使用する際に問題があります。 pdfは空白に保存されます。pdfmake + AngularJS +エレクトロンが作成する_blank pdf
コードは次のとおり
.service('PDFService', function() {
this.createPdfOne = function(data) {
const {dialog} = require('electron').remote;
const choice = dialog.showOpenDialog({ properties: [ 'createDirectory', 'openDirectory']});
var docDefinition = {
content: [
'First paragraph',
'Another paragraph, this time a little bit longer to make sure, this line will be divided into at least two lines'
]
};
var fs = require('fs');
pdfMake.createPdf(docDefinition).getBuffer(function(result) {
fs.writeFileSync(choice + '/sample.pdf', result);
});
};
});
UPDATE:私は使用問題を解消
:
pdfMake.createPdf(docDefinition).download()
代わりの:
var fs = require('fs');
pdfMake.createPdf(docDefinition).getBuffer(function(result) {
fs.writeFileSync(choice + '/sample.pdf', result);
});
:それはあなたのような何かができると言って終了しましたgithub.com/bpampuch/pdfmake/issues/116 –
@ Jordan.JDありがとう、これは完全に – g4s0l1n
あなたがそれが働いたことを確認して以来、私は答えとして投稿 –