Quickfix for two-sided printing

  • In printing to an hp LaserJet printer, I discovered that the two-sided printing was not working with WPTools. After asking tech support, I was informed that I should trace the code myself because there is no two-sided printer for the staff to use. Well, here are the results of my discoveries:

    In the WPPrint.pas unit, there is a function called TWPPrinterEngine.UpdatePrinterProperties. This is the function that is supposed to determine whether or not the printing job will be two-sided. However, the code that determines this is broken.

    In order to determine whether or not the job is two-sided, the PrintDuplex property must be set. But, it is not being set in the standard print setup dialog. So, as a workaround to this, I added some code. Although it works with an hp LaserJet, I do not know whether or not it will work with all two-sided printers.

    In the UpdatePrinterProperties function, immediately before the line that says, "case fprintduplex of", I added the following:


    Code
    if Devmode^.dmDuplex = 1 then
      fprintduplex := wpdNone
    else if Devmode^.dmDuplex = 2 then
      fprintduplex := wpdVertical
    else
      fprintduplex := wpdHorizontal;

    Then, I recompiled the WPTools run-time package and it started working just fine. I hope this helps! If somebody has a better way of doing this, let me know. Thanks :)