Forum Moderators: phranque
I've got a class that executes a pdf tool (PDFEnhancer) using Runtime.exec(), merges a couple of pdfs and saves the result in a new file. When compiled and run from my Java IDE, this works perfectly. The class starts, pdfs merge and the output is saved. Beautiful.
I now want to do this on the web using JSP.
So, I took the compiled class, imported it on the web page, created the object and ran it. The result was... nothing. PDFEnhancer seems to start (it flashes by in the process' list when you refresh the page), but doesn't seem to be able to write any output to the server.
I tried enabling logging on the tool, but no log file gets written, probably because of the same reason as why no pdf is output.
I've also tried rerouting the output of the tool to my own System.out stream (which in turn is written to a log file on the webpage) to see what the tool says... But for some reason, the rerouting only works when I run the class file directly - on the webpage, its output is always null.
The line of code that's messing things up is:
Runtime rt = Runtime.getRuntime();
Process p = rt.Exec("pdfe.exe -o myOutput.pdf input1.pdf input2.pdf -f jobOptions.pec"); All paths are written in the format "//networkshare/mydir/input1.pdf".
Now I'm mostly doing ASP.NET so I can't say for sure, but this sounds like a settings problem to me. All necessary directories already have the correct permissions set (read/write for everyone) so I guess the JSP page isn't allowed to mess with the server, read/write to it etc? Problem is, I've got no idea of where to even look for these kind of settings. So please help with that... And any other hints / tips would be appreciated as well. ;)
Maybe there is an easier way to merge/create PDFs, other than running an external tool?
Oh btw., the server is running w2k server and IIS.
Thanks
//ZS
Apparently, PDFEnhancer has an annoying feature that requires you to enter the license key if you use it from another context (like the web). So once I had registered it using the JSP page, it worked...
Yahoo! I had prepared for a long, boring day of JSP settings. ;)
//ZS
[edited by: rogerd at 1:51 pm (utc) on July 9, 2004]
[edit reason] minor word change for cross-cultural reasons [/edit]