Need to convert MS Office files to pdf on the server itself.

R

ruds

I'm writing a web app using JSP with Tomcat5.5 as server.Users upload
MS offce files on the server and when the manager accepts then I want
the uploaded files to be converted to PDF's in the background and
stored at the server itself.for this I have PDFCreator.exe or PDF4U
driver.
If I do this using standalone Java program and exexuting the by using
Runtime class, I get the output pdf file correct.But when I call the
same Java program through the JSP passing the file names as parameter
the pdf creator is called but no output is generated.
1.I have tried invoking cmd and then calling the respective exe, then
too the cmd is invoked but the pdf creator isn't.
2. Tried through sevlet also, by creating thread.
Please suggest something, this is very urgent. Thanks.
 
C

cbossens73

If I do this using standalone Java program and exexuting the by using
Runtime class, I get the output pdf file correct.But when I call the
same Java program through the JSP passing the file names as parameter
the pdf creator is called but no output is generated.
1.I have tried invoking cmd and then calling the respective exe, then
too the cmd is invoked but the pdf creator isn't.

You keep coming with the same problem. If you continue,
I'll install that "PDF Creator" and make it work because
you're getting on my nerves :)

Seriously, try to "Divide & Conquer".

If you manage to have a standalone Java program making
it work, you're getting closer.

Once again I'd "wrap" the call to "PDF Creator" inside
a batch script (a Windows .bat script as I seem to recall
you're on Windows).

Call you batch script from your working standalone
Java app and check the parameters you're getting
(for example, before calling PDF Creator, your batch
script could "echo" the parameters it is receiving
to some temporary log file).

Now call that same batch script from you JSP,
compare the two log files, and you'll see where
your mistake lies.

In your case it's not even the reason why it's
not working that is interesting: probably some
random gotcha about technology X, Y or Z. What
is interesting is how to approach the problem
so that you can fix it.

It seems like you're doing "trial and error" to try
to solve your problem.

Think differently.

If you can make it work from a standalone Java
program it cannot not work from a JSP.

2. Tried through sevlet also, by creating thread.

I'm pretty sure you shouldn't create threads from
a servlet... Especially in that case.
 
R

ruds

I have written the .bat file and saved it in my WEB-INF/classes
directory, but it does not run :(
My batch file:

@echo off
start C:\\Program Files\\PDFCreator\\PDFCreator.exe /NOSTART /PF\"C:\
\1.doc\"
echo File created.

It gives error "Cannot find c:\Program".
What is the problem now?
 
R

ruds

I would like to clear my doubt while calling the Java class from JSP
to execute my external program does the Java program have main()
function or do i just call the function which executes the external
program?
 
L

Lew

ruds said:
I have written the .bat file and saved it in my WEB-INF/classes
directory, but it does not run :(
My batch file:

@echo off
start C:\\Program Files\\PDFCreator\\PDFCreator.exe /NOSTART /PF\"C:\
\1.doc\"
echo File created.

It gives error "Cannot find c:\Program".
What is the problem now?

You didn't escape the space. Put quote marks around "Program Files" (or use
the "PROGRA~1" form). This is a Windows issue, not a Java one. You need to
know your platform.
 
A

Andrew Thompson

ruds wrote:
...
the "PROGRA~1" form).  This is a Windows issue, not a Java one.  You need to
know your platform.


I would dumb it down for this OP*.

OP, you need to have the /slightest clue./ Try hiring someone
with one (i.e. slightest clue).

( * who posts equally inept posts to the Sun forums. )
 
R

ruds

I did the changes,the bat file is running fine , but when I call it
through servlet again PDFCreator is called but no output is generated
also the program does not stop running until manually ended.
Im not giving any parameters to the batch script.

My batch file is:
@echo off
start C:\\"Program Files"\\PDFCreator\\PDFCreator.exe /NOSTART /PFC:\
\1.doc
echo File created.

Please suggest.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top