0

I've succeeded on printing MS office documents with the office interops, but documents such as pdf, or hwp is troubling me.

Just printing those files are not that hard. This piece of code was all I needed to print.

                Process process = new Process();
                process.StartInfo.FileName = fileInfo.FullName;
                process.StartInfo.Verb = "Print";
                process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                process.Start();

But, my intention is, I want to print multiple pages of pdf or hwp in one page.(ex. four pages on a single page)

As I seached, those two formats does not support any free, unlimited privilged libraries. So, my next approach is to change the defaultprinter settings. On windows, I've found out that on the control pane, I can manually change the printer settings for duplex, or multipaged printing. How can I change this programmatically?

March3April4
  • 2,131
  • 1
  • 18
  • 37

1 Answers1

2

There's free PDF libraries out there. (For example, iTextSharp is a C# port of the fine iText, which can easily do 2-on-1 and 4-on-1 page transformations.) But those are more focused on manipulating PDFs and similar documents to produce more documents, and will not expose detailed printing controls.

If those aren't doing it for you, could you use .NET or ActiveX interop to automate IE or Adobe Reader, or a similar application that can read PDFs and has printer support? They're readily available, and their exposed ActiveX controls probably have stuff that corresponds to those printer settings.

Twiddling the default printer settings at a user level might have undesired side effects.

Andrew Janke
  • 23,508
  • 5
  • 56
  • 85
  • Thanks a lot!. Using the iTextSharp to manipulate the pages, then print using my source may do fine. If I succeed, I'll post my codes. Again, thanks! – March3April4 Apr 20 '15 at 07:08