【发布时间】:2016-10-18 21:29:57
【问题描述】:
我是 PhoneGap 应用程序的初学者。我正在尝试在 Android 中创建一个应用程序,它将牛数据作为文本存储在 SQLite 中,并在我的应用程序中以表格形式显示它们。我成功地做到了。但我想将表格数据以 PDF 格式保存到我的手机中。我曾在 Google 中搜索过如何保存表格数据并找到以下代码:
<button onclick="printData()">Print me</button>
<script>
function printData()
{
var divToPrint=document.getElementById("printTable");
newWin= window.open("");
newWin.document.write(divToPrint.outerHTML);
newWin.print();
newWin.close();
}
$('button').on('click',function(){
printData();
})
我在我的应用程序中使用了此代码,但我仍然无法将我的表格数据保存为 PDF。即使单击按钮后也没有任何反应。请给我一个建议。
提前致谢!! 拉古达塔
【问题讨论】:
标签: javascript android cordova pdf phonegap-build