2017-07-12 20 views
0

私はjsPDFでPDFに私のフォーム(Sharepointの)を変換したいが、私は問題を抱えている...ASPXのpdf jsPDFへ

Form Page

結果:

PDF

することができます助けて ?

マイコード:

function demoFromHTML() { 
var pdf = new jsPDF('p', 'pt', 'letter'); 
// source can be HTML-formatted string, or a reference 
// to an actual DOM element from which the text will be scraped. 
source = $('.JsPDF tbody')[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: 80, 
    bottom: 60, 
    left: 10, 
    width: 700 
}; 
// 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('Test.pdf'); 
}, margins); 

}

私は自分のフォームを変換するのではなく、画像のPDFファイルを作成spformが、私はネイティブフォーマットに変換する必要があるspformを使用する前に。適切なフォーマットを取得するには難しいことができますので、

jspdfは、CSSをサポートしていません場合には、誰かが、これは重宝して

おかげ

答えて

0

私の前の回答は、削除されました。画像としてHTMLを追加できない場合は(https://stackoverflow.com/a/43064789/7751910)、この特定のライブラリを使用する場合は、テキスト部分を別に追加するのが唯一の方法です。

doc.text( 'my text'、287.64、415、 'center');