RE: HowTo Render PDF from XML string and XSL file

2002-03-11 Thread Jim Urban

I posted this about a week ago, but here you go again...

Jim

public void doPost(HttpServletRequest req, HttpServletResponse res)
 throws ServletException
{
... your code
try
{
String xmlString = new String(); // your xml
TransformerFactory tFactory = TransformerFactory.newInstance();
File   foFile= new File(foXslFile.xsl);
Source foXslSource   = new StreamSource(foFile);
Transformer pdfTransformer = tFactory.newTransformer(foXslSource);
Writer out = new StringWriter();
Source xmlSource = new StreamSource(new StringReader(xmlString));
pdfTransformer.transform(xmlSource, new StreamResult(out));
out.close();
String fopstring = out.toString();
InputSource foSource = new InputSource(new StringReader(fopstring));
ByteArrayOutputStream baout = new ByteArrayOutputStream();
Driver driver = new Driver(foSource , baout);
res.setContentType(application/pdf);
driver.setRenderer(Driver.RENDER_PDF);
driver.run();
byte[] content = baout.toByteArray();
res.setContentLength(content.length);   // This keeps IE happy
res.getOutputStream().write(content);
res.getOutputStream().flush();
res.flushBuffer();
}
catch (Exception e)
{
System.err.println(Exception in init:   + e.toString());
e.printStackTrace();
}
... more code
}


 -Original Message-
 From: David B. Bitton [mailto:[EMAIL PROTECTED]]
 Sent: Friday, March 08, 2002 11:27 PM
 To: fop-dev
 Subject: HowTo Render PDF from XML string and XSL file


 I have spent some time looking at the embedding sample, and I have some
 questions.  I have successfully implemented FOP as a WebService having the
 XSL-FO data posted to the service and the service rendering the file onto
 the local machine.  Now I want to do the XML/XSL to XSL-FO
 transform in the
 WebService.

 I noticed that the transform occurs in the XSLInputHandler.  This then
 allows for an InputSource and XMLReader to be available to the
 Driver.render() overloaded method.  The unfortunate part is the
 XSLInputHandler constructor only takes File object, no stream.
 I'd like to
 avoid bouncing the XML data off the disk just to statisfy this requirement
 for using XSLInputHandler.

 So, my question is this, how can I arrive at the same results, an
 InputSource and an XMLReader interfaced object for Driver.render()?  Or
 better yet, what I'm asking is what is going on inside
 XSLInputHandler that
 I can slurp out into my code.  Tx :)

 --

 David B. Bitton
 [EMAIL PROTECTED]
 www.codenoevil.com

 Diversa ab illis virtute valemus.


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




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




HowTo Render PDF from XML string and XSL file

2002-03-08 Thread David B. Bitton

I have spent some time looking at the embedding sample, and I have some
questions.  I have successfully implemented FOP as a WebService having the
XSL-FO data posted to the service and the service rendering the file onto
the local machine.  Now I want to do the XML/XSL to XSL-FO transform in the
WebService.

I noticed that the transform occurs in the XSLInputHandler.  This then
allows for an InputSource and XMLReader to be available to the
Driver.render() overloaded method.  The unfortunate part is the
XSLInputHandler constructor only takes File object, no stream.  I'd like to
avoid bouncing the XML data off the disk just to statisfy this requirement
for using XSLInputHandler.

So, my question is this, how can I arrive at the same results, an
InputSource and an XMLReader interfaced object for Driver.render()?  Or
better yet, what I'm asking is what is going on inside XSLInputHandler that
I can slurp out into my code.  Tx :)

--

David B. Bitton
[EMAIL PROTECTED]
www.codenoevil.com

Diversa ab illis virtute valemus.


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




Re: pdf to xml ?????

2001-07-31 Thread rajeev nair

Hai Alex,
Thanks a lot for ur prompt response.Actually I'm
trying to create structured xml of the content of a
PDF file.
thanx again in advance
rajiv

--- Alex McLintock [EMAIL PROTECTED] wrote:
  --- rajeev nair [EMAIL PROTECTED] wrote:  hi
 all,
  How can i convert pdf files into xml files.
  Any help will be greatly appreciated.
  regards
  rajiv
 
 1) When asking questions like this it is best if you
 give more details of what you are trying 
 to do. Are you trying to create structured xml of
 the content of a PDF file, or are you trying to
 get an XSL:FO representation of the whole page?
 Are you trying to convert PDF into SVG?
 
 2) FOP is a rendering tool for XSL:FO so this is off
 topic.
 
 Alex
 
 
 =
 Alex McLintock[EMAIL PROTECTED]Open Source
 Consultancy in London
 OpenWeb Analysts Ltd, http://www.OWAL.co.uk/ 
 DR WHO COMPETITION:

http://www.diversebooks.com/cgi-bin/caption/captions.cgi?date=200104
 Get Your XML T-Shirt t-shirt/ at
 http://www.inversity.co.uk/
 


 Do You Yahoo!?
 Get your free @yahoo.co.uk address at
 http://mail.yahoo.co.uk
 or your free @yahoo.ie address at
 http://mail.yahoo.ie
 

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


__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




Re: pdf to xml ?????

2001-07-31 Thread Jeremias Maerki

 Thanks a lot for ur prompt response.Actually I'm
 trying to create structured xml of the content of a
 PDF file.

You may want to have a look at this:
http://www.planetmarkup.com/mainpage.asp?webpageid=76

Jeremias Märki

mailto:[EMAIL PROTECTED]

OUTLINE AG
Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
Fon +41 (41) 317 2020 - Fax +41 (41) 317 2029
Internet http://www.outline.ch


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




pdf to xml ?????

2001-07-30 Thread rajeev nair

hi all,
How can i convert pdf files into xml files.
Any help will be greatly appreciated.
regards
rajiv

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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