S
spacerobots
Hi,
I'm writing a java application (a servlet to be exact) that needs to
create a PDF. The problem I'm having is that I need to wait until the
PDF creator finishes its job and then pick up the new PDF and send it
off. So I want to wait without using up too much CPU, but at the same
time without waiting a moment longer than I have to after that PDF is
ready to go.
The basic idea is that it is taking in this file via the request
object and will then invoke an external application (via command line)
to print to the default printer. The default printer is PDF writer.
I can configure my PDF writer to write the file to disk using a custom
filename. My plan is in the doPost method to take the file out of the
request, save it to disk with a unique name, and then call the command
line application to print. I can then watch a directory for a file
with <unique name>.pdf to appear. The naive approach I'm thinking of
is to call the command line print, check if the pdf exists, wait 1/2
second or 1 second, check again, wait again, check again, etc until
the file has been created.
This servlet is going to see multiple simultaneous requests. It's
running Windows Server 2003. Any thoughts?
Thanks in advance,
-Ryan
I'm writing a java application (a servlet to be exact) that needs to
create a PDF. The problem I'm having is that I need to wait until the
PDF creator finishes its job and then pick up the new PDF and send it
off. So I want to wait without using up too much CPU, but at the same
time without waiting a moment longer than I have to after that PDF is
ready to go.
The basic idea is that it is taking in this file via the request
object and will then invoke an external application (via command line)
to print to the default printer. The default printer is PDF writer.
I can configure my PDF writer to write the file to disk using a custom
filename. My plan is in the doPost method to take the file out of the
request, save it to disk with a unique name, and then call the command
line application to print. I can then watch a directory for a file
with <unique name>.pdf to appear. The naive approach I'm thinking of
is to call the command line print, check if the pdf exists, wait 1/2
second or 1 second, check again, wait again, check again, etc until
the file has been created.
This servlet is going to see multiple simultaneous requests. It's
running Windows Server 2003. Any thoughts?
Thanks in advance,
-Ryan