test_annotation_2.html 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <!doctype html>
  2. <!--
  3. /**
  4. * jsPDF Annotations PlugIn
  5. * Copyright (c) 2014 Steven Spungin (TwelveTone LLC) steven@twelvetone.tv
  6. *
  7. * Licensed under the MIT License.
  8. * http://opensource.org/licenses/mit-license
  9. */
  10. -->
  11. <html>
  12. <head>
  13. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  14. <title>Annotation Test - Text</title>
  15. </head>
  16. <body style='background-color: silver; margin: 0;'>
  17. <script src="../../dist/jspdf.debug.js"></script>
  18. <script src="../js/test_harness.js"></script>
  19. <script>
  20. var pdf = new jsPDF('p', 'pt', 'letter');
  21. var y = 20;
  22. var w;
  23. var text = 'Text Annotations';
  24. pdf.text(text, 20, y);
  25. pdf.setFontSize(12);
  26. y += pdf.getLineHeight() * 2;
  27. pdf.text("Text Annotation With Popup (closed)", 20, y);
  28. pdf.createAnnotation({
  29. type : 'text',
  30. title: 'note',
  31. bounds : {
  32. x : 0,
  33. y : y,
  34. w : 200,
  35. h : 80
  36. },
  37. contents : 'This is text annotation (closed by default)',
  38. open : false
  39. });
  40. y += pdf.getLineHeight() * 5;
  41. pdf.text("Text Annotation With Popup (opened)", 20, y);
  42. pdf.createAnnotation({
  43. type : 'text',
  44. title: 'another note',
  45. bounds : {
  46. x : 0,
  47. y : y,
  48. w : 200,
  49. h : 80
  50. },
  51. contents : 'This is a text annotation (opened)',
  52. open : true
  53. });
  54. y += pdf.getLineHeight() * 5;
  55. pdf.text("Free Text Annotation", 20, y);
  56. pdf.createAnnotation({
  57. type : 'freetext',
  58. bounds : {
  59. x : 0,
  60. y : y + 10,
  61. w : 200,
  62. h : 20
  63. },
  64. contents : 'This is a freetext annotation',
  65. color : '#ff0000'
  66. });
  67. var warning = 'Most web browsers do not display annotations. Download the PDF and open in Adobe Reader, etc).'
  68. pdf_test_harness_init(pdf, warning);
  69. </script>
  70. </body>
  71. </html>