Guest User

Untitled

a guest
Jun 18th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. essay = {
  2. "title": "",
  3. "author": { "fullname": "" },
  4. "intro": "",
  5. "conclusion": "",
  6. "paragraphs": [ { "paragraph": "" } ]
  7. }
  8.  
  9. CreatePdf(){
  10. var docDefinition = {
  11. content: [
  12. { text: this.essay.title, style: 'header' },
  13. { text: new Date().toTimeString(), alignment: 'right' },
  14.  
  15. { text: 'Written By : '+this.essay.author.fullname, style: 'subheader' },
  16.  
  17. { text: this.essay.intro, style: 'story', margin: [0, 20, 0, 20] },
  18.  
  19. // Foreach essay.paragraphs and display the value
  20.  
  21. { text: this.essay.conclusion, style: 'story', margin: [0, 20, 0, 20] }
  22. ]
  23. }
  24. this.pdfObj = pdfMake.createPdf(docDefinition);
  25. this.pdfObj.download();
  26. }
  27.  
  28. for(let parag of this.essay.paragraphs){
  29. console.log(parag.paragraph);
  30. };
Add Comment
Please, Sign In to add comment