font-faces.js 928 B

123456789101112131415161718192021222324252627282930
  1. var doc = new jsPDF();
  2. doc.text(20, 20, 'This is the default font.');
  3. doc.setFont("courier");
  4. doc.setFontType("normal");
  5. doc.text(20, 30, 'This is courier normal.');
  6. doc.setFont("times");
  7. doc.setFontType("italic");
  8. doc.text(20, 40, 'This is times italic.');
  9. doc.setFont("helvetica");
  10. doc.setFontType("bold");
  11. doc.text(20, 50, 'This is helvetica bold.');
  12. doc.setFont("courier");
  13. doc.setFontType("bolditalic");
  14. doc.text(20, 60, 'This is courier bolditalic.');
  15. doc.setFont("times");
  16. doc.setFontType("normal");
  17. doc.text(105, 80, 'This is centred text.', null, null, 'center');
  18. doc.text(105, 90, 'And a little bit more underneath it.', null, null, 'center');
  19. doc.text(200, 100, 'This is right aligned text', null, null, 'right');
  20. doc.text(200, 110, 'And some more', null, null, 'right');
  21. doc.text(20, 120, 'Back to left');
  22. doc.text(20, 140, '10 degrees rotated', null, 10);
  23. doc.text(20, 160, '-10 degrees rotated', null, -10);