@@ -199,6 +199,7 @@ var jsPDF = (function(global) {
199199 } ,
200200 API = { } ,
201201 events = new PubSub ( API ) ,
202+ lastTextWasStroke = false ,
202203
203204 /////////////////////
204205 // Private functions
@@ -963,7 +964,17 @@ var jsPDF = (function(global) {
963964 'getNumberOfPages' : function ( ) {
964965 return pages . length - 1 ;
965966 } ,
966- 'pages' : pages
967+ 'pages' : pages ,
968+ 'out' : out ,
969+ 'f2' : f2 ,
970+ 'getPageInfo' : function ( pageNumberOneBased ) {
971+ var objId = ( pageNumberOneBased - 1 ) * 2 + 3 ;
972+ return { objId :objId , pageNumber :pageNumberOneBased } ;
973+ } ,
974+ 'getCurrentPageInfo' : function ( ) {
975+ var objId = ( currentPage - 1 ) * 2 + 3 ;
976+ return { objId :objId , pageNumber :currentPage } ;
977+ }
967978 } ;
968979
969980 /**
@@ -1055,7 +1066,23 @@ var jsPDF = (function(global) {
10551066 flags . noBOM = true ;
10561067 if ( ! ( 'autoencode' in flags ) )
10571068 flags . autoencode = true ;
1058-
1069+
1070+ //TODO this might not work after object block changes
1071+ // It would be better to pass in a page context
1072+ var strokeOption = '' ;
1073+ if ( true === flags . stroke ) {
1074+ if ( this . lastTextWasStroke !== true ) {
1075+ strokeOption = '1 Tr\n' ;
1076+ this . lastTextWasStroke = true ;
1077+ }
1078+ }
1079+ else {
1080+ if ( this . lastTextWasStroke ) {
1081+ strokeOption = '0 Tr\n' ;
1082+ }
1083+ this . lastTextWasStroke = false ;
1084+ }
1085+
10591086 if ( typeof text === 'string' ) {
10601087 text = ESC ( text ) ;
10611088 } else if ( text instanceof Array ) {
@@ -1085,6 +1112,7 @@ var jsPDF = (function(global) {
10851112 'BT\n/' +
10861113 activeFontKey + ' ' + activeFontSize + ' Tf\n' + // font face, style, size
10871114 ( activeFontSize * lineHeightProportion ) + ' TL\n' + // line spacing
1115+ strokeOption + // stroke option
10881116 textColor +
10891117 '\n' + xtra + f2 ( x * k ) + ' ' + f2 ( ( pageHeight - y ) * k ) + ' ' + mode + '\n(' +
10901118 text +
0 commit comments