Monday, July 27, 2009

How can I select specific pages to print from my PDF file using C#?

I have a lot of PDF files to print. I wrote a program in C# to do this for me. It seems to work fine, but it forces me to print the entire document. I only need the first couple pages, which is the difference between printing 40 pages and 4000 pages. The code I am using is below:





myProcess.StartInfo.FileName = file;


myProcess.StartInfo.Verb = "Print";


myProcess.StartInfo.CreateNoWindow = true;


myProcess.Start();

How can I select specific pages to print from my PDF file using C#?
This won't work at all. There are no start commands you can send it that will control the pages printed.





You have to use Acrobat as a COM object, or send it DDE commands.





I've done an open source program that shows how to use the full Acrobat as a COM object (although I did not specifically implement page ranges.)





http://www.codeplex.com/tphbatchprinter





Here's the Adobe documentation on automating Acrobat.





http://www.adobe.com/devnet/acrobat/inte...

funeral flowers

No comments:

Post a Comment