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
34293427jsPDF split_text_to_size plugin
34303428Copyright (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' ) ;
0 commit comments