Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

generate PDF without using iText?

 
Seth Dustin
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I work for a cheapskate company that doesn't want to license iText. For what we're doing, the cost is prohibitive. Is there any other library / servlet that I can use to create a dynamic PDF in memory and sent to the browser? Ideally, I'd like to have a static template and just have my code drop a few fields into the template such as name and address.

Any suggestions appreciated. I've searched this forum and the internets, but every discussion keeps pointing people at iText.

thanks,

as
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34839
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
iText is free for most uses. And sending a PDF to the browser sounds like one of the free uses. What are you doing that requires a license?

Back to your question, the only other free PDF library I know of is PDF Box. I haven't used it though as I use iText.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34839
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh and there is also FOP but it doesn't sound like you are starting from XML.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
iText is free for most uses. And sending a PDF to the browser sounds like one of the free uses.

I don't think it is. Web apps are the case for which the Affero license was created specifically; distributing an iText-generated PDF to a browser would require distributing the source code. The Affero license is unsuited for most business uses.

Back to your question, the only other free PDF library I know of is PDF Box.

PDFBox is useful, but it doesn't have capabilities to create PDFs from scratch, so it probably doesn't fit.

FOP kind of fits the "template" approach, although you'd have to make an investment in acquiring XSL-FO knowledge.

Alternatively, check out the FlyingSaucer library which converts CSS-styled XHTML documents to PDF.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used FOP for a big project several years ago - worked quite well, but you are going to need to read up on XSL-FO. I used Holman's "Definitive XSL-FO".

Bill
 
Seth Dustin
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne,

Thanks for your input on this topic.

Jeanne Boyarsky wrote:iText is free for most uses. And sending a PDF to the browser sounds like one of the free uses. What are you doing that requires a license?


Unfortunately, iText is not free for sending PDFs to browsers in a commercial setting. See this text from the link you provided:

Buying such a license is mandatory as soon as you develop commercial activities involving the iText software without disclosing the source code of your own applications. These activities include: offering paid services to customers as an ASP, serving PDFs on the fly in a web application, shipping iText with a closed source product.


Jeanne Boyarsky wrote:Back to your question, the only other free PDF library I know of is PDF Box. I haven't used it though as I use iText.


I'll take a look at PDF Box. I hadn't heard about this possible solution.

thanks,

seth
 
Seth Dustin
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I examined PDFbox and I think it might do the trick with the smallest investment in time for me to implement. The FSO stuff sounds intimidating.

At first I didn't think PDFbox would work because the feature set described in their command-line toolbox was missing the functionality I need, which is to add text in specific locations of a pre-existing PDF file. Then I checked out the cookbook and it looks like they have the methods I need...

I'll update this thread with details on my progress.

seth
 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
iText up to version 2.1.7 is free in the LGPL sense, so you can send the PDFs to the customer without code disclosure. E.g. iReport uses 2.1.7 for exactly this reason.
 
Manu Moreno
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another open source option for working with templates and generating pdfs (and other artifacts) is JODReports, these libraries depend on Openoffice and
provide an easy solution to generate pdfs from ODTs.
 
Abhilash Ms
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seth Dustin wrote:I examined PDFbox and I think it might do the trick with the smallest investment in time for me to implement. The FSO stuff sounds intimidating.

At first I didn't think PDFbox would work because the feature set described in their command-line toolbox was missing the functionality I need, which is to add text in specific locations of a pre-existing PDF file. Then I checked out the cookbook and it looks like they have the methods I need...

I'll update this thread with details on my progress.

seth


Hi Seth,

Did this work for you? I am now exploring options of generating PDF files by inserting text in specific locations of a pre existing template file that could be created using word or any other WYSIWYG editor.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic