Javascript 科尔多瓦jsPDF-PDF生成,我在手机里找不到PDF文件
我在cordova android设备上运行, 我可以访问“console.log”(“write success”);”但我不认为该文件不显示在保存位置 我试过在两个不同的机器人里跑步, 创建pdf文件并保存在任意文件夹中 源代码 谢谢 我的问题已经解决了 我试图将文件写入root并从那里访问它,这在非root电话中是不可能的。我的问题已解决Javascript 科尔多瓦jsPDF-PDF生成,我在手机里找不到PDF文件,javascript,android,cordova,cordova-plugins,jspdf,Javascript,Android,Cordova,Cordova Plugins,Jspdf,我在cordova android设备上运行, 我可以访问“console.log”(“write success”);”但我不认为该文件不显示在保存位置 我试过在两个不同的机器人里跑步, 创建pdf文件并保存在任意文件夹中 源代码 谢谢 我的问题已经解决了 我试图将文件写入root并从那里访问它,这在非root电话中是不可能的。我的问题已解决 我试图将文件写入root并从那里访问它,这在非root手机中是不可能的。您找到解决方案了吗??我面临着同样的问题!不:{,我需要帮助。你找到解
我试图将文件写入root并从那里访问它,这在非root手机中是不可能的。您找到解决方案了吗??我面临着同样的问题!不:{,我需要帮助。你找到解决办法了吗?我面临着同样的问题!不:{,我也需要帮助
//FIRST GENERATE THE PDF DOCUMENT
console.log("generating pdf...");
var doc = new jsPDF();
doc.text(20, 20, 'HELLO!');
doc.setFont("courier");
doc.setFontType("normal");
doc.text(20, 30, 'This is a PDF document generated using JSPDF.');
doc.text(20, 50, 'YES, Inside of PhoneGap!');
var pdfOutput = doc.output();
console.log( pdfOutput );
//NEXT SAVE IT TO THE DEVICE'S LOCAL FILE SYSTEM
console.log("file system...");
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) {
console.log(fileSystem.name);
console.log(fileSystem.root.name);
console.log(fileSystem.root.fullPath);
fileSystem.root.getFile("test.pdf", {create: true}, function(entry) {
var fileEntry = entry;
console.log(entry);
entry.createWriter(function(writer) {
writer.onwrite = function(evt) {
console.log("write success");
};
console.log("writing to file");
writer.write( pdfOutput );
}, function(error) {
console.log(error);
});
}, function(error){
console.log(error);
});
},
function(event){
console.log( evt.target.error.code );