@@ -436,7 +436,7 @@ public PdfCanvas setFontAndSize(PdfFont font, float size) {
436
436
PdfName fontName = resources .addFont (document , font );
437
437
currentGs .setFont (font );
438
438
contentStream .getOutputStream ()
439
- .write (( PdfObject ) fontName )
439
+ .write (fontName )
440
440
.writeSpace ()
441
441
.writeFloat (size ).writeSpace ()
442
442
.writeBytes (Tf );
@@ -930,8 +930,8 @@ public PdfCanvas arc(final double x1, final double y1, final double x2, final do
930
930
return this ;
931
931
double pt [] = ar .get (0 );
932
932
moveTo (pt [0 ], pt [1 ]);
933
- for (int iter = 0 ; iter < ar .size (); ++iter ) {
934
- pt = ar .get (iter );
933
+ for (int i = 0 ; i < ar .size (); ++i ) {
934
+ pt = ar .get (i );
935
935
curveTo (pt [2 ], pt [3 ], pt [4 ], pt [5 ], pt [6 ], pt [7 ]);
936
936
}
937
937
@@ -1431,7 +1431,7 @@ public PdfCanvas setRenderingIntent(PdfName renderingIntent) {
1431
1431
return this ;
1432
1432
currentGs .setRenderingIntent (renderingIntent );
1433
1433
contentStream .getOutputStream ()
1434
- .write (( PdfObject ) renderingIntent ).writeSpace ()
1434
+ .write (renderingIntent ).writeSpace ()
1435
1435
.writeBytes (ri );
1436
1436
return this ;
1437
1437
}
@@ -1533,15 +1533,15 @@ else if (colorSpace instanceof PdfDeviceCs.Rgb)
1533
1533
else if (colorSpace instanceof PdfDeviceCs .Cmyk )
1534
1534
contentStream .getOutputStream ().writeFloats (colorValue ).writeSpace ().writeBytes (fill ? k : K );
1535
1535
else if (colorSpace instanceof PdfSpecialCs .UncoloredTilingPattern )
1536
- contentStream .getOutputStream ().write (( PdfObject ) resources .addColorSpace (colorSpace )).writeSpace ().writeBytes (fill ? cs : CS ).
1537
- writeNewLine ().writeFloats (colorValue ).writeSpace ().write (( PdfObject ) resources .addPattern (pattern )).writeSpace ().writeBytes (fill ? scn : SCN );
1536
+ contentStream .getOutputStream ().write (resources .addColorSpace (colorSpace )).writeSpace ().writeBytes (fill ? cs : CS ).
1537
+ writeNewLine ().writeFloats (colorValue ).writeSpace ().write (resources .addPattern (pattern )).writeSpace ().writeBytes (fill ? scn : SCN );
1538
1538
else if (colorSpace instanceof PdfSpecialCs .Pattern )
1539
- contentStream .getOutputStream ().write (( PdfObject ) PdfName .Pattern ).writeSpace ().writeBytes (fill ? cs : CS ).
1540
- writeNewLine ().write (( PdfObject ) resources .addPattern (pattern )).writeSpace ().writeBytes (fill ? scn : SCN );
1539
+ contentStream .getOutputStream ().write (PdfName .Pattern ).writeSpace ().writeBytes (fill ? cs : CS ).
1540
+ writeNewLine ().write (resources .addPattern (pattern )).writeSpace ().writeBytes (fill ? scn : SCN );
1541
1541
else if (colorSpace .getPdfObject ().isIndirect ()) {
1542
1542
if (!setColorValueOnly ) {
1543
1543
PdfName name = resources .addColorSpace (colorSpace );
1544
- contentStream .getOutputStream ().write (( PdfObject ) name ).writeSpace ().writeBytes (fill ? cs : CS );
1544
+ contentStream .getOutputStream ().write (name ).writeSpace ().writeBytes (fill ? cs : CS );
1545
1545
}
1546
1546
contentStream .getOutputStream ().writeFloats (colorValue ).writeSpace ().writeBytes (fill ? scn : SCN );
1547
1547
}
@@ -1732,7 +1732,7 @@ public PdfCanvas beginLayer(IPdfOCG layer) {
1732
1732
* @return current canvas.
1733
1733
*/
1734
1734
public PdfCanvas endLayer () {
1735
- int num = 1 ;
1735
+ int num ;
1736
1736
if (layerDepth != null && !layerDepth .isEmpty ()) {
1737
1737
num = layerDepth .get (layerDepth .size () - 1 );
1738
1738
layerDepth .remove (layerDepth .size () - 1 );
@@ -1844,7 +1844,6 @@ public PdfXObject addImage(Image image, float x, float y, boolean asInline) {
1844
1844
* @param width
1845
1845
* @param asInline true if to add image as in-line.
1846
1846
* @return created XObject or null in case of in-line image (asInline = true).
1847
- * @on error.
1848
1847
*/
1849
1848
public PdfXObject addImage (Image image , float x , float y , float width , boolean asInline ) {
1850
1849
if (image .getOriginalType () == ImageType .WMF ) {
@@ -1892,7 +1891,6 @@ public PdfXObject addImage(Image image, float x, float y, float height, boolean
1892
1891
* @param e an element of the transformation matrix
1893
1892
* @param f an element of the transformation matrix
1894
1893
* @return current canvas.
1895
- * @on error.
1896
1894
*/
1897
1895
public PdfCanvas addXObject (PdfXObject xObject , float a , float b , float c , float d , float e , float f ) {
1898
1896
if (xObject instanceof PdfFormXObject ) {
@@ -1911,7 +1909,6 @@ public PdfCanvas addXObject(PdfXObject xObject, float a, float b, float c, float
1911
1909
* @param x
1912
1910
* @param y
1913
1911
* @return current canvas.
1914
- * @on error.
1915
1912
*/
1916
1913
public PdfCanvas addXObject (PdfXObject xObject , float x , float y ) {
1917
1914
if (xObject instanceof PdfFormXObject ) {
@@ -1929,7 +1926,6 @@ public PdfCanvas addXObject(PdfXObject xObject, float x, float y) {
1929
1926
* @param xObject
1930
1927
* @param rect
1931
1928
* @return current canvas.
1932
- * @on error.
1933
1929
*/
1934
1930
public PdfCanvas addXObject (PdfXObject xObject , Rectangle rect ) {
1935
1931
if (xObject instanceof PdfFormXObject ) {
@@ -1949,7 +1945,6 @@ public PdfCanvas addXObject(PdfXObject xObject, Rectangle rect) {
1949
1945
* @param y
1950
1946
* @param width
1951
1947
* @return current canvas.
1952
- * @on error.
1953
1948
*/
1954
1949
public PdfCanvas addXObject (PdfXObject xObject , float x , float y , float width ) {
1955
1950
if (xObject instanceof PdfFormXObject ) {
@@ -1970,7 +1965,6 @@ public PdfCanvas addXObject(PdfXObject xObject, float x, float y, float width) {
1970
1965
* @param height
1971
1966
* @param dummy
1972
1967
* @return current canvas.
1973
- * @on error.
1974
1968
*/
1975
1969
public PdfCanvas addXObject (PdfXObject xObject , float x , float y , float height , boolean dummy ) {
1976
1970
if (xObject instanceof PdfFormXObject ) {
@@ -1992,7 +1986,7 @@ public PdfCanvas setExtGState(PdfExtGState extGState) {
1992
1986
if (!extGState .isFlushed ())
1993
1987
currentGs .updateFromExtGState (extGState );
1994
1988
PdfName name = resources .addExtGState (extGState );
1995
- contentStream .getOutputStream ().write (( PdfObject ) name ).writeSpace ().writeBytes (gs );
1989
+ contentStream .getOutputStream ().write (name ).writeSpace ().writeBytes (gs );
1996
1990
return this ;
1997
1991
}
1998
1992
@@ -2027,13 +2021,13 @@ public PdfCanvas beginMarkedContent(PdfName tag) {
2027
2021
*/
2028
2022
public PdfCanvas beginMarkedContent (PdfName tag , PdfDictionary properties ) {
2029
2023
mcDepth ++;
2030
- PdfOutputStream out = contentStream .getOutputStream ().write (( PdfObject ) tag ).writeSpace ();
2024
+ PdfOutputStream out = contentStream .getOutputStream ().write (tag ).writeSpace ();
2031
2025
if (properties == null ) {
2032
2026
out .writeBytes (BMC );
2033
2027
} else if (properties .getIndirectReference () == null ) {
2034
2028
out .write (properties ).writeSpace ().writeBytes (BDC );
2035
2029
} else {
2036
- out .write (( PdfObject ) resources .addProperties (properties )).writeSpace ().writeBytes (BDC );
2030
+ out .write (resources .addProperties (properties )).writeSpace ().writeBytes (BDC );
2037
2031
}
2038
2032
return this ;
2039
2033
}
@@ -2152,7 +2146,7 @@ protected void addInlineImage(PdfImageXObject imageXObject, float a, float b, fl
2152
2146
for (Map .Entry <PdfName , PdfObject > entry : imageXObject .getPdfObject ().entrySet ()) {
2153
2147
PdfName key = entry .getKey ();
2154
2148
if (!PdfName .Type .equals (key ) && !PdfName .Subtype .equals (key ) && !PdfName .Length .equals (key )) {
2155
- os .write (( PdfObject ) entry .getKey ()).writeSpace ();
2149
+ os .write (entry .getKey ()).writeSpace ();
2156
2150
os .write (entry .getValue ()).writeNewLine ();
2157
2151
}
2158
2152
}
@@ -2177,7 +2171,7 @@ private PdfCanvas addForm(PdfFormXObject form, float a, float b, float c, float
2177
2171
saveState ();
2178
2172
concatMatrix (a , b , c , d , e , f );
2179
2173
PdfName name = resources .addForm (form );
2180
- contentStream .getOutputStream ().write (( PdfObject ) name ).writeSpace ().writeBytes (Do );
2174
+ contentStream .getOutputStream ().write (name ).writeSpace ().writeBytes (Do );
2181
2175
restoreState ();
2182
2176
return this ;
2183
2177
}
@@ -2235,7 +2229,6 @@ private PdfCanvas addForm(PdfFormXObject form, float x, float y, float width) {
2235
2229
* @param height
2236
2230
* @param dummy
2237
2231
* @return
2238
- * @on error.
2239
2232
*/
2240
2233
private PdfCanvas addForm (PdfFormXObject form , float x , float y , float height , boolean dummy ) {
2241
2234
PdfArray bbox = form .getPdfObject ().getAsArray (PdfName .BBox );
@@ -2257,13 +2250,12 @@ private PdfCanvas addForm(PdfFormXObject form, float x, float y, float height, b
2257
2250
* @param e an element of the transformation matrix
2258
2251
* @param f an element of the transformation matrix
2259
2252
* @return canvas a reference to this object.
2260
- * @on error
2261
2253
*/
2262
2254
private PdfCanvas addImage (PdfImageXObject image , float a , float b , float c , float d , float e , float f ) {
2263
2255
saveState ();
2264
2256
concatMatrix (a , b , c , d , e , f );
2265
2257
PdfName name = resources .addImage (image );
2266
- contentStream .getOutputStream ().write (( PdfObject ) name ).writeSpace ().writeBytes (Do );
2258
+ contentStream .getOutputStream ().write (name ).writeSpace ().writeBytes (Do );
2267
2259
restoreState ();
2268
2260
return this ;
2269
2261
}
@@ -2272,7 +2264,7 @@ private PdfCanvas addImage(PdfXObject xObject, float a, float b, float c, float
2272
2264
saveState ();
2273
2265
concatMatrix (a , b , c , d , e , f );
2274
2266
PdfName name = resources .addImage (xObject .getPdfObject ());
2275
- contentStream .getOutputStream ().write (( PdfObject ) name ).writeSpace ().writeBytes (Do );
2267
+ contentStream .getOutputStream ().write (name ).writeSpace ().writeBytes (Do );
2276
2268
restoreState ();
2277
2269
return this ;
2278
2270
}
@@ -2284,7 +2276,6 @@ private PdfCanvas addImage(PdfXObject xObject, float a, float b, float c, float
2284
2276
* @param x
2285
2277
* @param y
2286
2278
* @return
2287
- * @throws PdfException
2288
2279
*/
2289
2280
private PdfCanvas addImage (PdfImageXObject image , float x , float y ) {
2290
2281
return addImage (image , image .getWidth (), 0 , 0 , image .getHeight (), x , y );
@@ -2296,7 +2287,6 @@ private PdfCanvas addImage(PdfImageXObject image, float x, float y) {
2296
2287
* @param image
2297
2288
* @param rect
2298
2289
* @return
2299
- * @throws PdfException
2300
2290
*/
2301
2291
private PdfCanvas addImage (PdfImageXObject image , Rectangle rect ) {
2302
2292
return addImage (image , rect .getWidth (), 0 , 0 , rect .getHeight (), rect .getX (), rect .getY ());
@@ -2310,7 +2300,6 @@ private PdfCanvas addImage(PdfImageXObject image, Rectangle rect) {
2310
2300
* @param y
2311
2301
* @param width
2312
2302
* @return
2313
- * @throws PdfException
2314
2303
*/
2315
2304
private PdfCanvas addImage (PdfImageXObject image , float x , float y , float width ) {
2316
2305
return addImage (image , width , 0 , 0 , width / image .getWidth () * image .getHeight (), x , y );
@@ -2325,7 +2314,6 @@ private PdfCanvas addImage(PdfImageXObject image, float x, float y, float width)
2325
2314
* @param height
2326
2315
* @param dummy
2327
2316
* @return current canvas.
2328
- * @on error.
2329
2317
*/
2330
2318
private PdfCanvas addImage (PdfImageXObject image , float x , float y , float height , boolean dummy ) {
2331
2319
return addImage (image , height / image .getHeight () * image .getWidth (), 0 , 0 , height , x , y );
@@ -2366,8 +2354,8 @@ private void showTextInt(String text) {
2366
2354
2367
2355
private void addToPropertiesAndBeginLayer (IPdfOCG layer ) {
2368
2356
PdfName name = resources .addProperties (layer .getPdfObject ());
2369
- contentStream .getOutputStream ().write (( PdfObject ) PdfName .OC ).writeSpace ()
2370
- .write (( PdfObject ) name ).writeSpace ().writeBytes (BDC ).writeNewLine ();
2357
+ contentStream .getOutputStream ().write (PdfName .OC ).writeSpace ()
2358
+ .write (name ).writeSpace ().writeBytes (BDC ).writeNewLine ();
2371
2359
}
2372
2360
2373
2361
private Color createColor (PdfColorSpace colorSpace , float [] colorValue , PdfPattern pattern ) {
0 commit comments