Meaningless Drivel is fun!*
The moose likes XML and Related Technologies and the fly likes Writing PDF files in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Writing PDF files in Java" Watch "Writing PDF files in Java" New topic
Author

Writing PDF files in Java

Ryan Bailey
Ranch Hand

Joined: Feb 26, 2002
Posts: 134
Hi All,
Sorry for double posting this thread but I figured it would be more appropriate in this category.
I was wondering if someone might be able to point me in the right direction. I need to generate PDF files from XML. These PDF files are format intensive. Does anyone know of what API I should use to achieve this. I was also wondering if anyone has used a program to take a PDF file and transform it to a Formated Object(FO) since this would save me a ton of time not writing my own style sheet myself. I'm guessing I'm going to want to use an XSL-FO style sheet to transform my xml to a PDF document.
Any help would be appreciated.
Cheers
Ryan


SCJP 1.4, SCWCD
Java: The power, elegance, and simplicity of a hand grenade
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Here's a list of PDF libs for Java:
Big Faceless Java PDF Library (commercial)
ElegantJBeans (commercial)
Orinoco (open source, LGPL)
XMLMill (commercial)
Retep (open source, BSD License)
iText (commercial)


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Ryan Bailey
Ranch Hand

Joined: Feb 26, 2002
Posts: 134
Lasse,
Thanks for the quick response. I have already looked at 3/4 of the list you provided. Have you ever used any of these libs before? Would it be easier to use XSL-FO? Do you know of any software that is available to generate a FO out of a PDF file?
Regards,
Ryan
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I have tried iText and Retep some two years ago, I think. iText was OK, if I remember correctly. I didn't manage to get Retep working correctly due to some environment conflicts (I was developing on a remote Linux box with not-quite-the-latest JDK version etc).
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Oh, forgot the XSL-FO part...
Yes, I think it would be "easier" to generate XSL-FO docs and let the Apache FOP component blurt out the corresponding PDF files. By "easier" I mean that you don't need to be afraid of your PDF library vendor going out of business etc. because your code relies only on a W3C specification (XSL Formatting Objects). However, the XSL-FO approach carries a significant learning curve so from that point of view it's easier to use one of the non-standard Java APIs.
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by Ryan Bailey:

Do you know of any software that is available to generate a FO out of a PDF file?
Regards,
Ryan

There is no such tool.
Ryan Bailey
Ranch Hand

Joined: Feb 26, 2002
Posts: 134
Sure there are, XSLFast and Scriptura. Just found them yesterday.
[ July 24, 2003: Message edited by: Ryan Bailey ]
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by Ryan Bailey:
Sure there are, XSLFast and Scriptura. Just found them yesterday.

Well then I understood your question in a different sense.
 
Don't get me started about those stupid light bulbs.
 
subject: Writing PDF files in Java
 
Similar Threads
How to generate PDF files in Java
XSLT Limitations
Fit data in a PDF page
HTML to PDF possible?
jsp to xml