catch acrobat "document failed to print" error

T

TD

I'm using iText in an app to create and print documents to network
printers.

I launch acrobat via the command line as shown on this page...

http://partners.adobe.com/public/developer/en/acrobat/sdk/pdf/intro_to_sdk/DeveloperFAQ.pdf

Every once in a while, I get a generic "document failed to print"
dialog from acrobat.

I have the calling process in a try{} block but no Exception is
caught...

here is the calling code... is there a more specific catch block that
I can use that will catch the error? Something like System.IO ??

Thanks for any help...


System.Diagnostics.Process p = null;
System.Diagnostics.ProcessStartInfo psi = null;

if(param != "no printer")
{
printCnt++;
if(!acrobatInstanceExists("AcroRd32"))
{
psi = new System.Diagnostics.ProcessStartInfo();
psi.FileName = app;
psi.Arguments = param;
psi.WindowStyle=System.Diagnostics.ProcessWindowStyle.Hidden;
}
try
{
p = System.Diagnostics.Process.Start(psi);
}
catch (Exception pex)
{
Log(pex.ToString(),w);
p.Kill();
}
 
N

Nicholas Paldino [.NET/C# MVP]

TD,

You aren't going to have an exception thrown, because this is running in
another process. The only way to know what happened is if the process
terminates as a result, and a specific error code is returned as the exit
code from the process.

I don't know if this is possible, but if acrobat has an automation/COM
interface that you can access the functionality through, then I recommend
doing that. If not, then I suggest you get a third party control to do
this, since you won't be able to catch the error.

Hope this helps.
 
T

TD

Thanks Nicholas...I was afraid of that. I appreciate your time and
will investigate the COM avenue...

TD
 

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

Top