KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > JasperPrintManager


1 /*
2  * ============================================================================
3  * GNU Lesser General Public License
4  * ============================================================================
5  *
6  * JasperReports - Free Java report-generating library.
7  * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * JasperSoft Corporation
24  * 303 Second Street, Suite 450 North
25  * San Francisco, CA 94107
26  * http://www.jaspersoft.com
27  */

28 package net.sf.jasperreports.engine;
29
30 import java.awt.Image JavaDoc;
31 import java.io.InputStream JavaDoc;
32 import java.io.OutputStream JavaDoc;
33
34 import net.sf.jasperreports.engine.print.JRPrinterAWT;
35 import net.sf.jasperreports.engine.util.JRLoader;
36
37
38 /**
39  * Façade class for the JasperReports engine.
40  *
41  * @author Teodor Danciu (teodord@users.sourceforge.net)
42  * @version $Id: JasperPrintManager.java 1229 2006-04-19 13:27:35 +0300 (Wed, 19 Apr 2006) teodord $
43  */

44 public class JasperPrintManager
45 {
46
47
48     /**
49      * @deprecated Replaced by {@link JasperExportManager#exportReportToPdfFile(String)}.
50      */

51     public static String JavaDoc printReportToPdfFile(String JavaDoc sourceFileName) throws JRException
52     {
53         return JasperExportManager.exportReportToPdfFile(sourceFileName);
54     }
55
56
57     /**
58      * @deprecated Replaced by {@link JasperExportManager#exportReportToPdfFile(String, String)}.
59      */

60     public static void printReportToPdfFile(
61         String JavaDoc sourceFileName,
62         String JavaDoc destFileName
63         ) throws JRException
64     {
65         JasperExportManager.exportReportToPdfFile(sourceFileName, destFileName);
66     }
67
68
69     /**
70      * @deprecated Replaced by {@link JasperExportManager#exportReportToPdfFile(JasperPrint, String)}.
71      */

72     public static void printReportToPdfFile(
73         JasperPrint jasperPrint,
74         String JavaDoc destFileName
75         ) throws JRException
76     {
77         JasperExportManager.exportReportToPdfFile(jasperPrint, destFileName);
78     }
79
80
81     /**
82      * @deprecated Replaced by {@link JasperExportManager#exportReportToPdfStream(InputStream, OutputStream)}.
83      */

84     public static void printReportToPdfStream(
85         InputStream JavaDoc inputStream,
86         OutputStream JavaDoc outputStream
87         ) throws JRException
88     {
89         JasperExportManager.exportReportToPdfStream(inputStream, outputStream);
90     }
91
92
93     /**
94      * @deprecated Replaced by {@link JasperExportManager#exportReportToPdfStream(JasperPrint, OutputStream)}.
95      */

96     public static void printReportToPdfStream(
97         JasperPrint jasperPrint,
98         OutputStream JavaDoc outputStream
99         ) throws JRException
100     {
101         JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
102     }
103
104
105     /**
106      * @deprecated Replaced by {@link JasperExportManager#exportReportToPdf(JasperPrint)}.
107      */

108     public static byte[] printReportToPdf(JasperPrint jasperPrint) throws JRException
109     {
110         return JasperExportManager.exportReportToPdf(jasperPrint);
111     }
112
113
114     /**
115      * @deprecated Replaced by {@link JasperExportManager#exportReportToXmlFile(String, boolean)}.
116      */

117     public static String JavaDoc printReportToXmlFile(
118         String JavaDoc sourceFileName,
119         boolean isEmbeddingImages
120         ) throws JRException
121     {
122         return
123             JasperExportManager.exportReportToXmlFile(
124                 sourceFileName,
125                 isEmbeddingImages
126                 );
127     }
128
129
130     /**
131      * @deprecated Replaced by {@link JasperExportManager#exportReportToXmlFile(String, String, boolean)}.
132      */

133     public static void printReportToXmlFile(
134         String JavaDoc sourceFileName,
135         String JavaDoc destFileName,
136         boolean isEmbeddingImages
137         ) throws JRException
138     {
139         JasperExportManager.exportReportToXmlFile(
140             sourceFileName,
141             destFileName,
142             isEmbeddingImages
143             );
144     }
145
146
147     /**
148      * @deprecated Replaced by {@link JasperExportManager#exportReportToXmlFile(JasperPrint, String, boolean)}.
149      */

150     public static void printReportToXmlFile(
151         JasperPrint jasperPrint,
152         String JavaDoc destFileName,
153         boolean isEmbeddingImages
154         ) throws JRException
155     {
156         JasperExportManager.exportReportToXmlFile(
157             jasperPrint,
158             destFileName,
159             isEmbeddingImages
160             );
161     }
162
163
164     /**
165      * @deprecated Replaced by {@link JasperExportManager#exportReportToXmlStream(InputStream, OutputStream)}.
166      */

167     public static void printReportToXmlStream(
168         InputStream JavaDoc inputStream,
169         OutputStream JavaDoc outputStream
170         ) throws JRException
171     {
172         JasperExportManager.exportReportToXmlStream(
173             inputStream,
174             outputStream
175             );
176     }
177
178
179     /**
180      * @deprecated Replaced by {@link JasperExportManager#exportReportToXmlStream(JasperPrint, OutputStream)}.
181      */

182     public static void printReportToXmlStream(
183         JasperPrint jasperPrint,
184         OutputStream JavaDoc outputStream
185         ) throws JRException
186     {
187         JasperExportManager.exportReportToXmlStream(
188             jasperPrint,
189             outputStream
190             );
191     }
192
193
194     /**
195      * @deprecated Replaced by {@link JasperExportManager#exportReportToXml(JasperPrint)}.
196      */

197     public static String JavaDoc printReportToXml(JasperPrint jasperPrint) throws JRException
198     {
199         return JasperExportManager.exportReportToXml(jasperPrint);
200     }
201
202
203     /**
204      *
205      */

206     public static boolean printReport(
207         String JavaDoc 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     /**
218      *
219      */

220     public static boolean printReport(
221         InputStream JavaDoc 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     /**
232      *
233      */

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     /**
249      *
250      */

251     public static boolean printPage(
252         String JavaDoc 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     /**
264      *
265      */

266     public static boolean printPage(
267         InputStream JavaDoc 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     /**
279      *
280      */

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     /**
297      *
298      */

299     public static boolean printPages(
300         String JavaDoc 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     /**
318      *
319      */

320     public static boolean printPages(
321         InputStream JavaDoc 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     /**
339      *
340      */

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     /**
358      *
359      */

360     public static Image JavaDoc printPageToImage(
361         String JavaDoc 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     /**
373      *
374      */

375     public static Image JavaDoc printPageToImage(
376         InputStream JavaDoc 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     /**
388      *
389      */

390     public static Image JavaDoc 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