1 28 package net.sf.jasperreports.engine; 29 30 import java.awt.Image ; 31 import java.io.InputStream ; 32 import java.io.OutputStream ; 33 34 import net.sf.jasperreports.engine.print.JRPrinterAWT; 35 import net.sf.jasperreports.engine.util.JRLoader; 36 37 38 44 public class JasperPrintManager 45 { 46 47 48 51 public static String printReportToPdfFile(String sourceFileName) throws JRException 52 { 53 return JasperExportManager.exportReportToPdfFile(sourceFileName); 54 } 55 56 57 60 public static void printReportToPdfFile( 61 String sourceFileName, 62 String destFileName 63 ) throws JRException 64 { 65 JasperExportManager.exportReportToPdfFile(sourceFileName, destFileName); 66 } 67 68 69 72 public static void printReportToPdfFile( 73 JasperPrint jasperPrint, 74 String destFileName 75 ) throws JRException 76 { 77 JasperExportManager.exportReportToPdfFile(jasperPrint, destFileName); 78 } 79 80 81 84 public static void printReportToPdfStream( 85 InputStream inputStream, 86 OutputStream outputStream 87 ) throws JRException 88 { 89 JasperExportManager.exportReportToPdfStream(inputStream, outputStream); 90 } 91 92 93 96 public static void printReportToPdfStream( 97 JasperPrint jasperPrint, 98 OutputStream outputStream 99 ) throws JRException 100 { 101 JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream); 102 } 103 104 105 108 public static byte[] printReportToPdf(JasperPrint jasperPrint) throws JRException 109 { 110 return JasperExportManager.exportReportToPdf(jasperPrint); 111 } 112 113 114 117 public static String printReportToXmlFile( 118 String sourceFileName, 119 boolean isEmbeddingImages 120 ) throws JRException 121 { 122 return 123 JasperExportManager.exportReportToXmlFile( 124 sourceFileName, 125 isEmbeddingImages 126 ); 127 } 128 129 130 133 public static void printReportToXmlFile( 134 String sourceFileName, 135 String destFileName, 136 boolean isEmbeddingImages 137 ) throws JRException 138 { 139 JasperExportManager.exportReportToXmlFile( 140 sourceFileName, 141 destFileName, 142 isEmbeddingImages 143 ); 144 } 145 146 147 150 public static void printReportToXmlFile( 151 JasperPrint jasperPrint, 152 String destFileName, 153 boolean isEmbeddingImages 154 ) throws JRException 155 { 156 JasperExportManager.exportReportToXmlFile( 157 jasperPrint, 158 destFileName, 159 isEmbeddingImages 160 ); 161 } 162 163 164 167 public static void printReportToXmlStream( 168 InputStream inputStream, 169 OutputStream outputStream 170 ) throws JRException 171 { 172 JasperExportManager.exportReportToXmlStream( 173 inputStream, 174 outputStream 175 ); 176 } 177 178 179 182 public static void printReportToXmlStream( 183 JasperPrint jasperPrint, 184 OutputStream outputStream 185 ) throws JRException 186 { 187 JasperExportManager.exportReportToXmlStream( 188 jasperPrint, 189 outputStream 190 ); 191 } 192 193 194 197 public static String printReportToXml(JasperPrint jasperPrint) throws JRException 198 { 199 return JasperExportManager.exportReportToXml(jasperPrint); 200 } 201 202 203 206 public static boolean printReport( 207 String sourceFileName, 208 boolean withPrintDialog 209 ) throws JRException 210 { 211 JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFileName); 212 213 return printReport(jasperPrint, withPrintDialog); 214 } 215 216 217 220 public static boolean printReport( 221 InputStream inputStream, 222 boolean withPrintDialog 223 ) throws JRException 224 { 225 JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(inputStream); 226 227 return printReport(jasperPrint, withPrintDialog); 228 } 229 230 231 234 public static boolean printReport( 235 JasperPrint jasperPrint, 236 boolean withPrintDialog 237 ) throws JRException 238 { 239 return printPages( 240 jasperPrint, 241 0, 242 jasperPrint.getPages().size() - 1, 243 withPrintDialog 244 ); 245 } 246 247 248 251 public static boolean printPage( 252 String sourceFileName, 253 int pageIndex, 254 boolean withPrintDialog 255 ) throws JRException 256 { 257 JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFileName); 258 259 return printPage(jasperPrint, pageIndex, withPrintDialog); 260 } 261 262 263 266 public static boolean printPage( 267 InputStream inputStream, 268 int pageIndex, 269 boolean withPrintDialog 270 ) throws JRException 271 { 272 JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(inputStream); 273 274 return printPage(jasperPrint, pageIndex, withPrintDialog); 275 } 276 277 278 281 public static boolean printPage( 282 JasperPrint jasperPrint, 283 int pageIndex, 284 boolean withPrintDialog 285 ) throws JRException 286 { 287 return printPages( 288 jasperPrint, 289 pageIndex, 290 pageIndex, 291 withPrintDialog 292 ); 293 } 294 295 296 299 public static boolean printPages( 300 String sourceFileName, 301 int firstPageIndex, 302 int lastPageIndex, 303 boolean withPrintDialog 304 ) throws JRException 305 { 306 JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFileName); 307 308 return printPages( 309 jasperPrint, 310 firstPageIndex, 311 lastPageIndex, 312 withPrintDialog 313 ); 314 } 315 316 317 320 public static boolean printPages( 321 InputStream inputStream, 322 int firstPageIndex, 323 int lastPageIndex, 324 boolean withPrintDialog 325 ) throws JRException 326 { 327 JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(inputStream); 328 329 return printPages( 330 jasperPrint, 331 firstPageIndex, 332 lastPageIndex, 333 withPrintDialog 334 ); 335 } 336 337 338 341 public static boolean printPages( 342 JasperPrint jasperPrint, 343 int firstPageIndex, 344 int lastPageIndex, 345 boolean withPrintDialog 346 ) throws JRException 347 { 348 return JRPrinterAWT.printPages( 349 jasperPrint, 350 firstPageIndex, 351 lastPageIndex, 352 withPrintDialog 353 ); 354 } 355 356 357 360 public static Image printPageToImage( 361 String sourceFileName, 362 int pageIndex, 363 float zoom 364 ) throws JRException 365 { 366 JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFileName); 367 368 return printPageToImage(jasperPrint, pageIndex, zoom); 369 } 370 371 372 375 public static Image printPageToImage( 376 InputStream inputStream, 377 int pageIndex, 378 float zoom 379 ) throws JRException 380 { 381 JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(inputStream); 382 383 return printPageToImage(jasperPrint, pageIndex, zoom); 384 } 385 386 387 390 public static Image printPageToImage( 391 JasperPrint jasperPrint, 392 int pageIndex, 393 float zoom 394 ) throws JRException 395 { 396 return JRPrinterAWT.printPageToImage(jasperPrint, pageIndex, zoom); 397 } 398 399 400 } 401 | Popular Tags |