本文整理汇总了Java中net.sf.jasperreports.export.SimplePdfExporterConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java SimplePdfExporterConfiguration类的具体用法?Java SimplePdfExporterConfiguration怎么用?Java SimplePdfExporterConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimplePdfExporterConfiguration类属于net.sf.jasperreports.export包,在下文中一共展示了SimplePdfExporterConfiguration类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: savePDFReportToOutputStream
import net.sf.jasperreports.export.SimplePdfExporterConfiguration; //导入依赖的package包/类
/**
* Generates a PDF report from a pre-compiled report and returns it into an output stream.
*
* @param jasperPrint
* JasperPrint object which contains a compiled report.
* @param exportParameters
* Export parameters than can be added to configure the resulting report.
* @param outputStream
* The output stream used to return the report.
* @throws JRException
* In case there is any error generating the report an exception is thrown with the
* error message.
*/
public static void savePDFReportToOutputStream(JasperPrint jasperPrint,
Map<Object, Object> exportParameters, OutputStream outputStream) throws JRException {
if (exportParameters != null && exportParameters.size() > 0) {
final JRPdfExporter exporter = new JRPdfExporter();
SimpleExporterInput exporterInput = new SimpleExporterInput(jasperPrint);
SimpleOutputStreamExporterOutput exporterOutput = new SimpleOutputStreamExporterOutput(
outputStream);
SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
String jsContent = (String) exportParameters.get(PDF_JAVASCRIPT);
if (jsContent != null) {
configuration.setPdfJavaScript(jsContent);
}
exporter.setExporterInput(exporterInput);
exporter.setExporterOutput(exporterOutput);
exporter.setConfiguration(configuration);
exporter.exportReport();
} else {
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
}
}
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:34,代码来源:ReportingUtils.java
示例2: concatPDFReport
import net.sf.jasperreports.export.SimplePdfExporterConfiguration; //导入依赖的package包/类
/**
* Returns a PDF file into an output stream as result of the concatenation of the JasperPrint
* objects list passed as parameter.
*
* @param jasperPrintList
* A list of JasperPrint objects.
* @param createBookmarks
* A flag to indicate if the document should contain bookmarks, to mark the beginning of
* each individual document that was part of the initial document list.
* @param outputStream
* The output stream used for returning the report.
* @param reportConfiguration
* An optional configuration for the report.
* @throws JRException
* In case there is any error compiling the report an exception is thrown with the error
* message.
*/
public static void concatPDFReport(List<JasperPrint> jasperPrintList, boolean createBookmarks,
OutputStream outputStream, SimplePdfExporterConfiguration reportConfiguration)
throws JRException {
JRPdfExporter exporter = new JRPdfExporter();
SimpleOutputStreamExporterOutput exporterOutput = new SimpleOutputStreamExporterOutput(
outputStream);
SimplePdfExporterConfiguration configuration = reportConfiguration != null ? reportConfiguration
: new SimplePdfExporterConfiguration();
reportConfiguration.setCreatingBatchModeBookmarks(createBookmarks);
exporter.setConfiguration(configuration);
exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList));
exporter.setExporterOutput(exporterOutput);
exporter.exportReport();
}
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:35,代码来源:ReportingUtils.java
示例3: concatPDFReportEncrypted
import net.sf.jasperreports.export.SimplePdfExporterConfiguration; //导入依赖的package包/类
/**
* Returns an encrypted PDF file into an output stream as result of the concatenation of the
* JasperPrint objects list passed as parameter.
*
* @param jasperPrintList
* A list of JasperPrint objects.
* @param createBookmarks
* A flag to indicate if the document should contain bookmarks, to mark the beginning of
* each individual document that was part of the initial document list.
* @param userPassword
* A String that contains the user password of the resulting document.
* @param ownerPassword
* A String that contains the owner password of the resulting document.
* @param outputStream
* The output stream used for returning the report.
* @throws JRException
* In case there is any error compiling the report an exception is thrown with the error
* message.
*/
public static void concatPDFReportEncrypted(List<JasperPrint> jasperPrintList,
boolean createBookmarks, String userPassword, String ownerPassword, OutputStream outputStream)
throws JRException {
JRPdfExporter exporter = new JRPdfExporter();
SimpleOutputStreamExporterOutput exporterOutput = new SimpleOutputStreamExporterOutput(
outputStream);
SimplePdfExporterConfiguration reportConfiguration = new SimplePdfExporterConfiguration();
reportConfiguration.setEncrypted(true);
reportConfiguration.set128BitKey(true);
reportConfiguration.setUserPassword(userPassword);
reportConfiguration.setOwnerPassword(ownerPassword);
reportConfiguration.setCreatingBatchModeBookmarks(createBookmarks);
exporter.setConfiguration(reportConfiguration);
exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList));
exporter.setExporterOutput(exporterOutput);
exporter.exportReport();
}
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:40,代码来源:ReportingUtils.java
示例4: pdf
import net.sf.jasperreports.export.SimplePdfExporterConfiguration; //导入依赖的package包/类
/**
*
*/
public void pdf() throws JRException
{
long start = System.currentTimeMillis();
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(new SimpleExporterInput("build/reports/BookReport.jrprint"));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput("build/reports/BookReport.pdf"));
SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
configuration.setCreatingBatchModeBookmarks(true);
exporter.setConfiguration(configuration);
exporter.exportReport();
//JasperExportManager.exportReportToPdfFile("build/reports/BookReport.jrprint");
System.err.println("PDF creation time : " + (System.currentTimeMillis() - start));
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:20,代码来源:BookApp.java
示例5: pdf
import net.sf.jasperreports.export.SimplePdfExporterConfiguration; //导入依赖的package包/类
/**
*
*/
public void pdf() throws JRException
{
long start = System.currentTimeMillis();
File sourceFile = new File("build/reports/PdfEncryptReport.jrprint");
JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".pdf");
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
configuration.setEncrypted(true);
configuration.set128BitKey(true);
configuration.setUserPassword("jasper");
configuration.setOwnerPassword("reports");
configuration.setPermissions(PdfWriter.ALLOW_COPY | PdfWriter.ALLOW_PRINTING);
exporter.setConfiguration(configuration);
exporter.exportReport();
System.err.println("PDF creation time : " + (System.currentTimeMillis() - start));
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:28,代码来源:PdfEncryptApp.java
示例6: pdf
import net.sf.jasperreports.export.SimplePdfExporterConfiguration; //导入依赖的package包/类
/**
*
*/
public void pdf() throws JRException
{
long start = System.currentTimeMillis();
List<JasperPrint> jasperPrintList = new ArrayList<JasperPrint>();
jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report1.jrprint"));
jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report2.jrprint"));
jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report3.jrprint"));
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput("build/reports/BatchExportReport.pdf"));
SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
configuration.setCreatingBatchModeBookmarks(true);
exporter.setConfiguration(configuration);
exporter.exportReport();
System.err.println("PDF creation time : " + (System.currentTimeMillis() - start));
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:24,代码来源:BatchExportApp.java
示例7: concatReport
import net.sf.jasperreports.export.SimplePdfExporterConfiguration; //导入依赖的package包/类
private void concatReport(Report[] reports, Collection<JasperPrint> jrPrintReports,
HttpServletResponse response, boolean directPrint) {
try {
String filename = "";
boolean createBookmarks = true;
SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
if (reports.length == 1) {
filename = reports[0].getFilename();
createBookmarks = false;
} else if (reports.length > 1) {
filename = reports[0].getTemplateInfo().getReportFilename();
filename = filename.replaceAll("@[email protected]", "");
filename = filename.replaceAll("@[email protected]", "");
filename = filename.replaceAll(" ", "_");
filename = filename.replaceAll("-", "");
filename = filename + ".pdf";
}
if (!directPrint) {
response.setHeader("Content-disposition", "attachment" + "; filename=" + filename);
} else {
configuration.setPdfJavaScript("this.print();");
}
ReportingUtils.concatPDFReport(new ArrayList<JasperPrint>(jrPrintReports), createBookmarks,
response.getOutputStream(), configuration);
} catch (Exception e) {
log4j.error(e);
}
}
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:29,代码来源:PrintController.java
示例8: getExporter
import net.sf.jasperreports.export.SimplePdfExporterConfiguration; //导入依赖的package包/类
@Override
protected JRPdfExporter getExporter(JasperReportsConfiguration jContext, JRExportProgressMonitor monitor, File file) {
JRPdfExporter exp = new JRPdfExporter(jContext);
exp.setExporterOutput(new SimpleOutputStreamExporterOutput(file));
SimplePdfExporterConfiguration conf = new SimplePdfExporterConfiguration();
exp.setConfiguration(conf);
SimplePdfReportConfiguration rconf = new SimplePdfReportConfiguration();
setupReportConfiguration(rconf, monitor);
exp.setConfiguration(rconf);
return exp;
}
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:16,代码来源:ExportAsPdfAction.java
示例9: pdfa1
import net.sf.jasperreports.export.SimplePdfExporterConfiguration; //导入依赖的package包/类
/**
*
*/
public void pdfa1() throws JRException
{
long start = System.currentTimeMillis();
try{
ByteArrayOutputStream os = new ByteArrayOutputStream();
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(os));
JasperPrint jp = (JasperPrint)JRLoader.loadObject(new File("build/reports/FirstJasper.jrprint"));
// Exclude transparent images when exporting to PDF; elements marked with the key 'TransparentImage'
// will be excluded from the exported PDF
jp.setProperty("net.sf.jasperreports.export.pdf.exclude.key.TransparentImage", null);
exporter.setExporterInput(new SimpleExporterInput(jp));
SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
// Include structure tags for PDF/A-1a compliance; unnecessary for PDF/A-1b
configuration.setTagged(true);
configuration.setPdfaConformance(PdfaConformanceEnum.PDFA_1A);
// Uncomment the following line and specify a valid path for the ICC profile
// configuration.setIccProfilePath("path/to/ICC/profile");
exporter.setConfiguration(configuration);
exporter.exportReport();
FileOutputStream fos = new FileOutputStream("build/reports/FirstJasper_pdfa.pdf");
os.writeTo(fos);
fos.close();
}catch(Exception e){
e.printStackTrace();
}
System.err.println("PDF/A-1a creation time : " + (System.currentTimeMillis() - start));
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:44,代码来源:JasperApp.java
示例10: fillPDF
import net.sf.jasperreports.export.SimplePdfExporterConfiguration; //导入依赖的package包/类
public ByteArrayOutputStream fillPDF(JasperPrint jasperPrint) throws Exception{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try{
//JRPdfExporter exporter = new JRPdfExporter();
//exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
StringBuilder javaScript = new StringBuilder("this.zoom=").append( "50" ).append(";")
// Hide the Preferences menu item
.append("app.hideMenuItem(\"GeneralPrefs\");")
// Hide the Email and toolbar items
.append("app.hideMenuItem(\"AcroSendMail:SendMail\");")
.append("app.hideToolbarButton(\"AcroSendMail:SendMail\");")
// Hide the Review Tracker
.append("app.hideMenuItem(\"Annots:ReviewTracker\");")
// Hide the Spelling Check menu item
.append("app.hideMenuItem(\"Spelling:Spelling\");")
// Hide the digital ID menu item
.append("app.hideMenuItem(\"ppklite:UserSettings\");")
.append("app.hideMenuItem(\"DIGSIG:DigitalSignatures\");")
// Hide the Trusted Identities menu item
.append("app.hideMenuItem(\"PUBSEC:AddressBook\");")
// Turn off Auto-Complete
.append("this.noautocomplete = true;")
// Turn off Acrobat forms caching
.append("this.nocache = true;");
List<JasperPrint> jasperPrintList = new ArrayList<JasperPrint>();
jasperPrintList.add(jasperPrint);
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(baos));
SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
configuration.setCreatingBatchModeBookmarks(true);
exporter.setConfiguration(configuration);
exporter.exportReport();
/*exporter.setParameter(JRPdfExporterParameter.PDF_JAVASCRIPT, javaScript.toString() );
exporter.setParameter(JRPdfExporterParameter.OUTPUT_STREAM,baos); */
exporter.exportReport();
//JasperExportManager.exportReportToPdfStream(jasperPrint, baos);
}catch (Throwable e){
e.printStackTrace();
}
return baos;
}
开发者ID:ganzux,项目名称:SIRME,代码行数:52,代码来源:GenerateReport.java
注:本文中的net.sf.jasperreports.export.SimplePdfExporterConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论