1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <!doctype html>
- <!--
- /**
- * jsPDF Annotations PlugIn
- * Copyright (c) 2014 Steven Spungin (TwelveTone LLC) steven@twelvetone.tv
- *
- * Licensed under the MIT License.
- * http://opensource.org/licenses/mit-license
- */
- -->
- <html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <title>Annotation Test</title>
- </head>
- <body style='background-color: silver; margin: 0;'>
- <script src="../../dist/jspdf.debug.js"></script>
- <script src="../js/test_harness.js"></script>
- <script>
- var pdf = new jsPDF('p', 'pt', 'letter');
- // Create pages with a table of contents.
- // TOC links to each page
- // Each page links back to TOC and to an external URL
- // Supported magnification Options are included.
- var y = 20;
- var text = 'Table of Contents';
- pdf.text(text, 20, y);
- y += pdf.getLineHeight() * 2;
- for (var i = 2; i < 10; i ++) {
- text = "Page " + i;
- pdf.textWithLink(text, 20, y, {pageNumber:i});
- y += pdf.getLineHeight();
- var x = 20;
- var width = pdf.textWithLink(" [100%]", x, y, {pageNumber:i, magFactor:'XYZ', zoom:1});
- x += width;
- var width = pdf.textWithLink(" [200%]", x, y, {pageNumber:i, magFactor:'XYZ', zoom:2});
- x += width;
- var width = pdf.textWithLink(" [50%]", x, y, {pageNumber:i, magFactor:'XYZ', zoom:.5});
- x += width;
- var width = pdf.textWithLink(" [Fit]", x, y, {pageNumber:i, magFactor:'Fit'});
- x += width;
- var width = pdf.textWithLink(" [FitH]", x, y, {pageNumber:i, magFactor:'FitH'});
- x += width;
- var width = pdf.textWithLink(" [FitV]", x, y, {pageNumber:i, magFactor:'FitV'});
- y += pdf.getLineHeight();
- }
- // Create Test Pages
- for (var i = 2; i < 10; i++){
- pdf.addPage();
- y = 20;
- var text = 'Page ' + i;
- pdf.text(text, 20, y);
- y += pdf.getLineHeight() * 2;
- text = "Goto First Page";
- pdf.textWithLink(text, 20, y, {pageNumber:1});
- y += pdf.getLineHeight();
- text = "Goto External URL";
- pdf.textWithLink(text, 20, y, {
- url: 'https://parall.ax/'
- });
- y += pdf.getLineHeight();
- }
- var message = 'Chrome default PDF reader currently does not support magFactor links, \
- although links still work after manualy changing magFactor. <br /> \
- Firefox has a bug displaying annotations after the magFactor changes, but links do work. <br /> \
- To test magFactor links [...] without bugs, use Adobe Reader or compatible application.';
- pdf_test_harness_init(pdf, message);
- </script>
- </body>
- </html>
|