Skip to content

Commit

Permalink
Added 'arraybuffer' output type - related to #207
Browse files Browse the repository at this point in the history
  • Loading branch information
diegocr committed Apr 16, 2014
1 parent 41ec70e commit ddbfc0f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jspdf",
"version": "1.0.104",
"version": "1.0.106",
"homepage": "https://github.com/mrrio/jspdf",
"description": "PDF Document creation from JavaScript",
"main": "dist/jspdf.min.js",
Expand Down
15 changes: 10 additions & 5 deletions dist/jspdf.debug.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @preserve
* jsPDF - PDF Document creation from JavaScript
* Version 1.0.104-git Built on 2014-04-14T04:50
* CommitID 077bd24022
* Version 1.0.106-git Built on 2014-04-16T20:28
* CommitID 71dbc3a379
*
* Copyright (c) 2010-2014 James Hall, https://github.com/MrRio/jsPDF
* 2010 Aaron Spike, https://github.com/acspike
Expand Down Expand Up @@ -728,12 +728,15 @@ var jsPDF = (function(global) {
}
return op;
},
getBlob = function() {
getArrayBuffer = function() {
var data = buildDocument(), len = data.length,
ab = new ArrayBuffer(len), u8 = new Uint8Array(ab);

while(len--) u8[len] = data.charCodeAt(len);
return new Blob([ab], { type : "application/pdf" });
return ab;
},
getBlob = function() {
return new Blob([getArrayBuffer()], { type : "application/pdf" });
},
/**
* Generates the PDF document.
Expand Down Expand Up @@ -765,6 +768,8 @@ var jsPDF = (function(global) {
}
}
break;
case 'arraybuffer':
return getArrayBuffer();
case 'blob':
return getBlob();
case 'datauristring':
Expand Down Expand Up @@ -1690,7 +1695,7 @@ var jsPDF = (function(global) {
* pdfdoc.mymethod() // <- !!!!!!
*/
jsPDF.API = {events:[]};
jsPDF.version = "1.0.104-debug 2014-04-14T04:50:diegocr";
jsPDF.version = "1.0.106-debug 2014-04-16T20:28:diegocr";

if (typeof define === 'function') {
define(function() {
Expand Down
6 changes: 3 additions & 3 deletions dist/jspdf.min.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions jspdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -728,12 +728,15 @@ var jsPDF = (function(global) {
}
return op;
},
getBlob = function() {
getArrayBuffer = function() {
var data = buildDocument(), len = data.length,
ab = new ArrayBuffer(len), u8 = new Uint8Array(ab);

while(len--) u8[len] = data.charCodeAt(len);
return new Blob([ab], { type : "application/pdf" });
return ab;
},
getBlob = function() {
return new Blob([getArrayBuffer()], { type : "application/pdf" });
},
/**
* Generates the PDF document.
Expand Down Expand Up @@ -765,6 +768,8 @@ var jsPDF = (function(global) {
}
}
break;
case 'arraybuffer':
return getArrayBuffer();
case 'blob':
return getBlob();
case 'datauristring':
Expand Down

0 comments on commit ddbfc0f

Please sign in to comment.