Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. PrintDocument1.PrinterSettings.CanDuplex

PrintDocument1.PrinterSettings.CanDuplex

Scheduled Pinned Locked Moved C#
questioncsharpcomgraphics
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amadeonMk
    wrote on last edited by
    #1

    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.

    H 1 Reply Last reply
    0
    • A amadeonMk

      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.

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      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

      A 1 Reply Last reply
      0
      • H Heath Stewart

        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

        A Offline
        A Offline
        amadeonMk
        wrote on last edited by
        #3

        isn't it possible to convert pdf file to PostScript format and then print it? Can this solve my problem?

        H 1 Reply Last reply
        0
        • A amadeonMk

          isn't it possible to convert pdf file to PostScript format and then print it? Can this solve my problem?

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups