Click here to Skip to main content
13,151,815 members (60,701 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi :)

I have a folder with 10 pdfs, and, I whant to know how I can print this 10 pdfs without show the printdialog, for all pdfs, something like this:

public void PrintAllDocuments()
            string[] AllFiles = Directory.GetFiles(@"C:\PDF\", "*.pdf", SearchOption.AllDirectories);
            for (int i = 0; i < AllFiles.Length; i++)
                PrintFile pf = new PrintFile(AllFiles[i]);
                pf.printerName = "HP ???";
                pf.paper = "A4";

of course, that is some a sample... but, How I can configure the printer and print the document, witout use the PrintDialog... to open the PDF and print the PDF, how I can do this ??? :(

Thanks for help. :)
Posted 3-Jan-13 2:26am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

add a printDocument control to your form and use that e.g.
this.printDocument1.DocumentName = @"c:\document1.pdf";

See also[^] for more details

Ok - everything above here is fine but not for Adobe products - i.e. PDFs.

The following links will be more useful...
Printing pdf files with c#[^]


and I'm off to have a better look at[^]
URVISHSUTHAR 3-Jan-13 9:23am
yeah, above should work proper
Alexandre Bencz 3-Jan-13 9:40am
It's simple, but, when I do this, the printer just put out one blank paper... :(
CHill60 3-Jan-13 10:08am
It's just done the same for me when I use a different printer ... give me a moment or two and I'll try to find out what I've missed out
CHill60 3-Jan-13 10:19am
I've just updated the solution with some other links - seems it's not that simple to print PDFs!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170924.2 | Last Updated 3 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100