Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>JS Bin</title>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.min.js"></script>
- <script>
- $(function(){
- function getPDF(){
- var doc = new jsPDF();
- doc.fromHTML($("#pdf").get(0), 20, 20);
- doc.save('pdf_livro.pdf');
- }
- $('#save').click(function(){
- getPDF();
- })
- })
- </script>
- <style>
- p{
- color:red;
- }
- </style>
- </head>
- <body>
- <div id="pdf">
- <p>oi aqui é um html em vermelho, faz de conta que isso é o livro</p>
- </div>
- <a href="#" id="save">save</a>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement