@@ -199,6 +199,7 @@ var jsPDF = (function(global) {
199
199
} ,
200
200
API = { } ,
201
201
events = new PubSub ( API ) ,
202
+ lastTextWasStroke = false ,
202
203
203
204
/////////////////////
204
205
// Private functions
@@ -963,7 +964,17 @@ var jsPDF = (function(global) {
963
964
'getNumberOfPages' : function ( ) {
964
965
return pages . length - 1 ;
965
966
} ,
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
+ }
967
978
} ;
968
979
969
980
/**
@@ -1055,7 +1066,23 @@ var jsPDF = (function(global) {
1055
1066
flags . noBOM = true ;
1056
1067
if ( ! ( 'autoencode' in flags ) )
1057
1068
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
+
1059
1086
if ( typeof text === 'string' ) {
1060
1087
text = ESC ( text ) ;
1061
1088
} else if ( text instanceof Array ) {
@@ -1085,6 +1112,7 @@ var jsPDF = (function(global) {
1085
1112
'BT\n/' +
1086
1113
activeFontKey + ' ' + activeFontSize + ' Tf\n' + // font face, style, size
1087
1114
( activeFontSize * lineHeightProportion ) + ' TL\n' + // line spacing
1115
+ strokeOption + // stroke option
1088
1116
textColor +
1089
1117
'\n' + xtra + f2 ( x * k ) + ' ' + f2 ( ( pageHeight - y ) * k ) + ' ' + mode + '\n(' +
1090
1118
text +
0 commit comments