By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,677 Members | 1,177 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,677 IT Pros & Developers. It's quick & easy.

catch acrobat "document failed to print" error

P: n/a
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/dev...veloperFAQ.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.ProcessWindowSt yle.Hidden;
}
try
{
p = System.Diagnostics.Process.Start(psi);
}
catch (Exception pex)
{
Log(pex.ToString(),w);
p.Kill();
}

Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"TD" <to*******@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
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/dev...veloperFAQ.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.ProcessWindowSt yle.Hidden;
}
try
{
p = System.Diagnostics.Process.Start(psi);
}
catch (Exception pex)
{
Log(pex.ToString(),w);
p.Kill();
}

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.