1

我们可以将图像添加到由钛/android 中的 jsPDF 库生成的 pdf 中吗?简单的文本打印得很好,但想知道是否有任何方法可以在生成的 pdf 中添加和显示图像。这是我正在使用的小例子:

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);
4

0 回答 0