Package net.sf.jasperreports.engine
Class JasperPrintManager
- java.lang.Object
-
- net.sf.jasperreports.engine.JasperPrintManager
-
public final class JasperPrintManager extends Object
Facade class for the printing functionality exposed by the JasperReports library.After having filled a report, you have the option of viewing it, exporting it to a different format, or (most commonly) printing it.
In JasperReports, you can print reports using this manager class. It contains various methods that can send entire documents or portions of them to the printer. It also allows people to choose whether to display the print dialog. one can display the content of a page from a JasperReports document by generating a
java.awt.Imageobject for it using this manager class.- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description static StringEXCEPTION_MESSAGE_KEY_NO_AVAILABLE_PRINTERstatic StringPROPERTY_CHECK_AVAILABLE_PRINTERSProperty whose value is used to check the availability of printers accepting jobs.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JasperPrintManagergetInstance(JasperReportsContext jasperReportsContext)booleanprint(InputStream inputStream, boolean withPrintDialog)booleanprint(InputStream inputStream, int pageIndex, boolean withPrintDialog)booleanprint(InputStream inputStream, int firstPageIndex, int lastPageIndex, boolean withPrintDialog)booleanprint(String sourceFileName, boolean withPrintDialog)booleanprint(String sourceFileName, int pageIndex, boolean withPrintDialog)booleanprint(String sourceFileName, int firstPageIndex, int lastPageIndex, boolean withPrintDialog)booleanprint(JasperPrint jasperPrint, boolean withPrintDialog)booleanprint(JasperPrint jasperPrint, int pageIndex, boolean withPrintDialog)booleanprint(JasperPrint jasperPrint, int firstPageIndex, int lastPageIndex, boolean withPrintDialog)static booleanprintPage(InputStream inputStream, int pageIndex, boolean withPrintDialog)static booleanprintPage(String sourceFileName, int pageIndex, boolean withPrintDialog)static booleanprintPage(JasperPrint jasperPrint, int pageIndex, boolean withPrintDialog)static booleanprintPages(InputStream inputStream, int firstPageIndex, int lastPageIndex, boolean withPrintDialog)static booleanprintPages(String sourceFileName, int firstPageIndex, int lastPageIndex, boolean withPrintDialog)static booleanprintPages(JasperPrint jasperPrint, int firstPageIndex, int lastPageIndex, boolean withPrintDialog)static ImageprintPageToImage(InputStream inputStream, int pageIndex, float zoom)static ImageprintPageToImage(String sourceFileName, int pageIndex, float zoom)static ImageprintPageToImage(JasperPrint jasperPrint, int pageIndex, float zoom)static booleanprintReport(InputStream inputStream, boolean withPrintDialog)static booleanprintReport(String sourceFileName, boolean withPrintDialog)static booleanprintReport(JasperPrint jasperPrint, boolean withPrintDialog)ImageprintToImage(InputStream inputStream, int pageIndex, float zoom)ImageprintToImage(String sourceFileName, int pageIndex, float zoom)ImageprintToImage(JasperPrint jasperPrint, int pageIndex, float zoom)
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_NO_AVAILABLE_PRINTER
public static final String EXCEPTION_MESSAGE_KEY_NO_AVAILABLE_PRINTER
- See Also:
- Constant Field Values
-
PROPERTY_CHECK_AVAILABLE_PRINTERS
public static final String PROPERTY_CHECK_AVAILABLE_PRINTERS
Property whose value is used to check the availability of printers accepting jobs. This property is by default set totrue.- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static JasperPrintManager getInstance(JasperReportsContext jasperReportsContext)
-
print
public boolean print(String sourceFileName, boolean withPrintDialog) throws JRException
- Throws:
JRException
-
print
public boolean print(InputStream inputStream, boolean withPrintDialog) throws JRException
- Throws:
JRException
-
print
public boolean print(JasperPrint jasperPrint, boolean withPrintDialog) throws JRException
- Throws:
JRException
-
print
public boolean print(String sourceFileName, int pageIndex, boolean withPrintDialog) throws JRException
- Throws:
JRException
-
print
public boolean print(InputStream inputStream, int pageIndex, boolean withPrintDialog) throws JRException
- Throws:
JRException
-
print
public boolean print(JasperPrint jasperPrint, int pageIndex, boolean withPrintDialog) throws JRException
- Throws:
JRException
-
print
public boolean print(String sourceFileName, int firstPageIndex, int lastPageIndex, boolean withPrintDialog) throws JRException
- Throws:
JRException
-
print
public boolean print(InputStream inputStream, int firstPageIndex, int lastPageIndex, boolean withPrintDialog) throws JRException
- Throws:
JRException
-
print
public boolean print(JasperPrint jasperPrint, int firstPageIndex, int lastPageIndex, boolean withPrintDialog) throws JRException
- Throws:
JRException
-
printToImage
public Image printToImage(String sourceFileName, int pageIndex, float zoom) throws JRException
- Throws:
JRException
-
printToImage
public Image printToImage(InputStream inputStream, int pageIndex, float zoom) throws JRException
- Throws:
JRException
-
printToImage
public Image printToImage(JasperPrint jasperPrint, int pageIndex, float zoom) throws JRException
- Throws:
JRException
-
printReport
public static boolean printReport(String sourceFileName, boolean withPrintDialog) throws JRException
- Throws:
JRException- See Also:
print(String, boolean)
-
printReport
public static boolean printReport(InputStream inputStream, boolean withPrintDialog) throws JRException
- Throws:
JRException- See Also:
print(InputStream, boolean)
-
printReport
public static boolean printReport(JasperPrint jasperPrint, boolean withPrintDialog) throws JRException
- Throws:
JRException- See Also:
print(JasperPrint, boolean)
-
printPage
public static boolean printPage(String sourceFileName, int pageIndex, boolean withPrintDialog) throws JRException
- Throws:
JRException- See Also:
print(String, int, boolean)
-
printPage
public static boolean printPage(InputStream inputStream, int pageIndex, boolean withPrintDialog) throws JRException
- Throws:
JRException- See Also:
print(InputStream, int, boolean)
-
printPage
public static boolean printPage(JasperPrint jasperPrint, int pageIndex, boolean withPrintDialog) throws JRException
- Throws:
JRException- See Also:
print(JasperPrint, int, boolean)
-
printPages
public static boolean printPages(String sourceFileName, int firstPageIndex, int lastPageIndex, boolean withPrintDialog) throws JRException
- Throws:
JRException- See Also:
print(String, int, int, boolean)
-
printPages
public static boolean printPages(InputStream inputStream, int firstPageIndex, int lastPageIndex, boolean withPrintDialog) throws JRException
- Throws:
JRException- See Also:
print(InputStream, int, int, boolean)
-
printPages
public static boolean printPages(JasperPrint jasperPrint, int firstPageIndex, int lastPageIndex, boolean withPrintDialog) throws JRException
- Throws:
JRException- See Also:
print(JasperPrint, int, int, boolean)
-
printPageToImage
public static Image printPageToImage(String sourceFileName, int pageIndex, float zoom) throws JRException
- Throws:
JRException- See Also:
printToImage(String, int, float)
-
printPageToImage
public static Image printPageToImage(InputStream inputStream, int pageIndex, float zoom) throws JRException
- Throws:
JRException- See Also:
printToImage(InputStream, int, float)
-
printPageToImage
public static Image printPageToImage(JasperPrint jasperPrint, int pageIndex, float zoom) throws JRException
- Throws:
JRException- See Also:
printToImage(JasperPrint, int, float)
-
-