Skip to content

Commit e438e4f

Browse files
committed
Fixed parallax#186
1 parent 482b0a2 commit e438e4f

6 files changed

Lines changed: 79 additions & 109 deletions

dist/jspdf.min.js

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jspdf.source.js

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @preserve
22
* jsPDF - PDF Document creation from JavaScript
3-
* Version 1.0.0-trunk Built on 2014-02-08T18:40
4-
* Commit 212f46d0c292a398bfce151a872e8ab6fe34d637
3+
* Version 1.0.0-trunk Built on 2014-02-10T00:12
4+
* Commit 482b0a27829ec96d0c5583ba22c9c010be47b7b1
55
*
66
* Copyright (c) 2010-2014 James Hall, https://github.com/MrRio/jsPDF
77
* 2010 Aaron Spike, https://github.com/acspike
@@ -2237,35 +2237,24 @@ jsPDFAPI.addImage = function(imageData, format, x, y, w, h, alias) {
22372237
return this
22382238
}
22392239
})(jsPDF.API);
2240-
(function(jsPDFAPI) {
2241-
'use strict'
2240+
(function (jsPDFAPI) {
2241+
'use strict';
22422242

2243-
jsPDFAPI.autoPrint = function() {
2244-
'use strict'
2245-
// `this` is _jsPDF object returned when jsPDF is inited (new jsPDF())
2246-
// `this.internal` is a collection of useful, specific-to-raw-PDF-stream functions.
2247-
// for example, `this.internal.write` function allowing you to write directly to PDF stream.
2248-
// `this.line`, `this.text` etc are available directly.
2249-
// so if your plugin just wraps complex series of this.line or this.text or other public API calls,
2250-
// you don't need to look into `this.internal`
2251-
// See _jsPDF object in jspdf.js for complete list of what's available to you.
2252-
var refAutoPrintTag;
2253-
2254-
this.internal.events.subscribe('postPutResources', function(){
2255-
refAutoPrintTag = this.internal.newObject()
2256-
this.internal.write("<< /S/Named /Type/Action /N/Print >>", "endobj");
2257-
})
2258-
2259-
this.internal.events.subscribe("putCatalog", function(){
2260-
this.internal.write("/OpenAction " + refAutoPrintTag + " 0" + " R");
2261-
});
2262-
2263-
// it is good practice to return ref to jsPDF instance to make
2264-
// the calls chainable.
2265-
return this;
2266-
}
2243+
jsPDFAPI.autoPrint = function () {
2244+
'use strict'
2245+
var refAutoPrintTag;
2246+
2247+
this.internal.events.subscribe('postPutResources', function () {
2248+
refAutoPrintTag = this.internal.newObject()
2249+
this.internal.write("<< /S/Named /Type/Action /N/Print >>", "endobj");
2250+
});
22672251

2268-
})(jsPDF.API)
2252+
this.internal.events.subscribe("putCatalog", function () {
2253+
this.internal.write("/OpenAction " + refAutoPrintTag + " 0" + " R");
2254+
});
2255+
return this;
2256+
};
2257+
})(jsPDF.API);
22692258
/** ====================================================================
22702259
* jsPDF Cell plugin
22712260
* Copyright (c) 2013 Youssef Beddad, youssef.beddad@gmail.com
@@ -2668,7 +2657,7 @@ jsPDFAPI.autoPrint = function() {
26682657
tmpArray = [].concat(tableHeaderCell);
26692658
this.cell.apply(this, tmpArray.concat(lineNumber));
26702659
}
2671-
if (tempHeaderConf.lenght > 0){
2660+
if (tempHeaderConf.length > 0){
26722661
this.setTableHeaderRow(tempHeaderConf);
26732662
}
26742663
this.setFontStyle('normal');
@@ -2678,8 +2667,9 @@ jsPDFAPI.autoPrint = function() {
26782667
})(jsPDF.API);
26792668
/** @preserve
26802669
* jsPDF fromHTML plugin. BETA stage. API subject to change. Needs browser, jQuery
2681-
* Copyright (c) 2012 2012 Willow Systems Corporation, willow-systems.com
2670+
* Copyright (c) 2012 Willow Systems Corporation, willow-systems.com
26822671
* 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria
2672+
* 2014 Diego Casorran, https://github.com/diegocr
26832673
*
26842674
* Permission is hereby granted, free of charge, to any person obtaining
26852675
* a copy of this software and associated documentation files (the
@@ -2888,6 +2878,13 @@ jsPDFAPI.autoPrint = function() {
28882878
headers: headers
28892879
};
28902880
};
2881+
var SkipNode = {
2882+
SCRIPT : 1,
2883+
STYLE : 1,
2884+
NOSCRIPT : 1,
2885+
OBJECT : 1,
2886+
EMBED : 1
2887+
};
28912888
DrillForContent = function(element, renderer, elementHandlers) {
28922889
var cn, cns, fragmentCSS, i, isBlock, l, px2pt, table2json;
28932890
cns = element.childNodes;
@@ -2909,7 +2906,7 @@ jsPDFAPI.autoPrint = function() {
29092906
renderer.pdf.addPage();
29102907
renderer.y = renderer.pdf.margins_doc.top;
29112908
}
2912-
} else if (cn.nodeType === 1 && cn.nodeName !== "SCRIPT") {
2909+
} else if (cn.nodeType === 1 && !SkipNode[cn.nodeName]) {
29132910
if (cn.nodeName === "IMG") {
29142911
if ((renderer.pdf.internal.pageSize.height - renderer.pdf.margins_doc.bottom < renderer.y + cn.height) && (renderer.y > renderer.pdf.margins_doc.top)) {
29152912
renderer.pdf.addPage();
@@ -2979,7 +2976,9 @@ jsPDFAPI.autoPrint = function() {
29792976
return;
29802977
}
29812978
a = drill.call(this, element, renderer, elementHandlers);
2979+
cb = cb || function() {};
29822980
return cb(renderer.dispose());
2981+
// TODO: This is too bloated, rewrite it
29832982
});
29842983
};
29852984
getImageFromUrl = function(url, callback) {
@@ -3236,11 +3235,10 @@ jsPDFAPI.autoPrint = function() {
32363235
@param settings {Object} Additional / optional variables controlling parsing, rendering.
32373236
@returns {Object} jsPDF instance
32383237
*/
3239-
32403238
};
32413239
return jsPDFAPI.fromHTML = function(HTML, x, y, settings, callback, margins) {
32423240
"use strict";
3243-
this.margins_doc = margins;
3241+
this.margins_doc = margins || {top:0,bottom:0};
32443242
return process(this, HTML, x, y, settings, callback);
32453243
};
32463244
})(jsPDF.API);
@@ -3424,7 +3422,7 @@ jsPDFAPI.addSVG = function(svgtext, x, y, w, h) {
34243422
return this
34253423
}
34263424

3427-
})(jsPDF.API)
3425+
})(jsPDF.API);
34283426
/** @preserve
34293427
jsPDF split_text_to_size plugin
34303428
Copyright (c) 2012 Willow Systems Corporation, willow-systems.com
@@ -4520,7 +4518,7 @@ API.events.push([
45204518
tmpArray = [].concat(tableHeaderCell);
45214519
this.cell.apply(this, tmpArray.concat(lineNumber));
45224520
}
4523-
if (tempHeaderConf.lenght > 0){
4521+
if (tempHeaderConf.length > 0){
45244522
this.setTableHeaderRow(tempHeaderConf);
45254523
}
45264524
this.setFontStyle('normal');

jspdf.PLUGINTEMPLATE.js

Lines changed: 21 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,27 @@
1-
/** ====================================================================
1+
/**
22
* jsPDF [NAME] plugin
3-
* Copyright (c) 2013 [YOUR NAME HERE] [WAY TO CONTACT YOU HERE]
4-
*
5-
* Permission is hereby granted, free of charge, to any person obtaining
6-
* a copy of this software and associated documentation files (the
7-
* "Software"), to deal in the Software without restriction, including
8-
* without limitation the rights to use, copy, modify, merge, publish,
9-
* distribute, sublicense, and/or sell copies of the Software, and to
10-
* permit persons to whom the Software is furnished to do so, subject to
11-
* the following conditions:
12-
*
13-
* The above copyright notice and this permission notice shall be
14-
* included in all copies or substantial portions of the Software.
15-
*
16-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19-
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20-
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21-
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22-
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23-
* ====================================================================
3+
* Copyright (c) 2014 [YOUR NAME HERE] [WAY TO CONTACT YOU HERE]
4+
*
5+
* Licensed under the MIT License.
6+
* http://opensource.org/licenses/mit-license
247
*/
258

26-
(function(jsPDFAPI) {
27-
'use strict'
9+
(function (jsPDFAPI) {
10+
'use strict';
2811

29-
jsPDFAPI.myFunction = function(args) {
30-
'use strict'
31-
// `this` is _jsPDF object returned when jsPDF is inited (new jsPDF())
32-
// `this.internal` is a collection of useful, specific-to-raw-PDF-stream functions.
33-
// for example, `this.internal.write` function allowing you to write directly to PDF stream.
34-
// `this.line`, `this.text` etc are available directly.
35-
// so if your plugin just wraps complex series of this.line or this.text or other public API calls,
36-
// you don't need to look into `this.internal`
37-
// See _jsPDF object in jspdf.js for complete list of what's available to you.
12+
jsPDFAPI.myFunction = function (args) {
13+
'use strict';
14+
// `this` is _jsPDF object returned when jsPDF is inited (new jsPDF())
15+
// `this.internal` is a collection of useful, specific-to-raw-PDF-stream functions.
16+
// for example, `this.internal.write` function allowing you to write directly to PDF stream.
17+
// `this.line`, `this.text` etc are available directly.
18+
// so if your plugin just wraps complex series of this.line or this.text or other public API calls,
19+
// you don't need to look into `this.internal`
20+
// See _jsPDF object in jspdf.js for complete list of what's available to you.
3821

3922

40-
// it is good practice to return ref to jsPDF instance to make
41-
// the calls chainable.
42-
return this
43-
}
44-
45-
})(jsPDF.API)
23+
// it is good practice to return ref to jsPDF instance to make
24+
// the calls chainable.
25+
return this;
26+
};
27+
})(jsPDF.API);

jspdf.plugin.autoprint.js

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
1-
(function(jsPDFAPI) {
2-
'use strict'
1+
(function (jsPDFAPI) {
2+
'use strict';
33

4-
jsPDFAPI.autoPrint = function() {
5-
'use strict'
6-
// `this` is _jsPDF object returned when jsPDF is inited (new jsPDF())
7-
// `this.internal` is a collection of useful, specific-to-raw-PDF-stream functions.
8-
// for example, `this.internal.write` function allowing you to write directly to PDF stream.
9-
// `this.line`, `this.text` etc are available directly.
10-
// so if your plugin just wraps complex series of this.line or this.text or other public API calls,
11-
// you don't need to look into `this.internal`
12-
// See _jsPDF object in jspdf.js for complete list of what's available to you.
13-
var refAutoPrintTag;
4+
jsPDFAPI.autoPrint = function () {
5+
'use strict'
6+
var refAutoPrintTag;
147

15-
this.internal.events.subscribe('postPutResources', function(){
16-
refAutoPrintTag = this.internal.newObject()
17-
this.internal.write("<< /S/Named /Type/Action /N/Print >>", "endobj");
18-
})
8+
this.internal.events.subscribe('postPutResources', function () {
9+
refAutoPrintTag = this.internal.newObject()
10+
this.internal.write("<< /S/Named /Type/Action /N/Print >>", "endobj");
11+
});
1912

20-
this.internal.events.subscribe("putCatalog", function(){
21-
this.internal.write("/OpenAction " + refAutoPrintTag + " 0" + " R");
22-
});
23-
24-
// it is good practice to return ref to jsPDF instance to make
25-
// the calls chainable.
26-
return this;
27-
}
28-
29-
})(jsPDF.API)
13+
this.internal.events.subscribe("putCatalog", function () {
14+
this.internal.write("/OpenAction " + refAutoPrintTag + " 0" + " R");
15+
});
16+
return this;
17+
};
18+
})(jsPDF.API);

jspdf.plugin.from_html.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
STYLE : 1,
217217
NOSCRIPT : 1,
218218
OBJECT : 1,
219-
EMBED : 1,
219+
EMBED : 1
220220
};
221221
DrillForContent = function(element, renderer, elementHandlers) {
222222
var cn, cns, fragmentCSS, i, isBlock, l, px2pt, table2json;

jspdf.plugin.sillysvgrenderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,4 @@ jsPDFAPI.addSVG = function(svgtext, x, y, w, h) {
178178
return this
179179
}
180180

181-
})(jsPDF.API)
181+
})(jsPDF.API);

0 commit comments

Comments
 (0)