File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -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
@@ -1062,12 +1063,20 @@ var jsPDF = (function(global) {
1062
1063
if ( ! ( 'autoencode' in flags ) )
1063
1064
flags . autoencode = true ;
1064
1065
1066
+ //TODO this might not work after object block changes
1067
+ // It would be better to pass in a page context
1065
1068
var strokeOption = '' ;
1066
1069
if ( true === flags . stroke ) {
1067
- strokeOption = '1 Tr\n' ;
1070
+ if ( this . lastTextWasStroke !== true ) {
1071
+ strokeOption = '1 Tr\n' ;
1072
+ this . lastTextWasStroke = true ;
1073
+ }
1068
1074
}
1069
1075
else {
1070
- strokeOption = '0 Tr\n' ;
1076
+ if ( this . lastTextWasStroke ) {
1077
+ strokeOption = '0 Tr\n' ;
1078
+ }
1079
+ this . lastTextWasStroke = false ;
1071
1080
}
1072
1081
1073
1082
if ( typeof text === 'string' ) {
Original file line number Diff line number Diff line change 60
60
ctx . strokeText ( "Hello PDF" , 20 , y + 50 ) ;
61
61
y += 50 + pad ;
62
62
63
+ ctx . setFont ( "20pt courier bold" ) ;
64
+ ctx . strokeText ( "Hello PDF" , 20 , y + 20 ) ;
65
+ y += 20 + pad ;
66
+
67
+ ctx . setFont ( "20pt courier bold" ) ;
68
+ ctx . fillText ( "Hello PDF" , 20 , y + 20 ) ;
69
+ y += 20 + pad ;
70
+
63
71
ctx . restore ( ) ;
64
72
65
73
//
You can’t perform that action at this time.
0 commit comments