protected ReportProcessor createReportProcessor( OutputStream fout ) throws Exception { PdfOutputProcessor outputProcessor = new PdfOutputProcessor( report.getConfiguration(), fout, report.getResourceManager() ); return new PageableReportProcessor( report, outputProcessor ); } };
public void render() throws Exception { createReport(); ClassLoader originalClassloader = Thread.currentThread().getContextClassLoader(); try { // we need to change the current classloader for the reporting to find our plugin classes Thread.currentThread().setContextClassLoader( KettleReportBuilder.class.getClassLoader() ); switch ( options.getOutputType() ) { case PDF: PdfReportUtil.createPDF( report, targetFilename ); break; case DOC: RTFReportUtil.createRTF( report, targetFilename ); break; case XLS: ExcelReportUtil.createXLS( report, targetFilename ); break; case HTML: HtmlReportUtil.createDirectoryHTML( report, targetFilename ); break; case CSV: CSVReportUtil.createCSV( report, targetFilename ); break; default: break; } } finally { Thread.currentThread().setContextClassLoader( originalClassloader ); } }
/** * DefaultConstructor. Loads the module specification. * * @throws ModuleInitializeException * if an error occured. */ public PdfPageableModule() throws ModuleInitializeException { loadModuleInfo(); }
if ( isValid() == false ) { setError( new ReportProcessingException( "Error: The task is not configured properly." ) ); return; setError( null ); try { final MasterReport masterReport = getReport(); final Configuration configuration = masterReport.getConfiguration(); final ContentLocation contentLocation = getBodyContentLocation(); final NameGenerator nameGenerator = getBodyNameGenerator(); final ContentItem contentItem = contentLocation.createItem( nameGenerator.generateName( null, "application/pdf" ) ); final PdfOutputProcessor outputProcessor = new PdfOutputProcessor( configuration, outputStream ); final PageableReportProcessor streamReportProcessor = new PageableReportProcessor( masterReport, outputProcessor ); try { final ReportProgressListener[] progressListeners = getReportProgressListeners(); for ( int i = 0; i < progressListeners.length; i++ ) { final ReportProgressListener listener = progressListeners[i]; setError( e );
protected PdfDocumentWriter createPdfDocumentWriter() { return new PdfDocumentWriter( (PdfOutputProcessorMetaData) getMetaData(), getOutputStream(), getResourceManager() ); }
protected void processingContentFinished() { if ( isContentGeneratable() == false ) { return; } if ( writer != null ) { this.writer.close(); this.metaData.commit(); } }
protected void processLogicalPage( final LogicalPageKey key, final LogicalPageBox logicalPage ) throws ContentProcessingException { try { if ( writer == null ) { writer = createPdfDocumentWriter(); writer.open(); } writer.processLogicalPage( key, logicalPage ); } catch ( Exception e ) { throw new ContentProcessingException( "Failed to generate PDF document", e ); } }
protected void processPhysicalPage( final PageGrid pageGrid, final LogicalPageBox logicalPage, final int row, final int col, final PhysicalPageKey pageKey ) throws ContentProcessingException { try { if ( writer == null ) { writer = createPdfDocumentWriter(); writer.open(); } writer.processPhysicalPage( pageGrid, logicalPage, row, col, pageKey ); } catch ( Exception e ) { throw new ContentProcessingException( "Failed to generate PDF document", e ); } }
public PdfOutputProcessor( final Configuration configuration, final OutputStream outputStream ) { this( configuration, outputStream, PdfOutputProcessor.createResourceManager() ); }
protected ReportProcessor createReportProcessor( OutputStream fout ) throws Exception { PdfOutputProcessor outputProcessor = new PdfOutputProcessor( masterReport.getConfiguration(), fout, masterReport.getResourceManager() ); return new PageableReportProcessor( masterReport, outputProcessor ); } };
/** * Concates and saves a list of reports to PDF format. * * @param report * the report. * @param fileName * target file name. * @return true if the report has been successfully exported, false otherwise. */ public static boolean createPDF( final MasterReport report, final String fileName ) throws ReportProcessingException, IOException { return createPDF( report, new File( fileName ) ); } }
protected ReportProcessor createReportProcessor( OutputStream fout ) throws Exception { PdfOutputProcessor outputProcessor = new PdfOutputProcessor( masterReport.getConfiguration(), fout, masterReport.getResourceManager() ); return new PageableReportProcessor( masterReport, outputProcessor ); } };
try { out = new BufferedOutputStream( new FileOutputStream( fileName ) ); final boolean retval = createPDF( report, out ); out.close(); out = null;
new PdfOutputProcessor( report.getConfiguration(), out, report.getResourceManager() ); proc = new PageableReportProcessor( report, outputProcessor ); proc.processReport();
HtmlReportUtil.createStreamHTML( report, System.getProperty( "user.home" ) //$NON-NLS-1$ + "/stylekey-reference.html" ); //$NON-NLS-1$ PdfReportUtil.createPDF( report, System.getProperty( "user.home" ) //$NON-NLS-1$ + "/stylekey-reference.pdf" ); //$NON-NLS-1$ } catch ( Exception e ) {
new PdfOutputProcessor( report.getConfiguration(), fout, report.getResourceManager() ); proc = new PageableReportProcessor( report, outputProcessor ); if ( progressListener != null ) {
HtmlReportUtil.createStreamHTML( report, System.getProperty( "user.home" ) //$NON-NLS-1$ + "/datasource-reference.html" ); //$NON-NLS-1$ PdfReportUtil.createPDF( report, System.getProperty( "user.home" ) //$NON-NLS-1$ + "/datasource-reference.pdf" ); //$NON-NLS-1$ } catch ( Exception e ) {
/** * Saves a report to PDF format. * * @param report * the report. * @return true or false. */ public static boolean createPDF( final MasterReport report ) throws ReportProcessingException { final OutputStream out = new NullOutputStream(); try { final PdfOutputProcessor outputProcessor = new PdfOutputProcessor( report.getConfiguration(), out, report.getResourceManager() ); final PageableReportProcessor proc = new PageableReportProcessor( report, outputProcessor ); proc.processReport(); return true; } catch ( ReportParameterValidationException e ) { return true; } catch ( Exception e ) { logger.error( "Writing PDF failed.", e ); throw new ReportProcessingException( "Failed to create PDF", e ); } }
HtmlReportUtil.createStreamHTML( report, System.getProperty( "user.home" ) //$NON-NLS-1$ + "/object-reference.html" ); //$NON-NLS-1$ PdfReportUtil.createPDF( report, System.getProperty( "user.home" ) + "/object-reference.pdf" ); //$NON-NLS-1$ //$NON-NLS-2$ } catch ( Exception e ) { System.err.println( "The report processing failed." ); //$NON-NLS-1$