rectangles.js 650 B

123456789101112131415161718192021222324252627282930
  1. var doc = new jsPDF();
  2. // Empty square
  3. doc.rect(20, 20, 10, 10);
  4. // Filled square
  5. doc.rect(40, 20, 10, 10, 'F');
  6. // Empty red square
  7. doc.setDrawColor(255,0,0);
  8. doc.rect(60, 20, 10, 10);
  9. // Filled square with red borders
  10. doc.setDrawColor(255,0,0);
  11. doc.rect(80, 20, 10, 10, 'FD');
  12. // Filled red square
  13. doc.setDrawColor(0);
  14. doc.setFillColor(255,0,0);
  15. doc.rect(100, 20, 10, 10, 'F');
  16. // Filled red square with black borders
  17. doc.setDrawColor(0);
  18. doc.setFillColor(255,0,0);
  19. doc.rect(120, 20, 10, 10, 'FD');
  20. // Black square with rounded corners
  21. doc.setDrawColor(0);
  22. doc.setFillColor(255, 255, 255);
  23. doc.roundedRect(140, 20, 10, 10, 3, 3, 'FD');