473,385 Members | 1,893 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,385 software developers and data experts.

batch printing pdf files



I loop through the code that looks like this to batch a set of pdf
files.

Process command = new Process();
command.StartInfo.FileName = "AcroRd32.exe";
command.StartInfo.Arguments = "/p /h " + pdfFileName;
command.StartInfo.RedirectStandardOutput = true;
command.StartInfo.UseShellExecute = false;
command.Start();

The problem is, the order in which the documents are printed is very
important. But it seems like Acrobat Reader and the printer scramble
the order.

Here is a very strange thing. Right after command.Start(), I tried

command.StandardOutput.ReadToEnd();

It USED TO WORK. And then out of the blue, it prints the document and
just hangs until I kill Acrobat Reader.

Adding

Thread.Sleep(10000);

Will make the order right, but only to a degree. The order is just less
scrambled, which is not good enough.

So please help.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
1 6733
You will need to wait for each process to finish before starting a new
priting process.

I would make the following changes
Process command = new Process();
command.StartInfo.FileName = "AcroRd32.exe";
command.StartInfo.Arguments = "/p /h " + pdfFileName;
command.StartInfo.RedirectStandardOutput = true;
command.StartInfo.UseShellExecute = false;
command.Start();
command.StandardOutput.ReadToEnd(); command.WaitForExit();

On Fri, 18 Mar 2005 17:26:27 -0800, David Cho <pr********@yahoo.com>
wrote:


I loop through the code that looks like this to batch a set of pdf
files.

Process command = new Process();
command.StartInfo.FileName = "AcroRd32.exe";
command.StartInfo.Arguments = "/p /h " + pdfFileName;
command.StartInfo.RedirectStandardOutput = true;
command.StartInfo.UseShellExecute = false;
command.Start();

The problem is, the order in which the documents are printed is very
important. But it seems like Acrobat Reader and the printer scramble
the order.

Here is a very strange thing. Right after command.Start(), I tried

command.StandardOutput.ReadToEnd();

It USED TO WORK. And then out of the blue, it prints the document and
just hangs until I kill Acrobat Reader.

Adding

Thread.Sleep(10000);

Will make the order right, but only to a degree. The order is just less
scrambled, which is not good enough.

So please help.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: nawwu | last post by:
I would like to know how to print HTML Pages in batch i.e without the user intervention, I want to setup all the printing parameters like file name and printer name thru the code. I tried it using...
0
by: Steve Jorgensen | last post by:
I remember that I used to set up utility batch files, and create Windows shortcuts to them that would ask the user for parameters to supply to the batch files. From what I can tell, this...
3
by: David Cho | last post by:
I am still struggling with this. Used the PrintDocument class, but it was printing gobblygook. Does not recognize the PDF files as Acrobat files and just prints text. Can't get the shell...
6
by: Charles Neitzel | last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C# 2005 Express) that is nothing more than a simple UI with buttons on it. The buttons do various things like running...
1
by: Charles | last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C# 2005 Express) that is nothing more than a simple UI with buttons on it. The buttons do various things like running...
1
by: Mitchell Vincent | last post by:
I've had this trouble in every language I've tried for Windows. Apparently the problem is with the underlying controls or something.. When I loop through and use a hidden web gadget to load and...
1
by: Parasyke | last post by:
Thanks for any help.. I currently have a database with about 100 products with picture links in an external folder. I have a form from which I can successfully display a product, its...
0
by: jiafangsee | last post by:
Hi, I'm using Visual Studio 2005 and I have a web application where i generated some delivery order in crystal report then it's exported to pdf for viewing and printing. Now I need to develop...
22
Missionary
by: Missionary | last post by:
I need to batch print reports. I've looked at past posts about batch printing, but I don't know visual basic, so I'll need some coaching. I have a report based on a parameter query. I have it...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.