Skip to content

Commit 868aa25

Browse files
committed
from_html now supports pagination, img and table tags
1 parent 46e8e89 commit 868aa25

1 file changed

Lines changed: 23 additions & 22 deletions

File tree

examples/basic.html

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ <h2></h2>
293293
</tvody>
294294
</table>
295295
</div>
296-
<div><p><pre>var pdf = new jsPDF('p','in','letter')
296+
<div><p><pre>var pdf = new jsPDF('p', 'pt', 'letter')
297297

298298
// source can be HTML-formatted string, or a reference
299299
// to an actual DOM element from which the text will be scraped.
@@ -310,29 +310,30 @@ <h2></h2>
310310
return true
311311
}
312312
}
313+
313314
margins = {
314-
top: 80,
315-
bottom: 60,
316-
left: 40
317-
width: 522
318-
};
319-
// all coords and widths are in jsPDF instance's declared units
320-
// 'inches' in this case
315+
top: 80,
316+
bottom: 60,
317+
left: 40,
318+
width: 522
319+
};
320+
// all coords and widths are in jsPDF instance's declared units
321+
// 'inches' in this case
321322
pdf.fromHTML(
322-
source // HTML string or DOM elem ref.
323-
, 0.5 // x coord
324-
, 0.5 // y coord
325-
, {
326-
'width':7.5 // max width of content on PDF
327-
, 'elementHandlers': specialElementHandlers
328-
},
329-
function (dispose) ->
330-
// dispose: object with X, Y of the last line add to the PDF
331-
// this allow the insertion of new lines after html
332-
pdf.save('Test.pdf');
333-
,
334-
margins
335-
)
323+
source // HTML string or DOM elem ref.
324+
, margins.left // x coord
325+
, margins.top // y coord
326+
, {
327+
'width': margins.width // max width of content on PDF
328+
, 'elementHandlers': specialElementHandlers
329+
},
330+
function (dispose) {
331+
// dispose: object with X, Y of the last line add to the PDF
332+
// this allow the insertion of new lines after html
333+
pdf.save('Test.pdf');
334+
},
335+
margins
336+
)
336337

337338
</pre>
338339
<botton onclick="javascript:demoFromHTML()" class="button">Run Code</buttom></p></div></div>

0 commit comments

Comments
 (0)