473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

catch acrobat "document failed to print" error

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
1 1965
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Pieter Linden | last post by:
I found this code posted by FredG (thanks Fred!) This will cycle through all your reports. Public Sub GetRecordSource() ' Print out the RecordSource for each report. Dim doc As Document Dim...
1
by: John Dalberg | last post by:
Running Crystal Reports with the hotfixes and patches & VS 2003. I created a CR report on my development server which has SQL Server. The report runs fine inside Visual Studio. When I switched...
1
by: Roy | last post by:
Hey all, I have a VB App which uses the bundled version of Crystal Reports for VS.NET 2003. It works fine in when I run it using VS *but* when I deploy it anywhere (including the development PC...
2
by: Jeff_Mac | last post by:
Hi there. I'm a bit of a newbie, and I would appreciate any help that anyone can give me on an error I'm getting with Crystal Reports. Every time I attempt to view a report using the Crystal...
2
by: InvisibleDuncan | last post by:
I have a Crystal report that, if certain parameters are entered, returns no data. This is fine if I call it from VB6 - it just returns a blank report. However, from VB.Net, it gives me an error...
1
by: aaaaaa | last post by:
running a crystal (v10) reporting app on a virtual web server and getting the "Validation of viewstate MAC failed...." error when opening the crystal viewer. Any help please!!!
1
by: gslim | last post by:
I am trying to implement the busybox sample from // From Mark Wagner // http://blogs.crsw.com/mark/articles/642.aspx When I get to this line I get an access denied error. Could someone give me...
0
by: Radu | last post by:
Hi. I have finished a web-site - and it runs fine on my dev machine. I have deployed it onto the server, and now I have this (which, by the way, doesn't seem to happen all the time - sometimes I...
0
by: sa6113 | last post by:
I am using this code to connect to a windows machine using paramiko, I have installed sshd on the machine and it works properly: sock.connect((hostname, port)) t = paramiko.Transport(sock)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.