Re: HTML to FO

2003-03-01 Thread Ken Masters

From what I understand, htmlfo is an executable that converts html into FO, 
which can be directly plugged into Apache FOP. Now I saw somewhere that the 
html MUST NOT be correctly formed (I saw this on the souceforge page, I 
think). Is this correct?

And how much is the output PDF similar to the original HTML?

Thanks

Ken

_
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://messenger.msn.co.uk

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]


RE: HTML to FO

2003-02-27 Thread Ken Masters
Hi,

Could you give some more information on where I can get hold of this tool. I 
did a search for htmlfo on Google and found a stylesheet that is in some 
other langauage to do with DSSSL.

Ken


there is a tool called htmlfo which does that..



-Original Message-
From: Swapan Golla [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 27, 2003 1:04 PM
To: [EMAIL PROTECTED]
Subject: HTML to FO
I am having a need to convert html ( or xhtml ) to fo
documents and then to pdf. Any suggestions on the best
ways to achieve this ? I should be able to use/call
this from my java program.
Thanks in advance,
Swapan.
_
Express yourself with cool emoticons http://messenger.msn.co.uk
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]


Re: FopServlet example!

2003-02-12 Thread Ken Masters


Thank you both. I have now implemented a class that takes two strings 
(xml-source and xsl-source and the servlet-response) and the class deals 
with converting this.

If anyone would like a copy of this please let me know.

Thanks again.

Ghulam



From: J.Pietschmann [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: FopServlet example!
Date: Tue, 11 Feb 2003 23:44:50 +0100

Ken Masters wrote:

I am new to Apache FOP, and am finding a little problem with what I'm 
doing. The XSLTInputHandler class has two parameters, the XML and XSL 
File's. Basically what I would like to do is pass an XML as a Java String 
(since it is dynamically created) and the XSL can be passed as a File.

FAQ:
  http://xml.apache.org/fop/faq.html#faq-N102B3

J.Pietschmann


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]



_
Express yourself with cool emoticons http://messenger.msn.co.uk


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: FopServlet example!

2003-02-12 Thread Ken Masters

Hi,

Ive attached the Java class, (and included it at the bottom incase 
attachment fails to send).

There are two methods, and they both require the HttpServletResponse. It 
provides options for either sending it the XML and XSL as files or strings.

Ensure that you have copied the following jar files into your 
TOMCAT_HOME\lib directory:

* avalon-framework-cvs-20020315.jar
* batik.jar
* fop.jar

which are all found in the Apache FOP distribution.

Hope it help.

Ken



-
import javax.servlet.*;
import javax.servlet.http.*;

import java.io.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.sax.SAXResult;

import org.apache.fop.apps.Driver;
import org.apache.fop.apps.Version;
import org.apache.fop.apps.XSLTInputHandler;
import org.apache.fop.messaging.MessageHandler;


public class ConvertToPDF
{

 private TransformerFactory xsltFact = TransformerFactory.newInstance();


   public ConvertToPDF()
   {
   //Default Constructor
   }//Constructor()



	public void convertXmlToPDF( String xmlsource, String xslsource, 
HttpServletResponse response )
	{
	  response.setContentType(application/pdf);

 try {

   Reader xmlReader = new StringReader(xmlsource);
   Reader xslReader = new StringReader(xslsource);

   Source xml = new StreamSource(xmlReader);
   Source xsl = new StreamSource(xslReader);


	Driver driver =new Driver();
	driver.setOutputStream(response.getOutputStream());
	driver.setRenderer(Driver.RENDER_PDF);

	Transformer transformer = 
TransformerFactory.newInstance().newTransformer(xsl);
	transformer.transform(xml, new SAXResult(driver.getContentHandler()));
   }//try
 catch (Exception ex) {
   ex.printStackTrace();
   }//catch

   }//convertXmlToPDF()




	public void convertXmlToPDF( String xmlsource, File xslPath, 
HttpServletResponse response )
	{
	response.setContentType(application/pdf);

 try {
   Reader xmlReader = new StringReader(xmlsource);

   Source xml = new StreamSource(xmlReader);
   Source xsl = new StreamSource(xslPath);


	Driver driver =new Driver();
	driver.setOutputStream(response.getOutputStream());
	driver.setRenderer(Driver.RENDER_PDF);

	Transformer transformer = 
TransformerFactory.newInstance().newTransformer(xsl);
	transformer.transform(xml, new SAXResult(driver.getContentHandler()));

   }//try
 catch (Exception ex) {
   ex.printStackTrace();
   }//catch

   }//convertXmlToPDF()

}//End all
-





_
Use MSN Messenger to send music and pics to your friends 
http://messenger.msn.co.uk


ConvertToPDF.java
Description: java/
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]