Ok, this is a more detailed answer, which gives an example that I mentioned in my first answer. I have a repo on github:
https://github.com/jeffleus/ionic-pdf
and an online imtqy.com example:
https://jeffleus.imtqy.com/ionic-pdf/www/#/ .
First, I created ReportBuilderSvc, which is used to generate the actual report declaration in JSON format used by pdfMake.org. This process will be application specific, so I created it as a separate service. You can view my sample code and play around with your own document definition on the pdfMake.org website. After you have a draft report, put your own JSON document definition in the _generateReport method.
pdfMake.org angular ReportSvc. generateReport() ReportBuilderSvc, JSON. $q , , . / iPhone 4 , 30-45 . , , .
:
- generateReportDef → : ReportBuilderSvc out: JSON rpt
- generateReportDoc → : JSON doc def out: PDFDoc
- generateReportBuffer → : pdfDoc out: buffer []
- generateReportBlob → in: buffer [] out: Blob
- saveFile → in: Blob out: filePath
$rootScope :
function showLoading(msg) {
$rootScope.$broadcast('ReportSvc::Progress', msg);
}
"" :
$scope.$on('ReportSvc::Progress', function(event, msg) {
_showLoading(msg);
});
, , pdf, iframe src w/ dataURI - . InAppBrowser , . , angular. angular/ .
, node, angular ...