Skip to content

Commit 5522d26

Browse files
committed
Merge
2 parents 0ffc486 + 32b4088 commit 5522d26

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

jspdf.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* 2014 James Makes, https://github.com/dollaruw
1919
* 2014 Diego Casorran, https://github.com/diegocr
2020
* 2014 Steven Spungin, https://github.com/Flamenco
21+
* 2014 Kenneth Glassey, https://github.com/Gavvers
2122
*
2223
* Permission is hereby granted, free of charge, to any person obtaining
2324
* a copy of this software and associated documentation files (the
@@ -181,7 +182,7 @@ var jsPDF = (function(global) {
181182
currentPage,
182183
pages = [],
183184
pagesContext = [], // same index as pages and pagedim
184-
pagedim = {},
185+
pagedim = [],
185186
content = [],
186187
additionalObjects = [],
187188
lineCapID = 0,
@@ -736,6 +737,17 @@ var jsPDF = (function(global) {
736737
}
737738
events.publish('addPage', { pageNumber : page });
738739
},
740+
_deletePage = function( n ) {
741+
if (n > 0 && n <= page) {
742+
pages.splice(n, 1);
743+
pagedim.splice(n, 1);
744+
page--;
745+
if (currentPage > page){
746+
currentPage = page;
747+
}
748+
this.setPage(currentPage);
749+
}
750+
},
739751
_setPage = function(n) {
740752
if (n > 0 && n <= page) {
741753
currentPage = n;
@@ -1085,17 +1097,9 @@ var jsPDF = (function(global) {
10851097
}
10861098
return this;
10871099
};
1088-
API.deletePage = function(targetPage) {
1089-
for (var i=targetPage; i< page; i++){
1090-
pages[i] = pages[i+1];
1091-
pagedim[i] = pagedim[i+1];
1092-
pagesContext[i] = pagesContext[i+1];
1093-
}
1094-
page--;
1095-
if (currentPage > page){
1096-
currentPage = page;
1097-
}
1098-
this.setPage(currentPage);
1100+
1101+
API.deletePage = function() {
1102+
_deletePage.apply( this, arguments );
10991103
return this;
11001104
};
11011105
API.setDisplayMode = function(zoom, layout, pmode) {

libs/Blob.js

0 commit comments

Comments
 (0)