Cannot generate a PDF file from localStorage


I have a problem when make an IOS ionic app with PDFmake plugin for generate a PDF file if we get any content from localstorage because got an undefined value on console log for $scope.model.selection on my browser. You should check my repo for this case to find a best solution.

Thanks before

I can’t help you with pdfmake, but I’ve had a very good experience using a similar plugin, jsPDF. Maybe you can try to create a pdf file with that library.

Do you have any example code for this?

Nvm but How I can create a currency filter from any $scope such as US $ 4550?

// needs jsPDF included in your index.html
// e.g. <script src="jspdf.js"></script>
var doc = new jsPDF('p', 'pt', 'a4');
    'title': 'nice pdf',
    'subject': 'example pdf',
    'author': 'me',
    'keywords': 'pdf'
doc.text(35, 25, "jsPDF example");
dims.width = 500;
dims.height = 500;
doc.addPage(dims.width, dims.height);
var imgData = 'data:image/jpeg;base64,/9j/............'; // base 64 jpeg image data
doc.addImage(imgData, 'JPEG', 0, 0, dims.width, dims.height);
var pdfOutput = doc.output("blob");
var filePath = 'blabla.pdf';
$cordovaFile.writeFile(filePath, pdfOutput); //needs ngCordova and file plugin

Thanks but How I can make a pdf file from jsPDF result to become an attachment in email?


I have installed jspdf through “npm install jspdf”.

then I have included "script src=“” "/script"
in index.html

after that when I declaring "var doc = new jspdf() "

it is giving me error that cannot found jspdf.

I am working on Ionic 2 project
Do you know how to solve this problem ?