Hi Rafal,
Do you write XML and fo:XSL files to generate PDF format? 
Why do you getDefaultHandler??
I am writing simple steps for you:
1. Create XML file and Save it at specific location.
2. Create fo:XLS fils and Save it at specific location.
3. Create Java file.
 - Set up a FOP driver
   Driver driver = new Driver();
 - Set up the logger for the driver
  Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO)
  driver.setLogger(logger)
- Declare Render format
 driver.setRenderer(Driver.RENDER_PDF)
- invoke xml file and xsl file and put them into Handler
 XSLTInputHandler inputHandler = new XSLTInputHandler(xmlfile, xslFile)
- Declare ByteSteream and read them byte
 ByteArrayOutPutStream outStream = new ByteArryaOutPutStream()
 driver.setOutputStream(outStream)
 driver.render(inputHandler.getParser(),inputHandler.getInputSource())
 byte[] content = outStream.toByteArray();
- Display PDF
response.setContentLength(content.length)
response.setContentType("application/pdf")
response.setHeader("       something.....")
 
response.getoutputStream().write(content);
response.getOutputSteram().flush()
 
This is simple explanation (Web Based application) to implement PDF document 
using xml and fo:XSL.  
This will give you some idea how to write in Java. 
 
Good Luck!!!!
 
Chil

--- On Thu, 11/18/10, Rafał Laczek <rafal_lac...@wp.pl> wrote:


From: Rafał Laczek <rafal_lac...@wp.pl>
Subject: [java ee programming] fop.getDefaultHandler());
To: "Java EE (J2EE) Programming with Passion!" 
<java-ee-j2ee-programming-with-passion@googlegroups.com>
Received: Thursday, November 18, 2010, 6:44 PM



#yiv360747794 blockquote {padding-left:1ex;margin:0px 0px 0px 
0.8ex;border-left:#cccccc 1px solid;}#yiv360747794 p {margin:0px;padding:0px;}

Hi,
Can sobmbody advise me please why by fop.getDefaultHandler())  I get error: The 
method getDefaultHandler() is undefined for the type Fop.
 
Thanks for help!
Regards,
Rafal

private
 static void createReceiptPDF() throws IOException, 
TransformerFactoryConfigurationError, FileNotFoundException, 
TransformerConfigurationException, TransformerException, FOPException { 
System.
 
out.println("createReceiptPDF() is invoked"); 
OutputStream out;
Document doc;
String employeeNr;
TransformerFactory fact = TransformerFactory.newInstance();
 
// Creating FO ( XSL-transformering uten FOP) 


 



ByteArrayOutputStream tmpUt =
newByteArrayOutputStream(); 

Result result =

newStreamResult(tmpUt); 
tmpUt.close();
 
 
 
 
// Using FOP to convert temporary file to PDF
 

 
 byte 

[] fo = tmpUt.toByteArray(); 
InputStream bais =
new ByteArrayInputStream(fo); 
FopFactory fopFactory = FopFactory.newInstance();
Fop fop = fopFactory.newFop(MimeConstants.
MIME_PDF,out); 

 

Transformer xformer = fact.newTransformer();
 
Logger foLogger = Logger.getLogger(
"org.apache.fop"); 

foLogger.setLevel(Level.

SEVERE); 
 
 
 
// BufferedInputStream tmpIn = new BufferedInputStream(new FileInputStream(f));
 

Source src =
new

StreamSource(bais); 
Result res =
new SAXResult(fop.getDefaultHandler());
//The method getDefaultHandler() is undefined for the type Fop 

xformer.transform(src, result);
 
 

-- 
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
 

-- 
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

Reply via email to