Tuesday, May 26, 2015

How to Convert RTF to XSL-FO using BI PUBLISHER API in Oracle Apps (Example)










 Oracle Has shared us a set of BI Publisher Java Classes for performing various BI Publisher function like converting RTF to XSL-FO, generating PDF output from XSL-FO and XML etc.
In this post, we will convert a RTF file to XSL-FO file using the standard Oracle BI Publisher API (Java based).

STEP1: Prepare a sample RTF Template

clip_image002[4]

STEP2: Prepare the Java wrapper Class for calling Standard RTFProcessor


Filename: convertrtftoxsl.java

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.security.*;
import java.util.Arrays;
import java.util.Collections;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import java.io.*;
import java.security.spec.*;
import oracle.apps.xdo.template.RTFProcessor;

public class convertrtftoxsl {

  public static void main(String[] args)
  {
    try
    {
          FileInputStream   fIs  = new FileInputStream(args[0]);  //input RTF template
      FileOutputStream  fOs  = new FileOutputStream(args[1]); // output XSL File

      RTFProcessor rtfProcessor = new RTFProcessor(fIs);
      rtfProcessor.setOutput(fOs);   
      rtfProcessor.process();
    }
    catch (Exception e)
    {
      e.printStackTrace();
      System.exit(1);
    }
    System.exit(0);
  }

Step3: Compile the Java wrapper Class

javac -classpath $CLASSPATH convertrtftoxsl.java

Step 4: Copy the Wrapper Class to JAVA_TOP

cp convertrtftoxsl.class $JAVA_TOP

Step5: Place the RTF file in Desired Directory and Call the Wrapper Java Class

java -classpath $CLASSPATH convertrtftoxsl ./RTFTEMPLATEEX.rtf ./RTFTEMPLATEEX.xsl
clip_image004[4]

STEP6: Check the Generated XSL-FO file


clip_image006[4]

Now the Command given in the step5 can be called from HOST based concurrent program in Oracle Apps.
Happy Sharing J Enjoy Learning J

2 Responses to “How to Convert RTF to XSL-FO using BI PUBLISHER API in Oracle Apps (Example)”

Ketan C. said...
December 9, 2021 at 8:17 AM

How to get the oracle.apps.xdo.template.RTFProcessor classes?
I have xdocore jar but how to include it in EBS


Zeddddd said...
August 30, 2023 at 11:06 AM

Hi, can you share the jar file for this?
oracle.apps.xdo.template.RTFProcessor


Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.