@@ -613,6 +613,7 @@ protected Map<String, Object> _parsejpg(final File file) {
613613 image .put ("cs" , colspace );
614614 image .put ("bpc" , 8 );
615615 image .put ("f" , "DCTDecode" );
616+ image .put ("i" , Integer .valueOf (this .images .size () + 1 ));
616617
617618 InputStream f = new FileInputStream (file );
618619 byte [] data = new byte [f .available ()];
@@ -2760,16 +2761,21 @@ public void setY(final float y) {
27602761 /** Output a string */
27612762 public void Text (final float x , final float y , final String txt ) {
27622763 StringBuilder s = new StringBuilder ();
2763- s .append (String .format (Locale .ENGLISH , "BT %.2f %.2f Td (%s) Tj ET" ,
2764- Float .valueOf (x * this .k ), Float .valueOf ((this .h - y ) * this .k ), this ._escape (txt )));
2764+
2765+ if (this .colorFlag ) {
2766+ s .append ("q " ).append (this .textColor ).append (' ' );
2767+ }
2768+
2769+ s .append (String .format ("BT %.2f %.2f Td (%s) Tj ET" , x * this .k , (this .h - y ) * this .k , this ._escape (txt )));
2770+
27652771 if (this .underline && (txt != null )) {
27662772 s .append (' ' ).append (this ._dounderline (x , y , txt ));
27672773 }
2774+
27682775 if (this .colorFlag ) {
2769- s .delete (0 , s .length ());
2770- s .append ("q " ).append (this .textColor )
2771- .append (' ' ).append (s ).append (" Q" );
2776+ s .append (" Q" );
27722777 }
2778+
27732779 this ._out (s .toString ());
27742780 }
27752781
0 commit comments