Created
November 25, 2023 09:44
-
-
Save mehmetsarr/c6d389450c36b920908f0dd7a63ab5f9 to your computer and use it in GitHub Desktop.
HTML sayfasını JS ile PDF olarak kaydedin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---index.html--- | |
<div id="content"> | |
<h1>Page Title</h1> | |
<p>Page contents as below</p> | |
</div><div id="page"></div> | |
<button id="submit">Export to PDF</button> | |
-------------------------------------------- | |
<script> | |
var doc = new jsPDF(); | |
var specialElementHandlers = { | |
'#editor': function (element, renderer) { | |
return true; | |
} | |
}; | |
$('#submit').click(function () { | |
doc.fromHTML($('#content').html(), 15, 15, { | |
'width': 190, | |
'elementHandlers': specialElementHandlers | |
}); | |
doc.save('sample-page.pdf'); | |
}); | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment