Skip to content

Commit dae206a

Browse files
committed
Start improving the documentation
1 parent e9060d0 commit dae206a

16 files changed

Lines changed: 57 additions & 23 deletions

README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,34 @@ You can [catch me on twitter](http://twitter.com/MrRio): [@MrRio](http://twitter
1010

1111
## Creating your first document
1212

13-
See examples/basic.html. There's a live editor example at index.html.
13+
The easiest way to get started is to drop the CDN hosted library into your page:
14+
15+
```html
16+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js"></script>
17+
```
18+
19+
Then you're ready to start making your document:
1420

1521
```javascript
16-
var doc = new jsPDF();
17-
doc.text(20, 20, 'Hello world.');
18-
doc.save('Test.pdf');
22+
// Default export is a4 paper, portrait, using milimeters for units
23+
var doc = new jsPDF()
24+
25+
doc.text('Hello world!', 10, 10)
26+
doc.save('a4.pdf')
27+
```
28+
29+
If you want to change the paper size, orientation, or units, you can do:
30+
31+
```javascript
32+
// Landscape export, 2×4 inches
33+
var doc = new jsPDF({
34+
orientation: 'landscape',
35+
unit: 'in',
36+
format: [4, 2]
37+
})
38+
39+
doc.text('Hello world!', 10, 10)
40+
doc.save('two-by-four.pdf')
1941
```
2042

2143
**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.**

docs/global.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5277,7 +5277,7 @@ <h5>Returns:</h5>
52775277
<br class="clear">
52785278

52795279
<footer>
5280-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sat Oct 08 2016 22:04:02 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
5280+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sun Oct 09 2016 08:16:00 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
52815281
</footer>
52825282

52835283
<script>prettyPrint();</script>

docs/index.html

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,22 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="jsPDF.htm
5050
<p><a href="https://codeclimate.com/repos/57f943855cdc43705e00592f/feed"><img src="https://codeclimate.com/repos/57f943855cdc43705e00592f/badges/2665cddeba042dc5191f/gpa.svg" alt="Code Climate"></a> <a href="https://codeclimate.com/repos/57f943855cdc43705e00592f/coverage"><img src="https://codeclimate.com/repos/57f943855cdc43705e00592f/badges/2665cddeba042dc5191f/coverage.svg" alt="Test Coverage"></a></p>
5151
<p><strong>A library to generate PDFs in client-side JavaScript.</strong></p>
5252
<p>You can <a href="http://twitter.com/MrRio">catch me on twitter</a>: <a href="http://twitter.com/MrRio">@MrRio</a> or head over to <a href="http://parall.ax">my company's website</a> for consultancy.</p>
53-
<h2>Creating your first document</h2><p>See examples/basic.html. There's a live editor example at index.html.</p>
54-
<pre class="prettyprint source lang-javascript"><code>var doc = new jsPDF();
55-
doc.text(20, 20, 'Hello world.');
56-
doc.save('Test.pdf');</code></pre><p><strong>Head over to <a href="http://jspdf.com">jsPDF.com</a> for details or <a href="http://mrrio.github.io/jsPDF/"><em>here</em></a> for our most recent live editor and examples.</strong></p>
53+
<h2>Creating your first document</h2><p>The easiest way to get started is to drop the CDN hosted library into your page:</p>
54+
<pre class="prettyprint source lang-html"><code>&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js&quot;>&lt;/script></code></pre><p>Then you're ready to start making your document:</p>
55+
<pre class="prettyprint source lang-javascript"><code>// Default export is a4 paper, portrait, using milimeters for units
56+
var doc = new jsPDF()
57+
58+
doc.text('Hello world!', 10, 10)
59+
doc.save('a4.pdf')</code></pre><p>If you want to change the paper size, orientation, or units, you can do:</p>
60+
<pre class="prettyprint source lang-javascript"><code>// Landscape export, 2×4 inches
61+
var doc = new jsPDF({
62+
orientation: 'landscape',
63+
unit: 'in',
64+
format: [4, 2]
65+
})
66+
67+
doc.text('Hello world!', 10, 10)
68+
doc.save('two-by-four.pdf')</code></pre><p><strong>Head over to <a href="http://jspdf.com">jsPDF.com</a> for details or <a href="http://mrrio.github.io/jsPDF/"><em>here</em></a> for our most recent live editor and examples.</strong></p>
5769
<h2>Contributing</h2><p>Build the library with <code>npm run build</code>. This will fetch all dependencies and then compile the <code>dist</code> files. To see the examples locally you can start a web server with <code>npm start</code> and go to <code>localhost:8000</code>.</p>
5870
<h2>Credits</h2><ul>
5971
<li>Big thanks to Daniel Dotsenko from <a href="http://willow-systems.com">Willow Systems Corporation</a> for making huge contributions to the codebase.</li>
@@ -89,7 +101,7 @@ <h2>License (MIT)</h2><p>Copyright (c) 2010-2016 James Hall, https://github.com/
89101
<br class="clear">
90102

91103
<footer>
92-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sat Oct 08 2016 22:04:02 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
104+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sun Oct 09 2016 08:16:00 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
93105
</footer>
94106

95107
<script>prettyPrint();</script>

docs/jsPDF.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ <h5>Example</h5>
349349
<br class="clear">
350350

351351
<footer>
352-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sat Oct 08 2016 22:04:02 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
352+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sun Oct 09 2016 08:16:00 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
353353
</footer>
354354

355355
<script>prettyPrint();</script>

docs/jspdf.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2308,7 +2308,7 @@ <h1 class="page-title">jspdf.js</h1>
23082308
<br class="clear">
23092309

23102310
<footer>
2311-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sat Oct 08 2016 22:04:02 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2311+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sun Oct 09 2016 08:16:00 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
23122312
</footer>
23132313

23142314
<script>prettyPrint();</script>

docs/plugins_acroform.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,7 @@ <h1 class="page-title">plugins/acroform.js</h1>
17491749
<br class="clear">
17501750

17511751
<footer>
1752-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sat Oct 08 2016 22:04:02 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1752+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sun Oct 09 2016 08:16:00 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
17531753
</footer>
17541754

17551755
<script>prettyPrint();</script>

docs/plugins_addhtml.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ <h1 class="page-title">plugins/addhtml.js</h1>
165165
<br class="clear">
166166

167167
<footer>
168-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sat Oct 08 2016 22:04:02 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
168+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sun Oct 09 2016 08:16:00 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
169169
</footer>
170170

171171
<script>prettyPrint();</script>

docs/plugins_addimage.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ <h1 class="page-title">plugins/addimage.js</h1>
781781
<br class="clear">
782782

783783
<footer>
784-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sat Oct 08 2016 22:04:02 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
784+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sun Oct 09 2016 08:16:00 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
785785
</footer>
786786

787787
<script>prettyPrint();</script>

docs/plugins_annotations.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ <h1 class="page-title">plugins/annotations.js</h1>
339339
<br class="clear">
340340

341341
<footer>
342-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sat Oct 08 2016 22:04:02 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
342+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sun Oct 09 2016 08:16:00 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
343343
</footer>
344344

345345
<script>prettyPrint();</script>

docs/plugins_cell.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ <h1 class="page-title">plugins/cell.js</h1>
461461
<br class="clear">
462462

463463
<footer>
464-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sat Oct 08 2016 22:04:02 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
464+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Sun Oct 09 2016 08:16:00 GMT+0100 (BST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
465465
</footer>
466466

467467
<script>prettyPrint();</script>

0 commit comments

Comments
 (0)