Topic: Advanced PDF stuff - time to use jPDF instead?

Hi everyone,

I'm working on a new project which requires some nifty PDF processing and I would really like to hear other peoples views on how I could manage it.

We need to replace images and/or text in existing PDF Forms, concatenate PDFs and PDF templates and also create thumbnails of generated PDFs - basically a combined online document management, CMS and workflow application.  The only thing I have found that supports all of this functionality and does it well is jPDF, which is a commercial Java package.

I've kinda got some simple tests working in Rails with RJB, but the alarm bells are ringing in my head and a little voice is saying I need to take a different approach to this and not run with RJB -the performance is waay worse than the pure java environment and I am worried about the scalability and production performance.

Sooo, should I forsake the awesome productivity of Rails that I have come to love and plump for an all-java solution; should I run with rails for the web tier and delegate the PDF creation and alteration to jPDF via a Java web service; or do something entirely different?

Grateful for your thoughts.


Thanks in advance,

Matt.

Re: Advanced PDF stuff - time to use jPDF instead?

ukmatt wrote:

should I run with rails for the web tier and delegate the PDF creation and alteration to jPDF via a Java web service

I like this approach. Even if you went with an all Java solution, I imagine it would be best to extract the PDF managing stuff out to a separate process anyway so it doesn't tie up a web request. In that case might as well use Rails for the web side.

Railscasts - Free Ruby on Rails Screencasts

Re: Advanced PDF stuff - time to use jPDF instead?

extract the PDF managing stuff out to a separate process anyway so it doesn't tie up a web request

Here's my only (although large) complaint about Rails (though the blame is to be put squarely on Ruby).  Rails is the only web server (not really a 'webserver', but play along) that I'm aware of that can only execute one request at a time.  C has had pthreads since the early 90's, Java had native threads since about 95, and here we are, in 2007, still waiting for a real Ruby threading architecture. 
If I were in any other environment, I wouldn't hesitate to run long-running processes (several seconds) inside of a request/response.  I definitely wouldn't in Rails, however. </rant>  smile

BrewControl.com - Brewery and Brewpub management powered by RoR

Re: Advanced PDF stuff - time to use jPDF instead?

Thanks, ryan.  I kind of suspected this would be a logical way to go but I didn't want to miss something. It would certainly scale well.

Now I've got to figure out how to get rails to talk to a Java web service and setup the whole Java shooting-match :-(

Thanks again,

Matt.

Re: Advanced PDF stuff - time to use jPDF instead?

Matt (and everyone else),

Have you gotten jPDF working happily with rails?  I'm also working on a project that needs advanced PDF functions, and PDF::Writer just isn't cutting it anymore.  I'm fairly proficient with ruby and java, but I'm somewhat clueless as to how I should integrate them (or at least the *best* way to do it).  Any suggestions.

Thanks
-Drew

Re: Advanced PDF stuff - time to use jPDF instead?

Hey Drew,

Sorry for the delay in replying.

We assessed jPDF and although it was really capable and their developers bent over backwards to help us (even though we were only evaluating it) the project requirements moved away from editing PDF forms toward creating new PDFs from HTML.

We've settled on PDF Reactor.  It is expensive at around $2000 but produces nice PDFs from straight XHTML and CSS.  This allows our clients to pick a template and add their own images and text using a TinyMCE interface, preview as HTML and render to PDF.  PDF Reactor comes with a ready to go web service running on a pre-configured Jetty server.  They provide a PHP class to use this service in their sample docs, so we basically reverse engineered that to make it work with Rails.  Its not done yet but it's looking promising.

If you can work with the constraints of PDF forms, then I highly recommend jPDF.  They were very helpful and it seemed very performant, too.


Good luck!

Matt.

Re: Advanced PDF stuff - time to use jPDF instead?

Thanks Matt.

I suppose I need to get an evaluation copy of jPDF.  I've really been too busy recently to worry with it.  I'll give it a try.

Thanks,
Drew