1- /** @preserve jsPDF 0.9.0rc1 ( 2013-04-07T16:52 commit ID d95d8f69915bb999f6704e8021108e2e755bd868 )
1+ /** @preserve jsPDF 0.9.0rc2 ( 2013-07-24T20:24 commit ID e61f5b1374b55ec6d71a93ff1579f0ed5b12e2e2 )
22Copyright (c) 2010-2012 James Hall, james@snapshotmedia.co.uk, https://github.com/MrRio/jsPDF
33Copyright (c) 2012 Willow Systems Corporation, willow-systems.com
44MIT license.
@@ -32,7 +32,7 @@ Creates new jsPDF document object instance
3232@class
3333@param orientation One of "portrait" or "landscape" (or shortcuts "p" (Default), "l")
3434@param unit Measurement unit to be used when coordinates are specified. One of "pt" (points), "mm" (Default), "cm", "in"
35- @param format One of 'a3', 'a4' (Default),'a5' ,' letter' , 'legal'
35+ @param format One of 'a0', 'a1', 'a2', ' a3', 'a4' (Default) etc to 'a10', 'b0' to 'b10', 'c0' to 'c10', ' letter', 'government-letter', 'legal', 'junior-legal', 'ledger' or 'tabloid '
3636@returns {jsPDF }
3737@name jsPDF
3838*/
@@ -338,17 +338,51 @@ PubSub implementation
338338 if ( typeof compressPdf === 'undefined' && typeof zpipe === 'undefined' ) { compressPdf = false ; }
339339
340340 var format_as_string = format . toString ( ) . toLowerCase ( ) ,
341- version = '20120619 ' ,
341+ version = '0.9.0rc2 ' ,
342342 content = [ ] ,
343343 content_length = 0 ,
344344 compress = compressPdf ,
345345 pdfVersion = '1.3' , // PDF Version
346346 pageFormats = { // Size in pt of various paper formats
347- 'a3' : [ 841.89 , 1190.55 ] ,
348- 'a4' : [ 595.28 , 841.89 ] ,
349- 'a5' : [ 420.94 , 595.28 ] ,
347+ 'a0' : [ 2383.94 , 3370.39 ] ,
348+ 'a1' : [ 1683.78 , 2383.94 ] ,
349+ 'a2' : [ 1190.55 , 1683.78 ] ,
350+ 'a3' : [ 841.89 , 1190.55 ] ,
351+ 'a4' : [ 595.28 , 841.89 ] ,
352+ 'a5' : [ 419.53 , 595.28 ] ,
353+ 'a6' : [ 297.64 , 419.53 ] ,
354+ 'a7' : [ 209.76 , 297.64 ] ,
355+ 'a8' : [ 147.4 , 209.76 ] ,
356+ 'a9' : [ 104.88 , 147.4 ] ,
357+ 'a10' : [ 73.7 , 104.88 ] ,
358+ 'b0' : [ 2834.65 , 4008.19 ] ,
359+ 'b1' : [ 2004.09 , 2834.65 ] ,
360+ 'b2' : [ 1417.32 , 2004.09 ] ,
361+ 'b3' : [ 1000.63 , 1417.32 ] ,
362+ 'b4' : [ 708.66 , 1000.63 ] ,
363+ 'b5' : [ 498.9 , 708.66 ] ,
364+ 'b6' : [ 354.33 , 498.9 ] ,
365+ 'b7' : [ 249.45 , 354.33 ] ,
366+ 'b8' : [ 175.75 , 249.45 ] ,
367+ 'b9' : [ 124.72 , 175.75 ] ,
368+ 'b10' : [ 87.87 , 124.72 ] ,
369+ 'c0' : [ 2599.37 , 3676.54 ] ,
370+ 'c1' : [ 1836.85 , 2599.37 ] ,
371+ 'c2' : [ 1298.27 , 1836.85 ] ,
372+ 'c3' : [ 918.43 , 1298.27 ] ,
373+ 'c4' : [ 649.13 , 918.43 ] ,
374+ 'c5' : [ 459.21 , 649.13 ] ,
375+ 'c6' : [ 323.15 , 459.21 ] ,
376+ 'c7' : [ 229.61 , 323.15 ] ,
377+ 'c8' : [ 161.57 , 229.61 ] ,
378+ 'c9' : [ 113.39 , 161.57 ] ,
379+ 'c10' : [ 79.37 , 113.39 ] ,
350380 'letter' : [ 612 , 792 ] ,
351- 'legal' : [ 612 , 1008 ]
381+ 'government-letter' : [ 576 , 756 ] ,
382+ 'legal' : [ 612 , 1008 ] ,
383+ 'junior-legal' : [ 576 , 360 ] ,
384+ 'ledger' : [ 1224 , 792 ] ,
385+ 'tabloid' : [ 792 , 1224 ]
352386 } ,
353387 textColor = '0 g' ,
354388 drawColor = '0 G' ,
@@ -1081,7 +1115,9 @@ PubSub implementation
10811115 'pageSize' : { 'width' : pageWidth , 'height' : pageHeight } ,
10821116 'output' : function ( type , options ) {
10831117 return output ( type , options ) ;
1084- }
1118+ } ,
1119+ 'getNumberOfPages' : function ( ) { return pages . length - 1 ; } ,
1120+ 'pages' : pages
10851121 } ;
10861122
10871123 /**
@@ -1213,12 +1249,14 @@ PubSub implementation
12131249 @param {Number } x Coordinate (in units declared at inception of PDF document) against left edge of the page
12141250 @param {Number } y Coordinate (in units declared at inception of PDF document) against upper edge of the page
12151251 @param {Number } scale (Defaults to [1.0,1.0]) x,y Scaling factor for all vectors. Elements can be any floating number Sub-one makes drawing smaller. Over-one grows the drawing. Negative flips the direction.
1252+ @param {String } style One of 'S' (the default), 'F', 'FD' or 'DF'. 'S' draws just the curve. 'F' fills the region defined by the curves. 'DF' or 'FD' draws the curves and fills the region.
1253+ @param {Boolean } closed If true, the path is closed with a straight line from the end of the last curve to the starting point.
12161254 @function
12171255 @returns {jsPDF }
12181256 @methodOf jsPDF#
12191257 @name lines
12201258 */
1221- API . lines = function ( lines , x , y , scale , style ) {
1259+ API . lines = function ( lines , x , y , scale , style , closed ) {
12221260 var undef , _first , _second , _third , scalex , scaley , i , l , leg , x2 , y2 , x3 , y3 , x4 , y4 ;
12231261
12241262 // Pre-August-2012 the order of arguments was function(x, y, lines, scale, style)
@@ -1276,6 +1314,11 @@ PubSub implementation
12761314 ) ;
12771315 }
12781316 }
1317+
1318+ if ( closed == true ) {
1319+ out ( ' h' ) ;
1320+ }
1321+
12791322 // stroking / filling / both the path
12801323 out ( style ) ;
12811324 return this ;
@@ -1332,7 +1375,8 @@ PubSub implementation
13321375 x1 ,
13331376 y1 , // start of path
13341377 [ 1 , 1 ] ,
1335- style
1378+ style ,
1379+ true
13361380 ) ;
13371381 return this ;
13381382 } ;
@@ -1732,7 +1776,7 @@ PubSub implementation
17321776 0 : 0 ,
17331777 'butt' : 0 ,
17341778 'but' : 0 ,
1735- 'bevel ' : 0 ,
1779+ 'miter ' : 0 ,
17361780 1 : 1 ,
17371781 'round' : 1 ,
17381782 'rounded' : 1 ,
@@ -1741,7 +1785,7 @@ PubSub implementation
17411785 'projecting' : 2 ,
17421786 'project' : 2 ,
17431787 'square' : 2 ,
1744- 'milter ' : 2
1788+ 'bevel ' : 2
17451789 } ;
17461790
17471791 /**
@@ -1943,7 +1987,14 @@ var getJpegSize = function(imgData) {
19431987 if ( imgData . charCodeAt ( i ) !== 0xff ) {
19441988 throw new Error ( 'getJpegSize could not find the size of the image' ) ;
19451989 }
1946- if ( imgData . charCodeAt ( i + 1 ) === 0xc0 ) {
1990+ if ( imgData . charCodeAt ( i + 1 ) === 0xc0 || //(SOF) Huffman - Baseline DCT
1991+ imgData . charCodeAt ( i + 1 ) === 0xc1 || //(SOF) Huffman - Extended sequential DCT
1992+ imgData . charCodeAt ( i + 1 ) === 0xc2 || // Progressive DCT (SOF2)
1993+ imgData . charCodeAt ( i + 1 ) === 0xc3 || // Spatial (sequential) lossless (SOF3)
1994+ imgData . charCodeAt ( i + 1 ) === 0xc4 || // Differential sequential DCT (SOF5)
1995+ imgData . charCodeAt ( i + 1 ) === 0xc5 || // Differential progressive DCT (SOF6)
1996+ imgData . charCodeAt ( i + 1 ) === 0xc6 || // Differential spatial (SOF7)
1997+ imgData . charCodeAt ( i + 1 ) === 0xc7 ) {
19471998 height = imgData . charCodeAt ( i + 5 ) * 256 + imgData . charCodeAt ( i + 6 ) ;
19481999 width = imgData . charCodeAt ( i + 7 ) * 256 + imgData . charCodeAt ( i + 8 ) ;
19492000 return [ width , height ] ;
@@ -3577,6 +3628,45 @@ API.events.push([
35773628] ) // end of adding event handler
35783629
35793630} ) ( jsPDF . API ) ;
3631+ /** ====================================================================
3632+ * jsPDF total_pages plugin
3633+ * Copyright (c) 2013 Eduardo Menezes de Morais, eduardo.morais@usp.br
3634+ *
3635+ * Permission is hereby granted, free of charge, to any person obtaining
3636+ * a copy of this software and associated documentation files (the
3637+ * "Software"), to deal in the Software without restriction, including
3638+ * without limitation the rights to use, copy, modify, merge, publish,
3639+ * distribute, sublicense, and/or sell copies of the Software, and to
3640+ * permit persons to whom the Software is furnished to do so, subject to
3641+ * the following conditions:
3642+ *
3643+ * The above copyright notice and this permission notice shall be
3644+ * included in all copies or substantial portions of the Software.
3645+ *
3646+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
3647+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3648+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
3649+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
3650+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
3651+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
3652+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3653+ * ====================================================================
3654+ */
3655+
3656+ ( function ( jsPDFAPI ) {
3657+ 'use strict' ;
3658+
3659+ jsPDFAPI . putTotalPages = function ( pageExpression ) {
3660+ 'use strict' ;
3661+ var replaceExpression = new RegExp ( pageExpression , 'g' ) ;
3662+ for ( var n = 1 ; n <= this . internal . getNumberOfPages ( ) ; n ++ ) {
3663+ for ( var i = 0 ; i < this . internal . pages [ n ] . length ; i ++ )
3664+ this . internal . pages [ n ] [ i ] = this . internal . pages [ n ] [ i ] . replace ( replaceExpression , this . internal . getNumberOfPages ( ) ) ;
3665+ }
3666+ return this ;
3667+ }
3668+
3669+ } ) ( jsPDF . API )
35803670/* BlobBuilder.js
35813671 * A BlobBuilder implementation.
35823672 * 2012-04-21
0 commit comments