XML TO PDF printing

Hi,
I managed to create a pdf File, from a XML document, using XSLT and XSL-FO.
I'd like now to print this pdf File from my Java application. Is there a simple way of doing this ?
Thank you in advance for any help.
import java.io.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
import javax.xml.transform.sax.*;
import org.apache.avalon.framework.*;
import org.apache.avalon.framework.logger.*;
import org.apache.fop.apps.*;
* This class converts an XML file to PDF using JAXP (XSLT) and FOP (XSL-FO).
* @author
public class XmlToPdf {
private static final String BASE_DIR = "./test/";
private static final String FILE = "test";
* Converts an XML file to a PDF file using JAXP and FOP.
* @param xmlFile The XML file
* @param xslFile The XSLT stylesheet file
* @param pdfFile The output PDF file
* @throws IOException In case of an I/O problem
* @throws FOPException In case of a FOP problem
* @throws TransformerException In case of a XSL transformation problem
public void convertXML2PDF(File xmlFile, File xsltFile, File pdfFile)
throws IOException, FOPException, TransformerException {
//Construct driver
Driver driver = new Driver();
//Setup logger
Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
driver.setLogger(logger);
//Setup Renderer (output format)
driver.setRenderer(Driver.RENDER_PDF);
//Setup output
OutputStream out = new FileOutputStream(pdfFile);
out = new BufferedOutputStream(out);
try {
driver.setOutputStream(out);
//Setup XSLT
TransformerFactory myFactory = TransformerFactory.newInstance();
Transformer myTransformer = myFactory.newTransformer(new StreamSource(xsltFile));
//Setup input for XSLT transformation
Source src = new StreamSource(xmlFile);
//The generated FO (resulting SAX events) must be sent to FOP
Result res = new SAXResult(driver.getContentHandler());
//Start XSLT transformation and FOP processing
myTransformer.transform(src, res);
} finally {
out.flush();
out.close();
* Main method.
* @param args command-line arguments
public static void main(String[] args) {
try {
System.out.println("Starting XML TO PDF Transformation...\n");
//Base Directory...
File baseDir = new File(BASE_DIR);
//Input and output files...
File xmlFile = new File(baseDir, FILE+".xml");
File xsltFile = new File(baseDir, FILE+".xsl");
File pdfFile = new File(baseDir, FILE+".pdf");
System.out.println("Input: XML (" + xmlFile + ")");
System.out.println("XSL Stylesheet: " + xsltFile);
System.out.println("Output: PDF (" + pdfFile + ")");
System.out.println();
System.out.println("Transforming...");
XmlToPdf app = new XmlToPdf();
// Do the transformation...
app.convertXML2PDF(xmlFile, xsltFile, pdfFile);
System.out.println();
System.out.println("The pdf was created succesfully !\n");
} catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
System.exit(-1);

hi everybody
i use the code of the class XmlToPdf but i have a problem when i run it
[ERROR] Unsupported element encountered: html (Namespace: default). Source context: unavailable
[ERROR] Expected XSL-FO (root, page-sequence, etc.), SVG (svg, rect, etc.) or elements from another supported language.
java.lang.NullPointerException
javax.xml.transform.TransformerException: java.lang.NullPointerException
     at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1226)
     at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:638)
     at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1088)
     at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1066)
     at com.clear2pay.toolbox.reports.fop.XmlToPdf .convertXML2PDF(XmlToPdf java:526)
     at com.clear2pay.toolbox.reports.fop.XmlToPdf .main(XmlToPdf .java:557)
i don't see where is the problem.
this is the XML File that i use
<?xml version="1.0" encoding="UTF-8"?>
<changelog>
     <entry>
          <date>2002-12-09</date>
          <time>14:21</time>
          <author><![CDATA[jmc]]></author>
          <file>
               <name>develop/web/vds-rel1/c/su_rgd0_c.jsp</name>
               <revision>1.9</revision>
               <prevrevision>1.4</prevrevision>
          </file>
          <msg><![CDATA[moved cancel button into seperate for so it doesn't invoke js validation]]></msg>
     </entry>
     <entry>
          <date>2002-12-09</date>
          <time>13:41</time>
          <author><![CDATA[jmc]]></author>
          <file>
               <name>develop/web/vds-rel1/c/su_pm0_c.jsp</name>
               <revision>1.18</revision>
               <prevrevision>1.124</prevrevision>
          </file>
          <msg><![CDATA[moved << and >> to the correct column]]></msg>
     </entry>     
</changelog>
and this is the XSL that i use
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
version='1.0'>
<xsl:param name="title"/>
<xsl:param name="module"/>
<xsl:param name="cvsweb"/>
<xsl:output method="html" indent="yes" encoding="US-ASCII"
doctype-public="-//W3C//DTD HTML 4.01//EN"
doctype-system="http://www.w3.org/TR/html401/strict.dtd"/>
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="attribute::*[. != '']"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="changelog">
<html>
<head>
<title><xsl:value-of select="$title"/></title>
<style type="text/css">
body, p {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 80%;
color: #000000;
background-color: #ffffff;
tr, td {
font-family: Verdana, Arial, Helvetica, sans-serif;
background: #eeeee0;
td {
padding-left: 20px;
.dateAndAuthor {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
text-align: left;
background: #a6caf0;
padding-left: 3px;
a {
color: #000000;
pre {
font-weight: bold;
</style>
</head>
<body>
<h1>
<a name="top"><xsl:value-of select="$title"/></a>
</h1>
<p style="text-align: right">Designed for use with Ant.</p>
<hr/>
<table border="0" width="100%" cellspacing="1">
<xsl:apply-templates select=".//entry">
<xsl:sort select="date" data-type="text" order="descending"/>
<xsl:sort select="time" data-type="text" order="descending"/>
</xsl:apply-templates>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="entry">
<tr>
<td class="dateAndAuthor">
<xsl:value-of select="date"/><xsl:text> </xsl:text><xsl:value-of select="time"/><xsl:text> </xsl:text><xsl:value-of select="author"/>
</td>
</tr>
<tr>
<td>
<pre>
<xsl:apply-templates select="msg"/></pre>
<ul>
<xsl:apply-templates select="file"/>
</ul>
</td>
</tr>
</xsl:template>
<xsl:template match="date">
<i><xsl:value-of select="."/></i>
</xsl:template>
<xsl:template match="time">
<i><xsl:value-of select="."/></i>
</xsl:template>
<xsl:template match="author">
<i>
<a>
<xsl:attribute name="href">mailto:<xsl:value-of select="."/></xsl:attribute>
<xsl:value-of select="."/></a>
</i>
</xsl:template>
<xsl:template match="file">
<li>
<a>
<xsl:choose>
<xsl:when test="string-length(prevrevision) = 0 ">
<xsl:attribute name="href"><xsl:value-of select="$cvsweb"/><xsl:value-of select="$module" />/<xsl:value-of select="name" />?rev=<xsl:value-of select="revision" />&content-type=text/x-cvsweb-markup</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href"><xsl:value-of select="$cvsweb"/><xsl:value-of select="$module" />/<xsl:value-of select="name" />?r1=<xsl:value-of select="revision" />&r2=<xsl:value-of select="prevrevision"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="name" /> (<xsl:value-of select="revision"/>)</a>
</li>
</xsl:template>
<!-- Any elements within a msg are processed,
so that we can preserve HTML tags. -->
<xsl:template match="msg">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
Thank you in advance for any help.

Similar Messages

  • Barcode printing in XML report PDF output

    Hi All,
            I want to print barcode of invoice number / purchase order number in the XML report PDF output.
            Anyone please suggest me with your ideas and experience.

    Hi Bogdan,
    The steps mentioned in the doc is what i did in order.
    I couldn't understand the step # 13 & 14.
    Log in as XML Publisher Administrator
    Navigate to Administration --> Font Files --> Create Font File
    Available fields are Font Name and File
    --> for Font Name, choose any descriptive name
    --> file will browse your PC to locate the font file
    Navigate to Font Mappings -->Create Font Mapping Set
    Mapping name is the name you will give to a set of fonts.
    Mapping code is the internal name you will give to this set
    Type: 'PDF Form' for PDF templates. 'FO to PDF' for all other template types.
    Create Font Mapping (this allows you to add fonts to a set)
    Font Family is the exact same name you see in MS Word under Font. If you don't use the same name the font will not be picked up at runtime.
    Style and weight must also match how you use the font in the RTF or PDF layout template. Normal and Normal are good defaults.
    Language and Territory should remain blank (NULL) unless you have a strong business reason, as these fields can cause the font not to be picked up at runtime.
    Navigate to Configuration General -> FO Processing -->Font Mapping Set. This can also be done at Data Definition and Template level, via the corresponding Edit Configuration button on those pages. The hierarchy is Site-> Data Def -> Template.
    Select your new mapping set.
    Make sure the font is not referenced under File --> Properties --> Custom in the RTF template file.
    Under General, set a Temporary Directory. The font will be stored under a /fonts directory at runtime, initially created the first time the font is used.
    Upload a template that uses your special font and test using preview or by submitting a concurrent request.

  • Problems with special characters with XML/PDF printing

    Hi,
    Our setup:
    Apex Listener 2.0.5
    Oracle DB 11G
    Weblogic
    Apex 4.2.2
    Various recent major browsers
    We used this blog post so we could do some PDF printing with APEX Listener:
    http://marcsewtz.blogspot.be/2013/04/pdf-printing-with-oracle-application.html
    The problem is special characters. For example the "&" sign comes out as "%26amp;" when we export an XML.
    Could anyone provide some insights of what we can do to fix this?
    Regards,
    Joni

    This is a known bug.
    https://support.oracle.com/epmos/faces/BugDisplay?_afrLoop=957905848396285&id=18282188&_afrWindowMode=0&_adf.ctrl-state=168vq5zhn3_233
    The bug 18282188 has been fixed in Apex 4.2.5 version.
    Upgrade the Apex version to 4.2.5 when it is available.

  • Print stored pdf files to a XML Publisher PDF report

    I want to print PDF attachments to a XML Publisher PDF report. How can I do it?
    For eg. We have an iRecruitment vacancy IRC1309 for which the applicants upload pdf resumes. We want to print applicant resumes to a single PDF file for review.
    Any suggestions?
    Thanks in advance,
    Aakash

    Hi Guru,
    I have requirement to show attachment file in AR invoices which is .pdf files in BI Reports or Oracle Report.. Can ony one guide me please.
    Iam able to read blod data from fnd_lob table and also able to see junk data in xml output. Once rft template is generated then it is coming as blank. It does stream lob data. Can you please provide xsl fo statement to read.
    Thanks
    Simon
    Edited by: user13084103 on Nov 7, 2011 4:49 AM
    Edited by: user13084103 on Nov 7, 2011 4:50 AM

  • Problem with pdf printing in Apex 3.2

    Hi All,
    I have apex 3.2 in Oracle 11.1, and the OS is OEL4. I ran the post installation script for granting connect privileges for APEX_030200 also.I have installed BI Publisher in another machine, and configured the URL in apex.
    But the Pdf printing part is still failing.
    when i open the pdf ,the Error is "Adobe Reader could not open 'Applications[1].pdf' because it is either not a supported file type or because the file has been damaged(for exmple, it was sent as an email attachment and wasn't correctly decoded)."
    I tried to open the file using text edtor, the text inside is "ORA-20001: The printing engine could not be reached because either the URL specified is incorrect or a proxy URL needs to be specified"
    My apex machine is 64 bit and BI Publisher machine is 32 bit.
    I ran the following query to verify that the grants were given:
    SELECT * FROM DBA_NETWORK_ACL_PRIVILEGES;
    The result of this query is the following:
    ACL     ACLID     PRINCIPAL     PRIVILEGE     IS_GRANT     INVERT     START_DATE     END_DATE
    /sys/acls/power_users.xml     (RAW)     FLOWS_030000     connect     true     false     (null)     (null)
    /sys/acls/power_users.xml     (RAW)     FLOWS_030100     connect     true     false     (null)     (null)
    /sys/acls/power_users.xml     (RAW)     APEX_030200     connect     true     false     (null)     (null)
    /sys/acls/local-access-users.xml     (RAW)     FLOWS_030100     connect     true     false     (null)     (null)
    /sys/acls/local-access-users.xml     (RAW)     APEX_030200     connect     true     false     (null)     (null)
    Please suggest a solution for this.
    Thanks,
    Sunil

    Sunil
    Verify that the BI server is accessible from the 11g database by executing the SQL below in the 11g database
    select utl_http.request('http://<bi_server_host>:<bi_server_port>/xmlpserver/convert') from dual;
    The response returned should be something similar to
    <HTML><HEAD><TITLE>500 Internal Server Error</TITLE></HEAD><BODY><H1>500 Internal Server Error</H1><PRE>Servlet error: An exception occurred. The current application deployment descriptors do not allow for including it in this response. Please consult the application log for details.</PRE></BODY></HTML>

  • PDF Printing issue (passing static items)

    Hello experts,
    I am starting out with PDF printing from Apex and have a small (I hope) issue. I have downloaded a demo from Oracle site and all works OK.
    To test the ability to create my own RTF templates I have added an additional item on the page called P3_PAWEL
    Then I have added a field in the RTF template (by copying the existing field from elsewhere in the template and changing its property name)
    As a last step I have added the item in the Report Quearies page by clicking on Session State > and adding the P3_PAWEL item to the list.
    When I now print the report all still works OK but I do not see anything on the report where (in the template) I put my P3_PAWEL text field.
    Any ideas what else I am missing here?
    Regards,
    Pawel.

    What you are after is the Oracle XML Publisher Desktop.
    Goto :
    http://www.oracle.com/technology/software/products/publishing/index.html
    and download Oracle XML Publisher Desktop 5.6.2 for Microsoft Windows. It is 100Mb.
    It adds some buttons to MS Word.

  • XML mapping, PDF output

    Hi!
    I am working with the latest JDeveloper release. Does JDeveloper have a tool to create custom layouts from xml data and
    print(output) the results as a pdf file?

    I do not think there is something in JDeveloper. XSL-FO is what you would use for converting from XML to PDF, you will find a good tutorial here:
    http://www.w3schools.com/xslfo/default.asp
    Apache FOP ( http://xmlgraphics.apache.org/fop/ ) is a free implementation of an XSL-FO engine.
    If you want also a visual tool to avoid having to create your XSLFO file manually, you can look at some XSL-FO which are available, one of them is http://www.java4less.com/fopdesigner/fodesigner.php

  • Tomcat/Cocoon/APEX PDF printing. Another issue

    Hi All,
    I am trying to implement my own custom report layout for the following simple Report query
    select e.DEPTNO, d.DNAME, d.LOC, e.ENAME, e.JOB
    from emp e, dept d
    where e.deptno = d.deptno
    The steps are the following
    1. Create Report Query
    2. Download XML file
    3. Use Stylus Studio to create XSL-FO (XSLT 2.0) based on XML data downloaded in
    previous step.
    4. Go back to Report query and upload XSL-FO file to APEX (layout name 'MyLayout' is also specified).
    Finish Report Query creation
    5. Enter Report Query again, select report layout 'MyLayout' and select Test Report
    The result is a failure with some java cocoon exception:
    org.apache.cocoon.ProcessingException: Unknown request object encountered named template : null
    Cocoon stacktrace[hide]
    Exception in StreamGenerator.generate() context://fop_post/sitemap.xmap - 17:32 <map:serialize type="xml">
    context://fop_post/sitemap.xmap - 13:33 <map:generate type="stream">
    Unable to get transformer handler for cocoon://fop_post/xsl context://fop_post/sitemap.xmap - 38:37 <map:serialize type="fo2pdf">
    context://fop_post/sitemap.xmap - 31:39 <map:transform>
    context://fop_post/sitemap.xmap - 30:38 <map:generate>
    context://sitemap.xmap - 1034:92 <map:mount>
    It seems to me that XSL-FO that I created for this layout is rejected somehow by APEX and not passed to Coccon at all.
    Guys, what am I doing wrong ? I will appreciate any help.
    Regards,
    Vadim

    Hi Mike,
    My standard printing is working nicely. That's the custom reporting that I experience problems with.
    After 8 hours of googling and 4 cups of coffee I figured out where the problem was. When you define XSL-FO file you need to 'escape' every occurence of % sign. For example you cannot define width= "100%" because APEX will pass this unchanged to Tomcat and Tomcat in turn will reject this but still passing NULL template pointer to Cocoon. Taking into consideration very poor logging capabilities one can spend hours trying to fugure out what is hapenning. APEX should be smart enough to escape characters or at least there should be a doco somewhere listing the rules you need to follow whem creating FO stylesheets.
    I must admit that the whole APEX PDF printing using Tomcat/Cocoon (and probably Fop because that's what used by Cocoon behind the scene anyway) is unfortunately a hack. Reporting does not have to be that complex.
    I would be extremely grateful if somebody can tell me what sort of XML tool is best suited to generate XSL-FO files that can be easily understood by APEX/Tomcat/Cocoon.
    Regards,
    Vadim

  • PDF printing in 2.0

    Hi all,
    the following statement is from Carl Backstrom (and can be found here: Problems with PDF printing, using Apache FOP!
    Hello,
    Well I didn't get your email but I did run through and check my steps again because I'm
    making another viewlet for OC4J and Cocoon and another getting PDF working in XE
    and 2.0 (yes it can be done!).I wonder if Carl managed it to finish the viewlets? And if anyone else here could give me some advice to integrate PDF printing in apex 2.0.
    Thanks in advance
    Markus

    Hello,
    No I've never gotten around to getting that viewlet done but I can give you some pointers.
    On every Report there is a section named External Processing
    There are two attributes
    URL this is the url the xml will get posted to.
    Link Label this is ... well the Link Label
    If you populate these what happens is down by your pagiantion a link shows up with whatever you Link Label is if you click that there is an AJAX pull that grabs an XML feed (it's not the same as the XML feed in the current PDF printing) and posts the XML to the URL endpoint. The XML is posted as form item vXML
    I have an example here http://apex.oracle.com/pls/otn/f?p=11933:133 except I've overridden the standard functionality though to populate an TEXTAREA instead so you can see the XML feed.
    You might want to look at this older PDF howto to show you how to put it together. Between a little bit of sitemap.xmap editing in cocoon and some XSL work the pieces are all there to do it though.
    http://htmldb.oracle.com/pls/otn/f?p=18326:44:6141712725600931::::P44_ID:1522
    Carl

  • Apex 4.2.2 PDF Printing with Apex 2.0 Listener

    We recently installed Apex 4.2 with the Apex 2.0 Listener and can successfully print interactive reports and classic reports to PDF.  I viewed Mark Sewtz PDF Printing with Apex 4.2.2 and saw how he is using third party tools to format reports.  We have also looked into the Jasper Report Integration Toolkit, but have only got it working on the Tomcat environment, not WebLogic.
    I'm trying to download a classic report in PDF format with our logo displayed at the header.  In the print attributes section, there is a section for header.  I've tried adding the following in the header section:
    <img src = "http://hr.unm.edu/common/images/unm_dept_logo.gif">
    No Logo Prints
    #APP_IMAGES#unm_dept_logo.gif
    Prints in header:
    wwv_flow_file_mgr.get_file?
    p_security_group_id=3930016164431413%26p_flow_id=106%26p_fname=unm_dept_logo.gif
    #WORKSPACE_IMAGES#unm_dept_logo.gif
    Prints in header: /i/unm_dept_logo.gif
    I've also added the logo in the report region, prior to the columns printing, but no logo downloads to PDF.
    Does the Apex Listener only render text?  Is there any way to get the logo to print in the header without using a third party tool?  Any suggestions are greatly appreciated.  Thanks!

    Hi,
    There are different options to include images in your PDF exports. What's important to understand though is that with the PDF export functionality we separate the formatting from the actual data. So the formatting is defined in your RTF or XSL-FO templates and the data is stored in the XML that APEX generates based on your report data. We have several formatting options exposed on the print attributes pages, i.e. you can define page formatting, dimensions, fonts, colors, etc - all of these are applied to what we call generic XSL-FO templates. Those templates are generic in that they can be used with different reports, having variable numbers of columns and variable column names. Those formatting attributes can not be used however with named column templates, such as those that you generate with BI Publisher or those third-party tools I talked about in my Blog.
    So if you want to use these formatting options, you need a generic report layout - which you get out of the box using the built-in layout. But you also have the option to create your own generic report layout (see Shared Components -> Report Layouts). When creating a custom generic report layout, you'll get a copy of the built-in layout as a starting point. Once created, you can manually modify this layout to meet your needs. As you edit this template, you'll find a number of #....# substitution strings. This is what APEX uses at runtime to fill in your formatting values as well as to assemble your generic layout based on your result set.
    Now one way to include your own image would be to add an image reference to this generic report layout. You can't use the page header or footer attributes on the print attributes page for that because the FOP rendering engine does not understand or translate HTML. It renders XSL-FO. So to add your own image reference, you need to use XSL-FO mark-up. If you want to add an image to your page header, look for the #PAGE_HEADER# substitution string in the "Page Template" attribute of your generic report layout. You should be able to find the following:
    <fo:inline xsl:use-attribute-sets="page-header">
        #PAGE_HEADER#
    </fo:inline>
    Now assuming you have a file stored in your local images directory on localhost, you could add the following external graphic reference:
    <fo:inline xsl:use-attribute-sets="page-header">
        <fo:external-graphic src="http://localhost:8080/i/cloud.gif" content-height="scale-to-fit" height="30px"  content-width="150px" scaling="non-uniform"/>
        #PAGE_HEADER#
    </fo:inline>
    Once you're done with your chanages, save the report layout and edit your report. Go to the print attributes and select your generic report layout and then run your report page and export the PDF. Provided the APEX Listener is able to find this external image reference, it will now be included above your report in your PDF document.
    Regards,
    Marc

  • Problems with FOP/Apache - Apex PDF printing

    Hello,
    I have configured
    Apex 3.0.1
    iAS 10.1.3.x (http + modplsql)
    OC4J 10.1.3.3 (stand alone)
    FOP for PDF printing
    RDBMS 9.2.0.8 64bits (Solaris)
    following the OTN recipee and this setup does not seem to work for all cases.
    For instance, using the Apex admin interface, I go to the monitoring page :
    Home -> Monitor Page -> Login Attempts
    And click on the Print link (left bottom corner of the page) , it works o.k, the PDF is generated correctly.
    However, if I go to
    Home -> utilities -> Object Reports -> Table Storage Sizes
    and click on the Print link, it does not work. A pdf file is generated with the following text
    <HTML><HEAD><TITLE>500 Internal Server Error</TITLE></HEAD>
    <BODY><H1>500 Internal Server Error</H1>
    <PRE>Servlet error: An exception occurred. The current application deployment descriptors do not allow for including it in this response. Please consult the application log for details.</PRE>
    </BODY>
    </HTML>
    If I check in the application log I see the following error
    07/08/08 11:52:21.584 fop: Servlet error
    oracle.xml.xpath.XPathException: Error in expression: './/BYTES/1024/1024'.
    at oracle.xml.xslt.XSLBuilder.startElement(XSLBuilder.java:468)
    at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1288)
    at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:336)
    at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:303)
    at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:320)
    at oracle.xml.xslt.XSLProcessor.newXSLStylesheet(XSLProcessor.java:712)
    at oracle.xml.xslt.XSLStylesheet.<init>(XSLStylesheet.java:321)
    at oracle.xml.parser.v2.XSLStylesheet.<init>(XSLStylesheet.java:114)
    at apex_fop._jspService(_apex__fop.java:71)
    at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.3.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
    at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
    at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
    at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
    at java.lang.Thread.run(Thread.java:595)
    I do not think it is related to a config/installation issue. It seems a parsing issue with the SQL stmt being executed, but it works for some SQL code and not for other.
    Some users did notice this problem this morning when testing the new PDF printing.
    Any ideas ?
    Nilo Segura
    CERN.

    ups.. sorry for the ugly formatting exercise...

  • PDF Printing with XSL-FO and Apache FOP

    Can anyone show me in the right direction for this? I've been hitting a wall for the past 2 weeks or so and it's really starting to infuriate me. How am I supposed to work this out? Where do I start? Let's say I create a layout file with a WYSIWYG XSL editor, in what format do I export it? XSL, XSLT or XSL-FO? I figured it was XSL-FO, but who knows. I tried them all anyways, but nothing seems to work. I seem to be missing a step or something, 'cause something's definitely not right.
    I created a report query (which actually contains two queries):
    select distinct
    V_Usager.NUMEROPERSONNE NoPersonne,
    V_Usager.NOMUSUEL || ', ' || V_Usager.PRENOM Usager,
    V_Usager.DATENAISSANCE DateNaissance,
    V_Usager.DESCRIPTION Sexe,
    ID_Demande,
    NomNature || nvl2(PrecisionNature,', Précision: ' || PrecisionNature,'') Nature,
    NomCadre,
    decode(IND_Securitaire, 1, 'Oui', '0', 'Non') Securitaire,
    NomRessource,
    DT_Demande,
    Note,
    ltrim(decode(IND_DEMANDEIVAC,1,'Dossier IVAC','') || decode(IND_DEMANDEFLORES,1,', Dossier Florès','') || decode(IND_RISQUECRISE,1,', Risque de crise','') || decode(IND_MENOTTES,1,', Menottes nécessaires','') || decode(IND_ADRESSECONFIDENTIELLE,1,', Adresse confidentielle','') || decode(IND_TELEPHONECONFIDENTIEL,1,', Téléphone confidentiel','') || decode(IND_RISQUEFUGUE,1,', Risque de fugue','') || decode(IND_RISQUEVIOLENCE,1,', Risque de violence','') || decode(IND_MALDESTRANSPORTS,1,', Mal des transports','') || decode(IND_MEDICAMENT,1,', Médicament à remettre','') || decode(IND_SIEGE,1,'',2,', Siège fourni',3,', Siège d''enfant requis',4,', Siège de nouveau-né requis',5,', Siège d''appoint requis') || decode(IND_HANDICAP,1,'',2,', Handicap mental',3,', Handicap physique') || decode(IND_MEDICAMENT,1,', Médicament à remettre','') || decode(IND_JUMELER,1,'',2,', Ne pas jumeler',3,', Ne pas jumeler avec une fille',4,', Ne pas jumeler avec un garçon') || decode(IND_TRANSPORTEUR,1,'',2,', Transporteur féminin',3,', Transporteur masculin') || nvl2(REMARQUEPRECISIONS,', ' || REMARQUEPRECISIONS,''),',') Precisions,
    Disp1.PRENOM || ' ' || Disp1.NOM SaisiePar,
    Disp2.PRENOM || ' ' || Disp2.NOM || nvl2(Elem2.Description, ', ' || Elem2.Description,'') Requerant,
    ltrim(nvl(NOMPERSONNEAVISER,'') || nvl2(TELEPHONEPERSONNEAVISER_1,' ' || substr(TELEPHONEPERSONNEAVISER_1,1,3) || '-' || substr(TELEPHONEPERSONNEAVISER_1,4,3) || '-' || substr(TELEPHONEPERSONNEAVISER_1,7,4),'') || nvl2(TELEPHONEPERSONNEAVISER_2,' ' || substr(TELEPHONEPERSONNEAVISER_2,1,3) || '-' || substr(TELEPHONEPERSONNEAVISER_2,4,3) || '-' || substr(TELEPHONEPERSONNEAVISER_2,7,4),''),',') PersonneAAviser
    from
    TBL_Demande_1,
    TBL_Demande_TRSP_1,
    V_Dispensateur Disp1,
    V_Dispensateur Disp2,
    V_ElemStruct Elem2,
    V_Usager,
    TBL_CadresLegaux,
    TBL_Natures,
    TBL_Ressources
    where
    DemandeID = :P7_IDDEMANDE
    and ID_Demande = DemandeID
    and ID_Usager = UsagerID
    and ID_CLegal = IDCadre
    and ID_Nature = IDNature
    and IND_Ressource = IDRessource
    and ID_Intervenant LIKE Disp1.NumeroDispensateur
    and ID_SaisiePar LIKE Disp2.NumeroDispensateur
    and Elem2.ElemStructID = ID_ElemStructSaisiePar
    select
    to_char(DT_TRANSPORT, 'dd/mm/yyyy') || ' à ' || HR_TRANSPORT || nvl2(DUREE,' durée: ' || DUREE,'') DateTRSP,
    decode(IND_TYPETRANSPORT,1,'Aller',2,'Retour',3,'Aller/Retour') TypeTransport,
    case IND_TYPETRANSPORT
    when 1 then
    DEP_NOM || ', ' || DEP_ADRESSE || ', ' || DEP_CPOSTAL
    when 2 then
    DEST_NOM || ', ' || DEST_ADRESSE || ', ' || DEST_CPOSTAL
    when 3 then
    DEP_NOM || ', ' || DEP_ADRESSE || ', ' || DEP_CPOSTAL
    end AdresseDEP,
    case IND_TYPETRANSPORT
    when 1 then
    DEP_PRECISION
    when 2 then
    DEST_PRECISION
    when 3 then
    DEP_PRECISION
    end ContactDEP,
    case IND_TYPETRANSPORT
    when 1 then
    substr(DEP_TELEPHONE,1,3) || '-' || substr(DEP_TELEPHONE,4,3) || '-' || substr(DEP_TELEPHONE,7,4) || nvl2(DEP_POSTE,' poste ' || DEP_POSTE,'')
    when 2 then
    substr(DEST_TELEPHONE,1,3) || '-' || substr(DEST_TELEPHONE,4,3) || '-' || substr(DEST_TELEPHONE,7,4) || nvl2(DEST_POSTE,' poste ' || DEST_POSTE,'')
    when 3 then
    substr(DEP_TELEPHONE,1,3) || '-' || substr(DEP_TELEPHONE,4,3) || '-' || substr(DEP_TELEPHONE,7,4) || nvl2(DEP_POSTE,' poste ' || DEP_POSTE,'')
    end TelDEP,
    case IND_TYPETRANSPORT
    when 1 then
    DEST_NOM || ', ' || DEST_ADRESSE || ', ' || DEST_CPOSTAL
    when 2 then
    DEP_NOM || ', ' || DEP_ADRESSE || ', ' || DEP_CPOSTAL
    when 3 then
    DEST_NOM || ', ' || DEST_ADRESSE || ', ' || DEST_CPOSTAL
    end AdresseDEST,
    case IND_TYPETRANSPORT
    when 1 then
    DEST_PRECISION
    when 2 then
    DEP_PRECISION
    when 3 then
    DEST_PRECISION
    end ContactDEST,
    case IND_TYPETRANSPORT
    when 1 then
    substr(DEST_TELEPHONE,1,3) || '-' || substr(DEST_TELEPHONE,4,3) || '-' || substr(DEST_TELEPHONE,7,4) || nvl2(DEST_POSTE,' poste ' || DEST_POSTE,'')
    when 2 then
    substr(DEP_TELEPHONE,1,3) || '-' || substr(DEP_TELEPHONE,4,3) || '-' || substr(DEP_TELEPHONE,7,4) || nvl2(DEP_POSTE,' poste ' || DEP_POSTE,'')
    when 3 then
    substr(DEST_TELEPHONE,1,3) || '-' || substr(DEST_TELEPHONE,4,3) || '-' || substr(DEST_TELEPHONE,7,4) || nvl2(DEST_POSTE,' poste ' || DEST_POSTE,'')
    end TelDEST,
    decode(RET_NOM || ', ' || RET_ADRESSE || ', ' || RET_CPOSTAL, ', , ', '', RET_NOM || ', ' || RET_ADRESSE || ', ' || RET_CPOSTAL) AdresseRET,
    RET_PRECISION ContactRET,
    substr(RET_TELEPHONE,1,3) || '-' || substr(RET_TELEPHONE,4,3) || '-' || substr(RET_TELEPHONE,7,4) || nvl2(RET_POSTE,' poste ' || RET_POSTE,'') TelRET
    from
    TBL_Demande_1,
    TBL_Demande_TRSP_1
    where
    DemandeID = :P7_IDDEMANDE
    and ID_Demande = DemandeIDI then created a report layout in XSL-FO with XSLfast, but it won't work at all. I always get the dreaded "corrupted file" when I test my PDF Report... any ideas why it doesn't work? Have I missed something obvious?
    Best regards,
    Mathieu

    Hello Mathieu
    i assume that the default PDF printing is working, but that you want to create some better looking reports and therefore use a different non-generic XSL-FO.
    You can do several things in Apex but you can use the Apache-Fop conversion also indepent from Apex.
    What you need is:
    1) An XML (Data) File. You can get it from your report query when you say export it to XML.
    2) The XSL-FO (Layout) file. THis is the processing instruction that says how convert the XML Data into an XML-FO. You can create it manually or with some tool.
    3) The next step is to render the XML-FO into any output format (pdf, rtf, html)
    The creation of the XML-FO and of the PDF are done by the apache fop converter (cocoon or Batik framework if I remember correctly) in a single process but you can influence it so that both steps are done separately. See also: http://xmlgraphics.apache.org/fop/0.95/running.html
    The advantage is that you usually get much better error messages from the single steps.
    My recommendation would be to do all the steps with a very basic report first.
    Then gradually improve the complexity of the report, the data and the layout.

  • PDF printing with oc4j apache fop not working

    I am configuring PDF printing in Apex 3.1.1. I have set up a shared component report query with a simple query. I have implemented the oc4j standalone and implemented the fop.war as specified in the "pdf printing in Apex" documentation. When I use the test button to verify the output of the report, I am redirected to a 404-page not found and the oc4j instance logs the following:
    08/09/09 12:02:36 [ERROR] Logger not set
    08/09/09 12:02:36 [INFO] Using oracle.xml.parser.v2.SAXParser as SAX2 Parser
    08/09/09 12:02:36 [INFO] building formatting object tree
    08/09/09 12:02:36 [INFO] setting up fonts
    08/09/09 12:02:36 [INFO] [1]
    08/09/09 12:02:36 [WARNING] table-layout=auto is not supported, using fixed!
    08/09/09 12:02:36 [WARNING] Sum of fixed column widths 662000 greater than maximum specified IPD 658800
    08/09/09 12:02:36 [INFO] Parsing of document complete, stopping renderer
    Any ideas why this is happening?
    Database is oracle 9.2.0.7
    OC4J standalone 10.1.3

    Hello,
    Just did some more search on this, and apparently it's a more common problem:
    Re: PDF problem FOP mod_plsql: /pls/apex/wwv_flow.accept ORA-22293
    Regards,
    Dimitri
    http://dgielis.blogspot.com/
    http://www.apex-evangelists.com/
    http://www.apexblogs.info/

  • PDF printing with UTF8 characterset

    Hi,
    Stats:
    E-BIZ version :- 11.5.10.2
    DB:- 10.2.0.3
    Report BUilder :- 6i
    Character Set :- UTF8.
    I have some doubt while viewing/printing pdf reports from Oralce Application. Can you please suggest if it is possible to print pdf's from oracle apps with UTF8 characterset and without having 3rd party software to convert pdf report to postscript and a printer that can understand postscript. We do have PASTA and IX configured in our enviornment.Reports created are in BI/XML publisher.
    Actually we have one 3rd party tool for printing and wanted to get rid of it due to financial constraints. Can you please suggest if it is possible to print pdf's from oracle apps without having 3rd party tool. I have read lot of document and completely lost. Oracle some where says it is possible and at other place says 'If you are on UTF8 chacterset then you need to have XML/BI publisher with PASTA and 3rd party software' but in my enviornment we have some pdf reports that are bypassing 3rd party software for printing. I am just lost.
    Any help would be appreciated
    Thanks,
    JD

    Hi,
    This line confuses me, do i require 3rd party software to print from oracle apps if my characterset is UTF8(althoug i am using XML publisher), I believe yes -- See (Note: 422508.1 - About Oracle XML Publisher Release 5.6.3), Step 8 Enable PDF Printing in Oracle Applications. (System Administrator)
    Workaround section says
    6. From Oracle Applications via the Adobe Acrobat Reader, a PDF output file can be viewed and
    printed.>>>> NO i not want to use it.This is a workaround to print PDF directly from the application. If you do not want to use this approach, use the other one mentioned above.
    7.Although, it may be possible to create a custom print driver or print program using the Adobe
    Acrobat Distiller, viable instructions on how to perform such a custom setup is very scarce, see
    Note 262657.1--intended for Latin 1 character set environments.>>>> I am on UTF8
    I would not recommend this approach as this may (or may not) work.
    8. Use Pasta, an Oracle post printing program, to change a copy of the report output file to the
    desired or printable output format.>>>>>> I have PASTA but does that mean i can print all my pdf reports using it. Don't i need 3rd party tool now.See (Note: 239196.1 - PASTA 3.0 Release Information).
    9. Lastly, use another format like Postscript, that is fully supported for viewing and printing>>>>> How to use it? Can anyone please explain.Change the output of the concurrent program to Postscript (Concurrent > Program > Define), and you can view the output using Ghost Viewer.
    Note: 117112.1 - How to read Postscript File Formats on a MS Windows Operating System and Convert To Another File Format
    Thanks,
    Hussein

  • PDF Printing with V3

    I have been reading http://www.oracle.com/technology/products/database/application_express/html/configure_printing.html to configure for PDF printing.
    I already have OAS installed with some OC4J applications. It has a BI farm that includes Discoverer, HTTP_Server, Forms, Reports_Server, OC4J_BI_Forms, OC4J_Portal, OC4J_Wireless, Portal, Web_Cache and Management all running. Is the BI Publisher described in the document above different that the BI farm installed with OAS? Can/Should I install the BI Publisher on the same physical machine? Or does it need to be installed as an additional component in the existing OAS farm?
    I guess I am do not understand the connection. Perhaps the BI Publisher and the BI farm in OAS are completely seperate and only share a common name?
    Any help would be appreciated.
    Scott

    Scott,
    Based on the information I have from the BI Publisher team, the only product currently including the version of BI Publisher that's needed for APEX integration is this:
    Oracle Business Intelligence Enterprise Edition 10.1.3.2
    And can be downloaded here:
    http://www.oracle.com/technology/products/bi/enterprise-edition.html
    I'm not an expert on OAS, so I can't answer the question on where to best install this. I would recommend you post this question on the XML Publisher forum:
    BI Publisher
    Regards,
    Marc

Maybe you are looking for