Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
.DS_Store
node_modules/
15 changes: 0 additions & 15 deletions .gitmodules

This file was deleted.

5 changes: 0 additions & 5 deletions Makefile

This file was deleted.

36 changes: 6 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,22 @@ You can [catch me on twitter](http://twitter.com/MrRio): [@MrRio](http://twitter
See examples/basic.html. There's a live editor example at index.html.

```javascript

var doc = new jsPDF();
doc.text(20, 20, 'Hello world.');
doc.save('Test.pdf');
```

**Head over to [jsPDF.com](http://jspdf.com) for details or [_here_](http://mrrio.github.io/jsPDF/) for our most recent live editor and examples.**

## Checking out the source

```bash
git clone --recursive git://github.com/MrRio/jsPDF.git
```

## Building

To build, simply run the 'make' command. This will fetch all npm and bower deps, then compile minified JS files.

## Running locally

Due to certain restrictions that local files have, you'll need to run a web server. Just run:

```
npm start
```

You can then access the site at localhost:8000
## Contributing
Build the library with `npm run build`. This will fetch all dependencies and then compile the `dist` files. To see the examples locally you can start a web server with `npm start` and go to `localhost:8000`.

## Credits
- Big thanks to Daniel Dotsenko from [Willow Systems Corporation](http://willow-systems.com) for making huge contributions to the codebase.
- Thanks to Ajaxian.com for [featuring us back in 2009](http://ajaxian.com/archives/dynamically-generic-pdfs-with-javascript).
- Everyone else that's contributed patches or bug reports. You rock.

Big thanks to Daniel Dotsenko from [Willow Systems Corporation](http://willow-systems.com) for making huge contributions to the codebase.

Thanks to Ajaxian.com for [featuring us back in 2009](http://ajaxian.com/archives/dynamically-generic-pdfs-with-javascript).

Everyone else that's contributed patches or bug reports. You rock.

## License

(MIT License)

## License (MIT)
Copyright (c) 2010-2016 James Hall, https://github.com/MrRio/jsPDF

Permission is hereby granted, free of charge, to any person obtaining
Expand Down
18 changes: 6 additions & 12 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,27 @@

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)'`"
version="$(node -p -e "require('./package.json').version")"
npm_libs="node_modules/cf-blob.js/Blob.js node_modules/filesaver.js/FileSaver.js node_modules/adler32cs/adler32cs.js"
libs="${npm_libs} `find libs/* -maxdepth 2 -type f | grep .js$ | grep -v -E '(\.min|BlobBuilder\.js$|Downloadify|demo|deps|test)'`"
files="jspdf.js plugins/*js"
build=`date +%Y-%m-%dT%H:%M`
commit=`git rev-parse --short=10 HEAD`
whoami=`whoami`

# Update submodules
git submodule init libs/FileSaver.js/
git submodule init libs/adler32cs.js/
git submodule init libs/Blob.js/

git submodule foreach git pull origin master

echo "Building version ${version}"

# Update Bower
sed -i.bak "s/\"version\": \"(.*)\"/\"${version}\"/" bower.json

# Fix conflict with adler32 & FileSaver
adler1="libs/adler32cs.js/adler32cs.js"
adler1="node_modules/adler32cs/adler32cs.js"
adler2="adler32-tmp.js"
cat ${adler1} \
| sed -e 's/this, function/jsPDF, function/' \
| sed -e 's/typeof define/0/' > $adler2
libs="$(echo $libs | sed "s#$adler1#$adler2#")"
saveas1="libs/FileSaver.js/FileSaver.js"
saveas1="node_modules/filesaver.js/FileSaver.js"
saveas2="FileSaver-tmp.js"
cat ${saveas1} \
| sed -e 's/define !== null) && (define.amd != null/0/' > $saveas2
Expand All @@ -44,7 +38,7 @@ cat ${files} ${libs} \
| sed s/\${versionID}/${version}-git\ Built\ on\ ${build}/ \
| sed s/\${commitID}/${commit}/ \
| sed "s/\"1\.0\.0-trunk\"/\"${version}-debug ${build}:${whoami}\"/" > "$(echo $output | sed s/min/debug/)"
uglifyjs ${options} -o ${output} ${files} ${libs}
./node_modules/.bin/uglifyjs ${options} -o ${output} ${files} ${libs}

# Pretend license information to minimized file
for fn in ${files} ${libs}; do
Expand Down
1 change: 0 additions & 1 deletion libs/Blob.js
Submodule Blob.js deleted from 0cef27
1 change: 0 additions & 1 deletion libs/FileSaver.js
Submodule FileSaver.js deleted from 230de7
1 change: 0 additions & 1 deletion libs/adler32cs.js
Submodule adler32cs.js deleted from c6576b
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@
},
"dependencies": {},
"devDependencies": {
"local-web-server": "^0.5.19"
"adler32cs": "github:chick307/adler32cs.js",
"cf-blob.js": "0.0.1",
"filesaver.js": "github:andyinabox/FileSaver.js",
"local-web-server": "^0.5.19",
"uglify-js": "^2.6.2"
},
"scripts": {
"start": "ws"
"start": "ws",
"build": "npm install && bower install && ./build.sh",
"version": "npm run build && git add -A dist"
}
}