Skip to content

Commit

Permalink
Refactor jspdf.plugin.* to plugins/*
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRio committed May 15, 2015
1 parent 53f2f29 commit e24fab2
Show file tree
Hide file tree
Showing 30 changed files with 243 additions and 235 deletions.
2 changes: 1 addition & 1 deletion MIT-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2010-2014 James Hall, https://github.com/MrRio/jsPDF
Copyright (c) 2010-2015 James Hall, https://github.com/MrRio/jsPDF

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"libs",
"CNAME",
"jspdf.js",
"jspdf.PLUGINTEMPLATE.js",
"jspdf.plugin.*",
"examples/jspdf.PLUGINTEMPLATE.js",
"plugins/*",
"todo.txt",
"wscript.py",
"build.sh",
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ output=dist/jspdf.min.js
options="-m -c --wrap --stats"
version="`python -c 'import time;t=time.gmtime(time.time());print("1.%d.%d" % (t[0] - 2014, t[7]))'`"
libs="`find libs/* -maxdepth 2 -type f | grep .js$ | grep -v -E '(\.min|BlobBuilder\.js$|Downloadify|demo|deps|test)'`"
files="jspdf.js jspdf.plugin*js"
files="jspdf.js plugins/*js"
build=`date +%Y-%m-%dT%H:%M`
commit=`git rev-parse --short=10 HEAD`
whoami=`whoami`
Expand Down Expand Up @@ -49,7 +49,7 @@ for fn in ${files} ${libs}; do
| sed -e 'H;${x;s/\s*@preserve/ /g;p;};d' \
| sed -e 's/\s*===\+//' \
| grep -v *global > ${output}.x

if test "x$fn" = "xjspdf.js"; then
cat ${output}.x \
| sed s/\${versionID}/${version}-git\ Built\ on\ ${build}/ \
Expand Down
40 changes: 20 additions & 20 deletions examples/annotation/test_annotation.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
*/
-->

<html>
Expand All @@ -20,10 +20,10 @@
<script>
require_baseUrl_override = '../../';
require(['../../libs/require/config'], function(){
require(['jspdf.plugin.annotations', 'examples/js/test_harness'], function(){
require(['plugins/annotations', 'examples/js/test_harness'], function(){

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
Expand All @@ -32,55 +32,55 @@
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;
x += width;
var width = pdf.textWithLink(" [200%]", x, y, {pageNumber:i, magFactor:'XYZ', zoom:2});
x += width;
x += width;
var width = pdf.textWithLink(" [50%]", x, y, {pageNumber:i, magFactor:'XYZ', zoom:.5});
x += width;
x += width;
var width = pdf.textWithLink(" [Fit]", x, y, {pageNumber:i, magFactor:'Fit'});
x += width;
x += width;
var width = pdf.textWithLink(" [FitH]", x, y, {pageNumber:i, magFactor:'FitH'});
x += width;
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();
y += pdf.getLineHeight();

text = "Goto External URL";
pdf.textWithLink(text, 20, y, {url:'http://www.twelvetone.tv'});
y += pdf.getLineHeight();
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);

}); // require
}); // require

</script>

</head>
Expand Down
8 changes: 4 additions & 4 deletions examples/annotation/test_annotation_2.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
*/
-->

<html>
Expand All @@ -19,14 +19,14 @@
<script>
require_baseUrl_override = '../../';
require(['../../libs/require/config'], function(){
require(['jspdf.plugin.annotations', 'examples/js/test_harness'], function(){
require(['plugins/annotations', 'examples/js/test_harness'], function(){

var pdf = new jsPDF('p', 'pt', 'letter');
var y = 20;
var w;
var text = 'Text Annotations';
pdf.text(text, 20, y);

pdf.setFontSize(12);

y += pdf.getLineHeight() * 2;
Expand Down Expand Up @@ -75,7 +75,7 @@

var warning = 'Most web browsers do not display annotations. Download the PDF and open in Adobe Reader, etc).'
pdf_test_harness_init(pdf, warning);

}); // require
}); // require
</script>
Expand Down
Loading

0 comments on commit e24fab2

Please sign in to comment.