PrintDocument1.PrinterSettings.CanDuplex
-
i have to print a .pdf file to a HP LaserJet 9000 PCL mfp printer which can print duplex. i am using Acrobat COM object to print, and .net's PrintDocument's PrinterSettings for setting the printer. But it returns false when i use CanDuplex and does not change the duplex setting when i set PrinterSettings.Duplex. The code can be seen below. does anyone have idea how can i solve this? Or is there are more easy way doing this like using a PrinttoFile printer or etc.? PrintDocument1.PrinterSettings.PrinterName="HP LaserJet 9000 PCL 6"; if(PrintDocument1.PrinterSettings.CanDuplex) { axPdf1.printPages(1,1); PrintDocument1.PrinterSettings.Duplex=System.Drawing.Printing.Duplex.Horizontal; axPdf1.printPages(2,3); } i want to thank Heath Stewart for his assistance at printing pdf files.
-
i have to print a .pdf file to a HP LaserJet 9000 PCL mfp printer which can print duplex. i am using Acrobat COM object to print, and .net's PrintDocument's PrinterSettings for setting the printer. But it returns false when i use CanDuplex and does not change the duplex setting when i set PrinterSettings.Duplex. The code can be seen below. does anyone have idea how can i solve this? Or is there are more easy way doing this like using a PrinttoFile printer or etc.? PrintDocument1.PrinterSettings.PrinterName="HP LaserJet 9000 PCL 6"; if(PrintDocument1.PrinterSettings.CanDuplex) { axPdf1.printPages(1,1); PrintDocument1.PrinterSettings.Duplex=System.Drawing.Printing.Duplex.Horizontal; axPdf1.printPages(2,3); } i want to thank Heath Stewart for his assistance at printing pdf files.
Printer settings are not persisted to the printer (unless you set them on the driver itself using the printer properties). They are passed to the print subsystem along with the document. Since Acrobat controls it's own printing, it will send the settings it wants regardless of what you think you set. You could always call
printWithDialog
if this still fits your requirements. Otherwise, you might consider checking out the Adobe Acrobat SDK, although it might only be available to Adobe Developers Network (or something like that - maybe that was just Photoshop and Illustrator, though). That might contain additional information about controlling the printing from a client.Microsoft MVP, Visual C# My Articles
-
Printer settings are not persisted to the printer (unless you set them on the driver itself using the printer properties). They are passed to the print subsystem along with the document. Since Acrobat controls it's own printing, it will send the settings it wants regardless of what you think you set. You could always call
printWithDialog
if this still fits your requirements. Otherwise, you might consider checking out the Adobe Acrobat SDK, although it might only be available to Adobe Developers Network (or something like that - maybe that was just Photoshop and Illustrator, though). That might contain additional information about controlling the printing from a client.Microsoft MVP, Visual C# My Articles
-
isn't it possible to convert pdf file to PostScript format and then print it? Can this solve my problem?
And how do you propose to do that? You'll still need something that knows how to print and/or convert PDF files. If your printer supports PostScript, you can print to a file but you'll still need a program to read and print the PDF. That's even if your printer supports PostScript (most HP's do, but they prefer PCL for some stupid reason). And to my knowledge, the printing subsystem that .NET encapsulates (at least in the base class libraries) doesn't support spooling RAW documents (since you'd be sending the PostScript, you don't want the driver to convert it to PostScript). You'd need to find a completely different printing library that can spool RAW (and since most printing libraries are to help you accomplish printing graphics and text, I doubt you're going to find one). You'll be forced to P/Invoke calls on the print server. But that still doesn't solve your problem since you still need something that can read and print PDF files. If this isn't an automated program, just use
printWithDialog
on the Acrobat OCX. If this is an automated program, take a look at the Acrobat solutions on Adobe[^]'s web site. They do have a product that can monitor directories and convert to PDF (Distiller, part of the Acrobat application). IIRC, there's also one that can monitor a directory and print the files using options you specify. If the Acrobat OCX doesn't work for you, there are others, some even written in managed code, such as TallPDF (or something like that - they advertise on CodeProject and supposedly are pretty good).Microsoft MVP, Visual C# My Articles