Hi, I would like to generate some pdf file with jsPDF. Any idea of how to use/modify it for mobile application ? Regards
This was pretty simple actually. I'd really never heard of jsPDF until I read this post, but I was able to created a plugin with an example app that generates PDFs using the library fairly quickly. You can grab the example app and the plugin from my GitHub repo.
Happy Coding ...
Great Anthony !! It works fine and using it with Airprint module will be great :-) Regards
I've seen a problem with JSPDF, it seems that it doesn't support unicode, French accent show strange char :-(
Anthony, I have found another one more complete, but exactly the same in terms of function calls. https://github.com/Marak/pdf.js I have tryed to tweak it to make it compatible with Ti but I have some font error, so my tweak may be bad. May be it could be usefull to add this one also in your plugin. The only difference for using it is
var doc = new pdf();instead of
var doc = new jsPDF();the other stuff is the same, of course more function in this one like the possibility to draw lines, rectangles etc...
I recently started looking a jspdf. jsPDF seems to be in active development and their latest version is awesome. I am attempting to create a pdf with attached images, which is possible to do in a browser, using canvas , canvas.toDataURL , and atob() . Unfortunately this doesn't work out of the box in Titanium. When I read a JPEG file , the returned blob cannot be read by jsPDF , as it's not a string. Ti.Utils.base64encode and decode are not totally useful , mainly because de decode method returns a TI.Blob. I'm now trying to Ti.Utils.base64encode to get a base64 encoded string, and then use another js base64 decoder to return a JavaScrip string. If this works, we can say that we are now able to also add images to pdf's. I'll keep you posted. Help with this is also welcome.
Think you can help? Login to answer this question!