I have a project that will require a XML document to produce a PDF document. I am just starting out with
java and the project that I am doing requires that I create a pdf file form XML. I have the XML file that contains all the data and elements. I am trying to get one to work that I downloaded (it is from a book Professional
JSP 2nd Edition
www.wrox.com), without any luck. I can't even get this to work. HELP! I am using Websphere to run it.
I start my websphere and type in
http://localhost:8080/xml_2_pdf.jsp?fo=/simple.fo . This doesn't work.
The jsp page code is
-----------------------------------------------
<%@taglib uri="/WEB-INF/fop.tld" prefix="fop" %><%
%><%@page contentType="application/pdf"%><%
String xmlFile = request.getParameter("xml");
%><fop:xml2pdf xml="<%= xmlFile %>" xsl="/xml/pdfHistory.xsl"/>
------------------------------------------------
I also have a fop.tld file that looks like:
------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.2</jspversion>
<shortname>Simple FOP Tag Library</shortname>
<info>
A tag library for turning XML into PDF documents
via XSLT. The xml2pdf tag translates XML input data
to FO XML via XSLT, and then renders that to PDF using
FOP. The fo2pdf tag renders FO XML into PDFs using FOP.
</info>
<tag>
<name>fo2pdf</name>
<tagclass>fop.FO2PDFTag</tagclass>
<bodycontent>JSP</bodycontent>
<info>
Applies the specified XSL stylesheet to the XML input,
and writes the output to the JspWriter. If no "fo" attribute
is specified, it reads the FO XML from the body of the tag.
</info>
<attribute>
<name>fo</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>xml2pdf</name>
<tagclass>fop.XML2PDFTag</tagclass>
<bodycontent>JSP</bodycontent>
<info>
Applies the specified XSL stylesheet to the XML input,
and writes the output to the JspWriter. If no "xml" attribute
is specified, it reads the XML from the body of the tag.
</info>
<attribute>
<name>xml</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>xsl</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
-------------------------------------------
the simple.fo document looks like:
-------------------------------------------
<?xml version="1.0"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simple"
page-height="11in"
page-width="8.5in"
margin-top="1in"
margin-bottom="1in"
margin-left="1in"
margin-right="1in">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo

age-sequence master-name="simple">
<fo:flow flow-name="xsl-region-body" text-align="center">
<fo:block font-size="24pt">
Welcome to XSL FO!
</fo:block>
<fo:block font-size="18pt" color="blue">
Welcome, Welcome, Welcome
</fo:block>
</fo:flow>
</fo

age-sequence>
</fo:root>
----------------------------------------
the classes are located in a fop folder in the web directory and are downloaded directly from the website.
I just don't know if I have things right. Am I not running something that I should? I can get XML to got to HTML but not PDF.