Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (android)
Viewing all articles
Browse latest Browse all 7655

How to show image to pdf generated by jsPDF library in titanium/android

$
0
0

Can we add an image to a pdf generated by the jsPDF library in titanium/android? Simple text is printing nicely but want to know is there any way of adding and displaying image in generated pdf.Here is the small example i am using:

var doc = new jsPDF();
doc.text(20, 20, 'Hello world!');
doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.');
doc.addPage();
doc.text(20, 20, 'Do you not like that test2?');
 
var res = doc.output();
 
var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'auther.pdf');
file.write(res);
var pdfview = Ti.UI.createWebView({width:'100%',height:'100%',data:file});
var win = Ti.UI.createWindow();
win.add(pdfview);
Ali

Viewing all articles
Browse latest Browse all 7655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>