Cordova Pdf文件无法正常工作

时间:2016-03-21 04:29:24

标签: javascript cordova

使用以下代码我可以创建PDF文件。

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, fsSuccess, fail);

    function fsSuccess(fs){
        //alert(fs.root.toURL()+"KmdMoney/i-CountReport.pdf");
        pdfPath=fs.root.toURL()+"KmdMoney/i-CountReport.pdf";
        window.resolveLocalFileSystemURL(fs.root.toURL(), function(fileSystem){
            fileSystem.getDirectory("KmdMoney", {create: true, exclusive: false},function(directorypp){
                directorypp.getFile("i-CountReport.pdf", {create:true}, function(entry) {
                    var fileEntry = entry;
                    //console.log(entry);
                    venufile=entry;
                    entry.createWriter(function(writer) {
                        writer.onwrite = function(evt) {
                            console.log("write success");

                        };
                        writer.write( pdfOutput );
                        console.log("writing to file");             

                    }, function(error) {
                        console.log(error);
                    });

                }, onError);
            }, onError);

        } , onError);

I attached the created PDF file using email plugin, when I open PDF getting the following error.

0 个答案:

没有答案