Skip to content

Commit 50d821b

Browse files
committed
Merge branch 'master' of https://github.com/MrRio/jsPDF
2 parents bd6d9fc + e215c1b commit 50d821b

File tree

5 files changed

+44
-3
lines changed

5 files changed

+44
-3
lines changed

SUMMARY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Summary
2+
3+
* [Getting Started](docs/getting_started.md)
4+

bower.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"name": "jspdf",
3-
"version": "1.1.135",
43
"homepage": "https://github.com/mrrio/jspdf",
54
"description": "PDF Document creation from JavaScript",
65
"main": "dist/jspdf.debug.js",

docs/getting_started.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Getting Started
2+
3+
We're currently updating our documentation. Watch this space!
4+
5+
http://mrrio.github.io/jsPDF/doc/symbols/jsPDF.html

plugins/addimage.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,11 @@
413413
* Async method using Blob and FileReader could be best, but i'm not sure how to fit it into the flow?
414414
*/
415415
jsPDFAPI.arrayBufferToBinaryString = function(buffer) {
416+
if('TextDecoder' in window){
417+
var decoder = new TextDecoder('ascii');
418+
return decoder.decode(buffer);
419+
}
420+
416421
if(this.isArrayBuffer(buffer))
417422
buffer = new Uint8Array(buffer);
418423

@@ -586,8 +591,11 @@
586591
* to TypedArray - or should we just leave and process as string?
587592
*/
588593
if(this.supportsArrayBuffer()) {
589-
dataAsBinaryString = imageData;
590-
imageData = this.binaryStringToUint8Array(imageData);
594+
// no need to convert if imageData is already uint8array
595+
if(!(imageData instanceof Uint8Array)){
596+
dataAsBinaryString = imageData;
597+
imageData = this.binaryStringToUint8Array(imageData);
598+
}
591599
}
592600

593601
info = this['process' + format.toUpperCase()](

plugins/prevent_scale_to_fit.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* jsPDF Autoprint Plugin
3+
*
4+
* Licensed under the MIT License.
5+
* http://opensource.org/licenses/mit-license
6+
*/
7+
8+
(function (jsPDFAPI) {
9+
'use strict';
10+
11+
jsPDFAPI.autoPrint = function () {
12+
'use strict'
13+
var refAutoPrintTag;
14+
15+
this.internal.events.subscribe('postPutResources', function () {
16+
refAutoPrintTag = this.internal.newObject()
17+
this.internal.write("<< /S/Named /Type/Action /N/Print >>", "endobj");
18+
});
19+
20+
this.internal.events.subscribe("putCatalog", function () {
21+
this.internal.write("/OpenAction " + refAutoPrintTag + " 0" + " R");
22+
});
23+
return this;
24+
};
25+
})(jsPDF.API);

0 commit comments

Comments
 (0)