Forum Feature requests

Calling prince from Java

simon.oldfield
Hi!

We are looking at using prince from a Java application however my understanding is that the prince Java API provided simply uses Java's Runtime.exec() method to fire up the prince command line?

We are running on linux and this will prove to be an issue for us due to the (well known?) linux Runtime.exec() fork/exec behaviour.

Are there any plans to provide a Java API that does not use Runtime.exec()?

Thanks!
mikeday
The Java wrapper for Prince does use Runtime.exec() to start the process. I believe that the fork memory issue only affects Solaris, as by default Linux is happy to overcommit memory unless explicitly configured not to as described here. If you do run into any problems we could work around them at the cost of some extra complexity, but so far we haven't run into this issue with Java on Linux at all.
simon.oldfield
The Runtime.exec issue does occur on linux (due to the use of the fork system call). We have hit this issue already in our application when using Runtime.exec to make calls out to other apps (eg to do photo scaling, extract codec info from video files) and have had to work around it already. Our app is a server side application, the only running on the server, servicing a reasonable number of concurrent users and so is configured such that the app has the bulk of the machines memory available to it which exacerbates the situation.

I guess one option for us would be to setup a small server in front of prince, but obviously life would be much easier (for us :D ) if prince provided a java API that didn't have the Runtime.exec issue.
mikeday
There is a workaround if you only wish to convert files, eg. input.html -> output.pdf. All you would need for that is a simple shell script that waits for commands written to a particular file or directory, and invokes Prince. We don't have an existing API for that though.
rajamu
Hi there, the link for the API is not working,
Where can i get a working link for the documentation?

BTW, can i use princexml component to save tabbed info or just the page which is visible on the screen or browser at the time i press the button to see the magic?

I mean, I'm building a page where I have few tabs of info., once the user pressed the button, all the text from all the tabs and an image from Maps tab should be sent by html and or pdf.
Please help me out..!

mikeday
Sorry about that, I've fixed the API link, and the documentation is also included in the Java wrapper ZIP.

If you are running Prince on the server, then you will need to know which information you want to send. Does the server know which tabs the client has open?