topleft
topright

Topics

ServoyCamp Login



New Users

                 

Online Users

No users online!
Creating PDFs from Documents
Tips
Written by Jason Meunier | Tuesday, 08 June 2010 16:34   

In a recent project, I was tasked with creating PDFs from Word documents.  As you already know, creating PDFs from printable Servoy objects is not too hard, but creating from documents that Servoy stores or manipulates is not as straightforward.  With the help of two open source projects, I was able to create a system that converts documents to PDFs (or to other types of documents as well).

 

The steps to setup a PDF converter:

  1. Create an OpenOffice service (or run OpenOffice headless).
  2. Create a JODConverter web service on the Application Server.
  3. Write code in Servoy to utilize the web service, passing a document to the web service and receiving the PDF from the web service.
Please login or register to see the full article
 

Comments  

 
+2 #5 Patrick Talbot 2010-06-09 21:58
Hey Harjo!

From what Jason said, you can also use the lib version of JOD, so no need to rush and buy stuff that some free resource can do

Unless you really don't know what to do with your money in which case I know an Open Source developer who accepts contributions

As for POI writing the PDF, probably not, but I guess a combination of POI + iText or POI + xslt could be used.

My two cents
 
 
0 #4 Harjo Kompagnie 2010-06-09 21:24
It does not replace the run openOffice as a service, it prevents from installing JOD, you can use this lib, to directly talk with Java, to the webservice of OpenOffice...
I think I will buy it and will have a try
 
 
0 #3 Jason Meunier 2010-06-09 18:13
Yeah, it has a few pieces.

This works in both Mac and Linux (much easier actually because you can just run OOo headless) It is kind of hidden in the text because it takes SOOOOO much to make it work as a service in Windows.

I currently have it running on a Mac and my client is running it on Linux now.

Not sure if Apache POI will actually write the PDF or not.

Harjo, I agree that it would be nicer to do this from a straight plugin and not invoke a OOo service. I have not tried your suggestion, maybe worth a look.
 
 
0 #2 Harjo Kompagnie 2010-06-09 08:50
Thank you Jason, for sharing this, but indeed there are a lot of conditions. I found also this: http://www.dancrintea.ro/doc-to-pdf/ For $79.- you will have it WITH source-code. The thing here is that you still need OpenOffice as a service somewhere, but than you can make the call's right from Servoy.....
 
 
-1 #1 Patrick Talbot 2010-06-09 03:46
Nice trick Jason! Thanks for sharing!

I see that this is Windows only though.
And it seems a lot of conditions (OpenOffice service, JOD Web Service) to make this all work, which IMHO is a bit fragile. I wonder if there's no other ways using Apache POI for example, or the the Java library needs all these pieces to work too...

Interesting anyway.
Something I would definitely like to explore... when I find some time