Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- essay = {
- "title": "",
- "author": { "fullname": "" },
- "intro": "",
- "conclusion": "",
- "paragraphs": [ { "paragraph": "" } ]
- }
- CreatePdf(){
- var docDefinition = {
- content: [
- { text: this.essay.title, style: 'header' },
- { text: new Date().toTimeString(), alignment: 'right' },
- { text: 'Written By : '+this.essay.author.fullname, style: 'subheader' },
- { text: this.essay.intro, style: 'story', margin: [0, 20, 0, 20] },
- // Foreach essay.paragraphs and display the value
- { text: this.essay.conclusion, style: 'story', margin: [0, 20, 0, 20] }
- ]
- }
- this.pdfObj = pdfMake.createPdf(docDefinition);
- this.pdfObj.download();
- }
- for(let parag of this.essay.paragraphs){
- console.log(parag.paragraph);
- };
Add Comment
Please, Sign In to add comment