タイトルとして、私はjsPDFを使って自分のウェブサイトのdivセクションをエクスポートしてPDFとしてエクスポートします資料。jsPDFを使用して私のウェブサイトのDivをPDF形式のレポートにエクスポートしましたが、適切な形式を得られません
これらは私のコードは
<script>
function exportToPDF() {
var pdf = new jsPDF('l', 'pt', 'a4');
// source can be HTML-formatted string, or a reference
// to an actual DOM element from which the text will be scraped.
source = $('#tab_cm')[0];
// we support special element handlers. Register them with jQuery-style
// ID selector for either ID or node name. ("#iAmID", "div", "span"
etc.)
// There is no support for any other type of selectors
// (class, of compound) at this time.
specialElementHandlers = {
// element with id of "bypass" - jQuery style selector
'#bypassme': function (element, renderer) {
// true = "handled elsewhere, bypass text extraction"
return true
}
};
margins = {
top: 30,
bottom: 60,
left: 30,
width: 500
};
// all coords and widths are in jsPDF instance's declared units
// 'inches' in this case
pdf.fromHTML(
source, // HTML string or DOM elem ref.
margins.left, // x coord
margins.top, { // y coord
'width': margins.width, // max width of content on PDF
'elementHandlers': specialElementHandlers
},
function (dispose) {
// dispose: object with X, Y of the last line add to the PDF
// this allow the insertion of new lines after html
pdf.save(pdfName);
}, margins
);
}
</script>
マイ本部のセクションでは、次のようになります。 https://drive.google.com/file/d/0B2mHDe7wmRSfU2Q0UjM4QV9Sc2c/view?usp=sharing
をしかし、あなたは私を見ることができるように、この一回 https://drive.google.com/file/d/0B2mHDe7wmRSfMndIVGZUQ2FHLW8/view?usp=sharing
エクスポートのように見えます私の博覧会のテーブルの中にそれらのテキストを適切に整列させる方法を知らない書かれたPDF。
ありがとうございました!
wohoooo !! html2canvasが問題の解決に役立った!ありがとうございます! html2canvasがどのように特定のDIVとビオラをターゲットにしているのかを調べたところ、問題は解決しました:) – Noctis17