Commit daedde51 by ramdayalmunda

PDF generated from canvas

parent d056325e
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title> <title>Document</title>
<link rel="stylesheet" href="./assets/a-doc-editor.css"> <link rel="stylesheet" href="./assets/a-doc-editor.css">
<script src="./assets/jspdf.umd.min.js"></script>
<script src="./assets/a-doc-editor.js"></script> <script src="./assets/a-doc-editor.js"></script>
<style> <style>
......
...@@ -14,22 +14,23 @@ function setData() { ...@@ -14,22 +14,23 @@ function setData() {
} }
function generatePDF(){ function generatePDF(){
let url = `${window.origin}/pdf/generate` editor.generatePDF("your_doc.pdf")
let options = { // let url = `${window.origin}/pdf/generate`
method: 'POST', // let options = {
body: JSON.stringify( editor.getContent() ), // method: 'POST',
headers: { // body: JSON.stringify( editor.getContent() ),
'Content-Type': 'application/json', // headers: {
}, // 'Content-Type': 'application/json',
}; // },
fetch( url, options ) // };
.then( async (res)=>{ // fetch( url, options )
let parsedJson = await res.json() // .then( async (res)=>{
console.log('res', parsedJson) // let parsedJson = await res.json()
} ) // console.log('res', parsedJson)
.catch(err=>{ // } )
console.log(err) // .catch(err=>{
}) // console.log(err)
// })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment