You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Marianne von den Driesch und Viktor Goebel <m....@gto-nordwest.de> on 2002/04/05 12:18:50 UTC
problems with creating pdf
We have the following problem using FOP:
First we tried to embed FOP into a small java programm:
package TestPackage;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.apache.fop.apps.Driver;
import org.apache.fop.apps.Version;
import org.apache.fop.apps.*;
import org.apache.log.*;
public class Test {
public static void main(String[] args) throws Exception {
File fxml=new File("D:\\xslfoRef.xml");
File fxsl=new File("D:\\xml2pdf.xsl");
File fpdf=new File("D:\\ttt.pdf");
Logger log;
Hierarchy hierarchy = Hierarchy.getDefaultHierarchy();
log = hierarchy.getLoggerFor("fop");
log.setPriority(Priority.WARN);
Driver dr=new Driver();
dr.setLogger(log);
dr.setRenderer(Driver.RENDER_PDF);
InputHandler ih=new XSLTInputHandler(fxml,fxsl);
XMLReader p=ih.getParser();
dr.setOutputStream(new FileOutputStream(fpdf));
dr.render(p,ih.getInputSource());
}
}
The program can be compiled without any problems, but the pdf-file has 0
bytes. What is wrong?
We tried also to start FOP from the command line under dos and linux with the
parameters xslfoRef.xml and xml2pdf.xsl. The error message was : "Master
-reference" for "fo:page -sequence" matches no "simple -page -master" or
"page -sequence -master".
Do you have any idea??
Thanks for your help,
Viktor und Marianne.
Re: problems with creating pdf
Posted by Mihael Knezevic <m....@porta.de>.
On 2002.04.05 12:18 Marianne von den Driesch und Viktor Goebel wrote:
>
> We tried also to start FOP from the command line under dos and linux with
> the
> parameters xslfoRef.xml and xml2pdf.xsl. The error message was :
> "Master
> -reference" for "fo:page -sequence" matches no "simple -page -master" or
> "page -sequence -master".
>
> Do you have any idea??
>
> Thanks for your help,
> Viktor und Marianne.
>
take a look at the release notes of fop. there were some changes:
http://xml.apache.org/fop/relnotes.html
Re: to Fisher Tibor
Posted by Marianne von den Driesch und Viktor Goebel <m....@gto-nordwest.de>.
when we coment out this line we get the following message:
[Error]:logger not set
[info]:[1]
java.lang.NullPointerException
at oracle.xml.jaxp.JXUtil.reportErrors(JXUtil.java:211)
at oracle.xml.jaxp.JXtransformerT.transform(JXTransformer.java:446)
We are using Oracle9i JDeveloper.
Am Freitag, 5. April 2002 15:09 schrieben Sie:
> i mean comment out this line:
> transformer.setURIResolver(new TTURIResolver());
>
> Fishy
>
> Fischer Tibor wrote:
> > sorry, just comment out that line
> > it should work without that. if not i send you that class too.
> > i dont think you need that.
> >
> > Br,
> > Fishy
> >
> > Marianne von den Driesch und Viktor Goebel wrote:
> >> Thanks for your help. We tried your code (using FOP 0.20.3) and got
> >> the message: TTURIResolver not found, is that your own class?
> >> MAVI.
> >>
> >> Am Freitag, 5. April 2002 12:36 schrieben Sie:
> >>> what version of FOP do you use?
> >>> try this code.
> >>> it works perfectly with 0.20.3 FOP
> >>>
> >>> public static void execWFop(String xmlFile, String xslFile, String
> >>> outputFile){
> >>> try{
> >>>
> >>> try {
> >>> javax.xml.transform.stream.StreamSource xmlSource=new
> >>> javax.xml.transform.stream.StreamSource(new java.io.File(xmlFile));
> >>> javax.xml.transform.stream.StreamSource xslSource=new
> >>> javax.xml.transform.stream.StreamSource(new java.io.File(xslFile));
> >>> javax.xml.transform.Transformer
> >>> transformer=javax.xml.transform.TransformerFactory.newInstance()
> >>> .newTransformer(xslSource);
> >>> transformer.setURIResolver(new TTURIResolver());
> >>> org.apache.fop.apps.Driver driver=new
> >>> org.apache.fop.apps.Driver();
> >>> driver.setOutputStream(new java.io.FileOutputStream(outputFile));
> >>> driver.setRenderer(org.apache.fop.apps.Driver.RENDER_PDF);
> >>> transformer.transform(xmlSource,
> >>> new
> >>> javax.xml.transform.sax.SAXResult(driver.getContentHandler()));
> >>>
> >>> System.exit(2);
> >>> }
> >>> catch( Exception e ) {
> >>> e.printStackTrace(System.out);
> >>> }
> >>> }
> >>>
> >>> BR,
> >>> Fishy
Re: to Fisher Tibor
Posted by Fischer Tibor <fi...@freemail.hu>.
i mean comment out this line:
transformer.setURIResolver(new TTURIResolver());
Fishy
Fischer Tibor wrote:
> sorry, just comment out that line
> it should work without that. if not i send you that class too.
> i dont think you need that.
>
> Br,
> Fishy
>
>
> Marianne von den Driesch und Viktor Goebel wrote:
>
>> Thanks for your help. We tried your code (using FOP 0.20.3) and got
>> the message: TTURIResolver not found, is that your own class?
>> MAVI.
>>
>>
>> Am Freitag, 5. April 2002 12:36 schrieben Sie:
>>
>>> what version of FOP do you use?
>>> try this code.
>>> it works perfectly with 0.20.3 FOP
>>>
>>> public static void execWFop(String xmlFile, String xslFile, String
>>> outputFile){
>>> try{
>>>
>>> try {
>>> javax.xml.transform.stream.StreamSource xmlSource=new
>>> javax.xml.transform.stream.StreamSource(new java.io.File(xmlFile));
>>> javax.xml.transform.stream.StreamSource xslSource=new
>>> javax.xml.transform.stream.StreamSource(new java.io.File(xslFile));
>>> javax.xml.transform.Transformer
>>> transformer=javax.xml.transform.TransformerFactory.newInstance()
>>> .newTransformer(xslSource);
>>> transformer.setURIResolver(new TTURIResolver());
>>> org.apache.fop.apps.Driver driver=new
>>> org.apache.fop.apps.Driver();
>>> driver.setOutputStream(new java.io.FileOutputStream(outputFile));
>>> driver.setRenderer(org.apache.fop.apps.Driver.RENDER_PDF);
>>> transformer.transform(xmlSource,
>>> new
>>> javax.xml.transform.sax.SAXResult(driver.getContentHandler()));
>>>
>>> System.exit(2);
>>> }
>>> catch( Exception e ) {
>>> e.printStackTrace(System.out);
>>> }
>>> }
>>>
>>> BR,
>>> Fishy
>>>
>>
>>
>>
>>
>
>
>
>
>
>
>
Re: to Fisher Tibor
Posted by Fischer Tibor <fi...@freemail.hu>.
sorry, just comment out that line
it should work without that. if not i send you that class too.
i dont think you need that.
Br,
Fishy
Marianne von den Driesch und Viktor Goebel wrote:
>Thanks for your help. We tried your code (using FOP 0.20.3) and got the
>message: TTURIResolver not found, is that your own class?
>MAVI.
>
>
>Am Freitag, 5. April 2002 12:36 schrieben Sie:
>
>>what version of FOP do you use?
>>try this code.
>>it works perfectly with 0.20.3 FOP
>>
>> public static void execWFop(String xmlFile, String xslFile, String
>>outputFile){
>> try{
>>
>> try {
>> javax.xml.transform.stream.StreamSource xmlSource=new
>>javax.xml.transform.stream.StreamSource(new java.io.File(xmlFile));
>> javax.xml.transform.stream.StreamSource xslSource=new
>>javax.xml.transform.stream.StreamSource(new java.io.File(xslFile));
>> javax.xml.transform.Transformer
>>transformer=javax.xml.transform.TransformerFactory.newInstance()
>> .newTransformer(xslSource);
>> transformer.setURIResolver(new TTURIResolver());
>> org.apache.fop.apps.Driver driver=new org.apache.fop.apps.Driver();
>> driver.setOutputStream(new java.io.FileOutputStream(outputFile));
>> driver.setRenderer(org.apache.fop.apps.Driver.RENDER_PDF);
>> transformer.transform(xmlSource,
>> new javax.xml.transform.sax.SAXResult(driver.getContentHandler()));
>>
>> System.exit(2);
>> }
>> catch( Exception e ) {
>> e.printStackTrace(System.out);
>> }
>>}
>>
>>BR,
>>Fishy
>>
>
>
>
>
to Fisher Tibor
Posted by Marianne von den Driesch und Viktor Goebel <m....@gto-nordwest.de>.
Thanks for your help. We tried your code (using FOP 0.20.3) and got the
message: TTURIResolver not found, is that your own class?
MAVI.
Am Freitag, 5. April 2002 12:36 schrieben Sie:
> what version of FOP do you use?
> try this code.
> it works perfectly with 0.20.3 FOP
>
> public static void execWFop(String xmlFile, String xslFile, String
> outputFile){
> try{
>
> try {
> javax.xml.transform.stream.StreamSource xmlSource=new
> javax.xml.transform.stream.StreamSource(new java.io.File(xmlFile));
> javax.xml.transform.stream.StreamSource xslSource=new
> javax.xml.transform.stream.StreamSource(new java.io.File(xslFile));
> javax.xml.transform.Transformer
> transformer=javax.xml.transform.TransformerFactory.newInstance()
> .newTransformer(xslSource);
> transformer.setURIResolver(new TTURIResolver());
> org.apache.fop.apps.Driver driver=new org.apache.fop.apps.Driver();
> driver.setOutputStream(new java.io.FileOutputStream(outputFile));
> driver.setRenderer(org.apache.fop.apps.Driver.RENDER_PDF);
> transformer.transform(xmlSource,
> new javax.xml.transform.sax.SAXResult(driver.getContentHandler()));
>
> System.exit(2);
> }
> catch( Exception e ) {
> e.printStackTrace(System.out);
> }
> }
>
> BR,
> Fishy
Re: problems with creating pdf
Posted by Fischer Tibor <fi...@freemail.hu>.
what version of FOP do you use?
try this code.
it works perfectly with 0.20.3 FOP
public static void execWFop(String xmlFile, String xslFile, String
outputFile){
try{
try {
javax.xml.transform.stream.StreamSource xmlSource=new
javax.xml.transform.stream.StreamSource(new java.io.File(xmlFile));
javax.xml.transform.stream.StreamSource xslSource=new
javax.xml.transform.stream.StreamSource(new java.io.File(xslFile));
javax.xml.transform.Transformer
transformer=javax.xml.transform.TransformerFactory.newInstance()
.newTransformer(xslSource);
transformer.setURIResolver(new TTURIResolver());
org.apache.fop.apps.Driver driver=new org.apache.fop.apps.Driver();
driver.setOutputStream(new java.io.FileOutputStream(outputFile));
driver.setRenderer(org.apache.fop.apps.Driver.RENDER_PDF);
transformer.transform(xmlSource,
new javax.xml.transform.sax.SAXResult(driver.getContentHandler()));
System.exit(2);
}
catch( Exception e ) {
e.printStackTrace(System.out);
}
}
BR,
Fishy
Marianne von den Driesch und Viktor Goebel wrote:
>We have the following problem using FOP:
>
>First we tried to embed FOP into a small java programm:
>
>package TestPackage;
>
>import java.io.*;
>
>import javax.servlet.*;
>import javax.servlet.http.*;
>
>import org.xml.sax.InputSource;
>import org.xml.sax.XMLReader;
>
>import org.apache.fop.apps.Driver;
>import org.apache.fop.apps.Version;
>import org.apache.fop.apps.*;
>
>import org.apache.log.*;
>
>public class Test {
>
> public static void main(String[] args) throws Exception {
>
> File fxml=new File("D:\\xslfoRef.xml");
> File fxsl=new File("D:\\xml2pdf.xsl");
> File fpdf=new File("D:\\ttt.pdf");
>
> Logger log;
> Hierarchy hierarchy = Hierarchy.getDefaultHierarchy();
> log = hierarchy.getLoggerFor("fop");
> log.setPriority(Priority.WARN);
>
> Driver dr=new Driver();
> dr.setLogger(log);
> dr.setRenderer(Driver.RENDER_PDF);
> InputHandler ih=new XSLTInputHandler(fxml,fxsl);
> XMLReader p=ih.getParser();
> dr.setOutputStream(new FileOutputStream(fpdf));
> dr.render(p,ih.getInputSource());
>
> }
>}
>
>The program can be compiled without any problems, but the pdf-file has 0
>bytes. What is wrong?
>
>We tried also to start FOP from the command line under dos and linux with the
>parameters xslfoRef.xml and xml2pdf.xsl. The error message was : "Master
>-reference" for "fo:page -sequence" matches no "simple -page -master" or
>"page -sequence -master".
>
>Do you have any idea??
>
>Thanks for your help,
>Viktor und Marianne.
>
>
>
>