HTML に jsPdf を追加して HTML を PDF としてダウンロードしましたが、IE 9 では機能しません。PDFをダウンロードしていないので、これについて検索したところ、IEシムを有効にする必要があるので、それを行う方法を教えてください。Downloadifyを使用しようとしましたが、理解できませんでした完全な HTML ファイルを渡し、そのイメージを PDF に取得する方法。
3453 次
1 に答える
0
これらは手順ですが、downloadify のサポートは貧弱です。
これらのスクリプト タグをページの上部に追加します (必要に応じて、jspdf の lib ディレクトリ内のファイルへのパスを変更します):
dom
<script src="./js/jspdf/libs/Downloadify/js/downloadify.min.js"></script>
<script src="./js/jspdf/libs/Downloadify/js/swfobject.js"></script>
に a を追加します。<div id="downloadify">
この div は空にする必要があります。
次に、DOM が設定された後に実行されるスクリプト タグをページの下部に追加します。このスクリプトは、「#downloadify」div にボタンを生成します。これを script タグの中に入れます。
Downloadify.create('downloadify',{ // this first argument id a dom element id. this is how it knows where to populate the flash button it's creating.
filename: "afilename.pdf",
data: function(){
// generate your pdf here.
var pdf = new jsPDF;
// various other jspdf commands here
return pdf.output();
},
onComplete: function(){
alert('Your File Has Been Saved!');
},
onCancel: function(){
alert('You have cancelled the saving of this file.');
},
onError: function(){
alert('You must put something in the File Contents or there will be nothing to save!');
},
swf: './js/jspdf/libs/Downloadify/media/downloadify.swf', // make sure this links properly to your file as well.
downloadImage: './js/jspdf/libs/Downloadify/images/download.png', // this is the link to the image of the button itself. An ugly default is included. If you want to style the button, you have to create a sprite image of the same kind.
width: 100, // width of the button
height: 30, // 1/4 height of the button image (which has four states present)
transparent: true, // seems to do nothing, set to true or false.
append: false // have not figured out what this does.
});
于 2016-02-03T20:13:34.427 に答える