Wednesday, July 3, 2013

Generating PDF report using DataTemplate and RTF template in XML Publisher



Generating PDF report using DataTemplate(XML Format) and RTF(XSL Format) template in XML Publisher

import oracle.apps.xdo.template.FOProcessor;
.
.
.
public static void main(String[] args)
{
FOProcessor processor = new FOProcessor();
processor.setData(args[0]); // set XML input file
processor.setTemplate(args[1]); // set XSL input file
processor.setOutput(args[2]); //set output file
processor.setOutputFormat(FOProcessor.FORMAT_PDF);
// Start processing
try
{
processor.generate();
}
catch (XDOException e)
{
e.printStackTrace();
System.exit(1);
}
System.exit(0);
}
import java.io.InputStream;
import java.io.OutputStream;
import oracle.apps.xdo.template.FOProcessor;
.
.
.
public void runFOProcessor(InputStream xmlInputStream,
InputStream xslInputStream,
OutputStream pdfOutputStream)
{
FOProcessor processor = new FOProcessor();
processor.setData(xmlInputStream);
processor.setTemplate(xslInputStream);
processor.setOutput(pdfOutputStream);
// Set output format (for PDF generation)
processor.setOutputFormat(FOProcessor.FORMAT_PDF);
// Start processing
try
{
processor.generate();
}
catch (XDOException e)
{
e.printStackTrace();
System.exit(1);
}
System.exit(0);
}

Related Query: 

For Data Template: 
=> select data_source_code from  XDO_TEMPLATES_VL where template_code=XXLSP and application_short_name='IBE' ;

For Rtf Template:
=> select file_data from  xdo_lobs where lob_code='XDO Template short Code' and lob_type='XDO Template Type' and application_short_name='IBE';

 

No comments:

Post a Comment