私が抱えている問題を理解しようとしています。 私はAndroid用アプリケーションをCordovaからやっています。 解決策を探しましたが、実際には見つかりませんでした。Uncaught ReferenceError:LocalFileSystemが定義されていません
最初に私は定義されていない "requestFileSystem"に問題がありましたが、今修正されているようです。 問題を修正すると、問題は別の機能に移動しました。
私は基本的に作成する必要があり、ボタン、保存(そしておそらくショー)PDF持っている:機能を
function pdfCreation() {
//FIRST GENERATE THE PDF DOCUMENT ON TABLET, DOESN'T SHOW
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 pdfUriString = doc.output('datauristring');
console.log(pdfUriString);
var pdfOutContainer = jQuery("#pdfOutContainer");
pdfOutContainer.attr("src", pdfUriString);
//NEXT SAVE IT TO THE DEVICE'S LOCAL FILE SYSTEM
console.log("file system...");
//requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) {
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
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);
});
}
:
<!--Button to generate PDF-->
<div data-role="collapsible" data-inset="false" data-mini="true">
<h3>Reports</h3>
<div>
<a href="javascript:pdfCreation()" class="button"data-role="button" id="PageUnitButtonGeneratePDIReport">Generate PDI Report</a>
<!--<iframe width="100%" height="500px" id="pdfOutContainer"></iframe>-->
</div>
</div>
を、これは問題が含まれている私のJSコードであります問題はpdfCreationです。 jdfiddleをここに追加します。便利な場合もあります。
https://jsfiddle.net/antus2f0/
誰も私を助けることができれば、いいだろう! ありがとうございます。
ご回答いただきありがとうございます。 私が今持っているエラーは少し異なりますが、私はすでにいくつかのテストでそれを見つけました。 "Uncaught ReferenceError:LocalFileSystemが定義されていません" –