Hi Colleagues,
I have added all missing jars.
Now I receive communicate as follow:
log4j:WARN No appenders could be found for logger (org.apache.fop.util.ContentHandlerFactoryRegistry).
log4j:WARN Please initialize the log4j system properly.
TTTTmpUt is
Error
I/O error reported by XML parser processing file:/C:/PDFfile.fo: C:\PDFfile.fo (Systemet)…….
As I mentioned I'm completely new in transforming xml to PDF.
For sure the problem is that I do not deliver xml file but I have created handly such test xml file (ReceiptData.xml)
I would like to ask you as follow:
1. Please check my xml file whether it is correct.
2. Please also check my java code and advise me (preferably give me some code)how to use xml file in this code.
Thanks again for help!
Regards,
Rafal
Code of ReceiptData.xml
<?xml version="1.0" encoding="utf-8" ?>
<data>
<description font-size="16pt" font-family="sans-serif">Invoice </description>
<description font-size="14pt" font-family="sans-serif" text-align="center">For</description>
</data>
Java code. The code is done according to pattern.The code generates PDF but the file is empty.
//Step 1: Construct a FopFactory
FopFactory fopFactory = FopFactory.newInstance();
//Step 2: Set up output stream.
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(new File("C:/PDFfile.pdf")));
try{
//Step 3: Construct fop with desired output format
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,out);
//Step4: Setup JAXP using identity transformer
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();
Logger foLogger = Logger.getLogger("org.apache.fop");
foLogger.setLevel(Level.SEVERE);
// Step 5: Setup input and output for XSLT transformation. Setup input stream
Source src = "">new StreamSource(new File("C:/PDFfile.fo"));
//Resulting SAX events (the generated FO) must be piped through to FOP
Result res = new SAXResult(fop.getDefaultHandler());
//Step 6: Start XSLT transformation and FOP processing
transformer.transform(src, res);
//Transformer transformerXSLT = factory.newTransformer(src); //WITH XSLT
}finally{
out.close();
}
--
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en