Ok; here's what I have so far:

the code in the java, when run from the command line makes the pdf file, with the data in it. That code looks like this:

import java.datasource.dom4j.Dom4jDataSource; import java.xmlreport.ProcessPdf; import java.xmlreport.ProcessReport; import java.io.*; /** * Generate a PDF report using an XML file as the datasource. For this + use case this is the entire set of code needed * to use Windward Reports. For different output formats and/or differ +ent datasources, the code will change. */ public class GeneratePdfReport { /** * Generate a PDF report using an XML file as the datasource. * @param template The report template. * @param report The generated report. * @param xmlData The XML data file. */ public static void generatePdfReport(String template_filename, String + report_filename, String xmlData_filename) throws Exception { InputStream template = new FileInputStream(template_filename); OutputStream report = new FileOutputStream(report_filename) +; InputStream xmlData = new FileInputStream(xmlData_filename); // generally called once when your app starts, not in here. ProcessReport.init(); // create the report. ProcessPdf proc = new ProcessPdf(template, report); proc.processSetup(); proc.processData(new Dom4jDataSource(xmlData), ""); proc.processComplete(); } public static void main(String []args) throws Exception{ String template_filename = "/path/PurchaseOrderTemplate.rtf"; String report_filename = "/path/order.pdf"; String xmlData_filename= "/path/order.xml"; GeneratePdfReport myTest = new GeneratePdfReport(); myTest.generatePdfReport( template_filename, report_filename, xmlData_filename ); } }

this works like a charm BUT, when I put this code inside inline::java, get ride of the main, it runs, but the pdf file is empty. Here's the code:

#!/usr/bin/perl -w use strict; use CGI::Carp qw(fatalsToBrowser); BEGIN { $ENV{CLASSPATH}='.:/path/java.jar'; } use Inline Java => <<'END', CLASSPATH => $ENV{CLASSPATH}; import java.datasource.dom4j.Dom4jDataSource; import java.xmlreport.ProcessPdf; import java.xmlreport.ProcessReport; import java.io.*; /** * Generate a PDF report using an XML file as the datasource. For this + use case this is the entire set of code needed * to use Windward Reports. For different output formats and/or differ +ent datasources, the code will change. */ public class GeneratePdfReport { /** * Generate a PDF report using an XML file as the datasource. * @param template The report template. * @param report The generated report. * @param xmlData The XML data file. */ public static void generatePdfReport(String template_filename, String + report_filename, String xmlData_filename) throws Exception { InputStream template = new FileInputStream(template_filename); OutputStream report = new FileOutputStream(report_filename) +; InputStream xmlData = new FileInputStream(xmlData_filename); // generally called once when your app starts, not in here. ProcessReport.init(); // create the report. ProcessPdf proc = new ProcessPdf(template, report); proc.processSetup(); proc.processData(new Dom4jDataSource(xmlData), ""); proc.processComplete(); } } END text("does this work still 2?"); my $template_file = '/path/PurchaseOrderTemplate.rtf'; my $report_file = '/path/order.pdf'; my $xml_file = '/path/order.xml'; my $generator = GeneratePdfReport->new; $generator->generatePdfReport( "$template_file", "$report_file", "$xml_file" ); print "yes it did\n"; ###################################################################### +######### sub text { print "Content-type: text/html\n\n"; print "<table width='340' border='0' cellspacing='0' cellpadding='0'>< +tr><td>"; print "<p><strong>@_</strong></p>"; print "</td></tr></table>"; } ###################################################################### +########

also, the print command at the end of the code won't print. Any suggestions?


In reply to inline::java problem by cliffrubinmusic

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.