Problem with batch timeout

Using Batch Processing and Enhanced Batch Processing
Post Reply
Posts: 1
Joined: Mon Apr 21, 2008 4:30 am

Problem with batch timeout

Post by randalli » Mon Apr 21, 2008 4:53 am

I've downloaded the trial version of the Print2Flash software on my WinXP machine to see if we should buy it to convert a large number of PDF files to Flash. I can convert the files just fine by starting up Adobe Reader and printing an SWF file using the Print2Flash printer driver. However when I attempt to convert a file in a batch process with a command like:

p2fserver.exe c:\PDFs\2002-z8.pdf c:\PDFs\2002-z8.swf /InterfaceOptions:3566 /Orientation:2 /BeforePrintingTimeout:60000 /AfterPrintingTimeout:300 /CreateLogFile:on /LogFileName:C:\PDFs\testlog.txt /LoggingLevel:1 /PressPrintButton:on

it fails producing the following log file:

4/21/2008 1:16:55 AM Batch job started
4/21/2008 1:16:55 AM Converting file C:\PDFs\2002-z8.pdf
4/21/2008 1:17:55 AM The file (C:\PDFs\2002-z8.pdf) could not be converted. Exception : Before printing timeout expired
4/21/2008 1:17:55 AM Trying to kill the printing application (5940)
4/21/2008 1:17:55 AM TerminateProcess failed (5)
4/21/2008 1:17:55 AM Batch job completed. 0 files converted, 1 errors

I tried different options of /PressPrintButton but always get the same error. I've tried making Print2Flash the default printer with no luck. I'm kind of out of ideas. This would be perfect for my needs if I could get the batch processing working. Any help would be appreciated.

Posts: 4
Joined: Mon Sep 14, 2009 8:55 am

Re: Problem with batch timeout

Post by colindean » Mon Sep 14, 2009 10:07 am

I am experiencing a very similar error while attempting to convert pdf and ppt.

I believe a brief description of the process is in order.

I have a Windows server running IIS. The web app is a CGI application which processes some input, including a filename to convert. The CGI application launches a Ruby script which handles calculating the paths for a temp directory and output file name and actually launching p2fserver.exe as a system() call.

Ruby command line executed by CGI app

Code: Select all

"C:\Program Files\ConvertApp\bin/ruby.exe" "C:\Program Files\ConvertApp\bin/any2swf.rb" "--input-file" "C:/Program Files/ConvertApp/ppt2swf/test.ppt" "--output-directory" "C:\Program Files\ConvertApp\bin/../converter-output" "--temp-directory" "C:\Program Files\ConvertApp\tmp\viv_8S20ZU" "--content-name" "converter-output" "--input-type" ppt
p2fserver command line executed by Ruby

Code: Select all

"C:\Program Files\Print2Flash\p2fServer.exe" "C:/Program Files/ConvertApp/tmp/viv_8S20ZU/test.ppt.ppt" "C:/Program Files/ConvertApp/converter-output/viv_8S20ZUtest.ppt.swf" /BeforePrintingTimeout:300000 /AfterPrintingTimeout:300000 /PrintingTimeout:300000 /CreateLogFile:on /LogFileName:C:\p2flog.txt
OpenOffice trying to print the file, executed by p2fserver.exe

Code: Select all

"C:\Program Files\ 3\program\\simpress.exe"  -pt "Print2Flash printer" "C:\Program Files\ConvertApp\tmp\viv_8S20ZU\test.ppt.ppt"
The web app churns for a little bit, then, generally, CGI times out (primarily because I've increased every timeout except it). The Print2Flash log is pretty indicative of what is likely happening: the printing program, here, OpenOffice, never exits for some reason.

Code: Select all

9/14/2009 9:40:57 AM	Batch job started
9/14/2009 9:40:57 AM	Converting file C:\Program Files\Vivisimo\tmp\viv_S190ZU\test.ppt.ppt
9/14/2009 9:40:57 AM	Using shell printto
9/14/2009 9:45:58 AM	The file (C:\Program Files\Vivisimo\tmp\viv_S190ZU\test.ppt.ppt) could not be converted. EOleException : Before printing timeout expired
9/14/2009 9:45:58 AM	Trying to kill the printing application (3172)
9/14/2009 9:45:58 AM	Waiting.... 
9/14/2009 9:45:58 AM	done.
9/14/2009 9:45:58 AM	Batch job completed. 0 files converted, 1 errors
The test files are a PowerPoint with a few slides and a PDF version of the same. Launching any of the above commands at a prompt yields a successful conversion, the duration of which is generally under 10 seconds.

Using Process Explorer to watch these processes spawn from IIS, I gleaned through the simpress.exe process that a thread is sitting at the state "Wait:WrUserRequest" or "Wait:UserRequest", which leads me to believe that p2fserver.exe may not be obeying the /PressPrintButton:on or may be unable to execute it when converting with OpenOffice and Adobe Reader (program launched when printing pdfs).

After the obvious timeouts expire, p2fserver is unable to kill the OpenOffice process.

I have attempted a much simpler conversion using a simple text file and the entire process completes successfully, using Notepad as the printing program. This positive outcome indicates that the problem likely lays in the interaction between p2fserver.exe and more robust applications often associated as the default program for printing/opening.

Also, at some point in my fiddling, I tried giving explicit printing rights to the IIS user, as well as changing the user which IIS uses to execute the CGI (and thus its subprocesses including p2fserver). Changing the user seemed to permit p2fserver to launch OpenOffice--it hadn't before that substitution--but the problem with waiting for user input seemed to shift from p2fserver to OpenOffice. As it stands, IIS runs as Administrator, and this is obviously not desirable for when the web app is taken live.

I plan to try Microsoft Office as the converter, but I expect an outcome similar to OpenOffice and Adobe Reader and it would only fix the Powerpoint side of the issue. I would prefer not to use the OLE API, but will if the above is a known problem when using batch mode. However, based on a quick perusal of the API documentation, it seems like the API would function similarly in its execution of the printing program, i.e. OpenOffice or Adobe Reader.

This impasse leads to a few questions:

1) What programs are known to work well with p2fserver when used in conjunction with IIS, other than Notepad?

2) Is there a way to better investigate the cause of the Wait thread state since the process is not attached to a display? (I.e., I can't see if there's a print dialog hanging)

3) Should the ISS user have to be changed? This is really not a desirable necessity.

Posts: 282
Joined: Sat Dec 15, 2007 4:48 pm

Re: Problem with batch timeout

Post by staff » Thu Sep 17, 2009 5:06 am

Please see this forum topic for information on "Before printing timeout" error: viewtopic.php?f=19&t=5&p=5

The most common reason for this issue is the printing application (such as OpenOffice) does not start printing when instructed to do it. If you are invoking Print2Flash Server using batch processing from a Ruby web script, the Print2Flash Server and the printing application do not have sufficient rights to print using the rights of the user under which web script runs. Web scripts are usually run using a restricted user account under which many printing applications cannot print.

There are two solutions for this:
1. Run your web scripts under a user with more rights. However, this is not desirable as ALL web scripts will be run using more rights which may pose a securiy threat
2. To overcome this problem, you need to use OLE Automation API and run Print2Flash under a different user account as described in this help topic: ... ccount.php

Answers to your specific questions:
1. All programs that support programmatic printing can work with Print2Flash under IIS if you use OLE Automation API and run Print2Flash under a different user account. These includes OpenOffice, MS Office, Adobe Reader, etc.
2. Unfortunately it is not possible to debug this directly under IIS. However, you may log in yourself as a user setup for Print2Flash Service in Print2Flash Service Configuration window and perform a "right click" test mentioned in this topic: viewtopic.php?f=19&t=5&p=5 to see what happens when a printing application is instructed to print
3. No, if you use OLE Automation API and run Print2Flash under a different user account.

Posts: 4
Joined: Mon Sep 14, 2009 8:55 am

Re: Problem with batch timeout

Post by colindean » Mon Sep 21, 2009 8:16 am

Thank you for the response. We elevated rights temporarily while investigating using the OLE API.

Post Reply