Printing double sided

Printing double sided

Postby dtussman » Mon Oct 03, 2022 9:54 pm

Is there some command to force a printer to print single-sided? I see there's a command prnduplex() but can't find any documentation.
dtussman
 
Posts: 97
Joined: Sat Jun 06, 2015 6:57 pm

Re: Printing double sided

Postby Enrico Maria Giordano » Tue Oct 04, 2022 8:20 am

Try this:

Code: Select all  Expand view  RUN
PRNDUPLEX( nValue )


where nValue is one of these:

Code: Select all  Expand view  RUN
/* duplex enable */
#define DMDUP_SIMPLEX    1
#define DMDUP_VERTICAL   2
#define DMDUP_HORIZONTAL 3


Reference:

https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-devmodea
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Printing double sided

Postby karinha » Tue Oct 04, 2022 2:43 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Printing double sided

Postby dtussman » Tue Oct 04, 2022 5:31 pm

Thanks, but how would you restore printing to single sided? It seems that with MAC computers the default is double sided, o r if someones printer is set to double sided and I want to switch to single sided how would i do it? Would prnduplex(0) work?
dtussman
 
Posts: 97
Joined: Sat Jun 06, 2015 6:57 pm

Re: Printing double sided

Postby Enrico Maria Giordano » Tue Oct 04, 2022 5:38 pm

No, it should be this:

Code: Select all  Expand view  RUN
PRNDUPLEX( DMDUP_SIMPLEX )


Code: Select all  Expand view  RUN
DMDUP_SIMPLEX   Normal (nonduplex) printing.
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Printing double sided

Postby TimStone » Tue Oct 04, 2022 5:51 pm

All my printing is always single-sided and I would love to have double-sided as an option. Yes, my printer supports it.

I see the objective here is to push single sided, but what if I wanted it to be double sided ?

Thanks.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Printing double sided

Postby dtussman » Tue Oct 04, 2022 6:11 pm

OK but DMDUP_SIMPLEX is a variable that does not exist. I would suspect it represents a numeric value and perhaps that is 0???
dtussman
 
Posts: 97
Joined: Sat Jun 06, 2015 6:57 pm

Re: Printing double sided

Postby Enrico Maria Giordano » Tue Oct 04, 2022 7:18 pm

Please, both of you, carefully reread my first message! There is all you need.
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Printing double sided

Postby dtussman » Tue Oct 04, 2022 8:42 pm

Got it! thanks Enrico. My brain cells were not all firing I guess.
dtussman
 
Posts: 97
Joined: Sat Jun 06, 2015 6:57 pm


Re: Printing double sided

Postby TimStone » Wed Oct 05, 2022 10:16 pm

I've had two recent eye surgeries, and didn't have corrective lenses ( to see the text clearly ) until today.

Re-reading this, and the reference page, I would do the following:

Single Sided =. PrnDuplex( 1 )
Dual sided, Landscape = PrnDuplex( 3 )
Dual sided, Portrait = PrnDuplex( 2 )

Now ... If my printer defaults to Single Sided, and I select Duplex for a print job, do I need to issue the command to return to simplex at the end of a job, or will it automatically default back ?
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Printing double sided

Postby Enrico Maria Giordano » Thu Oct 06, 2022 7:50 am

I don't know. Please try and let us know.
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Printing double sided

Postby TimStone » Tue Oct 25, 2022 12:46 am

Sorry for the delay. I finally had the chance to test this. Here is what I have found:

1) I can use PRNDUPLEX( 1 ) to set the printer to one side only

2) I can use PRNDUPLEX( 2 ) or ( 3 ) to print both sides ( duplex ). HOWEVER, it prints incorrectly. Either 2 or 3 will print the same. It is called "short edge binding" and it means that with a single sheet, you rotate it vertically to see the other side properly. (2) should use long edge binding. That means on page one, if you hold the left side and flip the page to the left, the back side will have the print top at the same top of the sheet as the front.

3) I also find if I send it to the printer from the View mode, it works. If I send it directly to the printer, it does not work. In other words, in the print selection dialog, FROM USER needs to be selected, and just sending to the default printer does not trigger duplex printing.

We have no provision for passing this value in the tPrinter class. We can pass mode ( portrait or landscape ), number of copies, and more, but we cannot pass the Duplex setting. Since all of my reports are built with the tPrinter class, this would be a very useful addition. I think this would solve the issue in #3 above.

I DID FURTHER RESEARCH:
Here is the PRNDUPLEX code from FW:
Code: Select all  Expand view  RUN
HB_FUNC( PRNDUPLEX ) // ( nValue ) --> nOldValue
{
   LPDEVMODE  lpDevMode;
   int dmDuplex;

   PrinterInit();

   lpDevMode  = (LPDEVMODE) GlobalLock( pd.hDevMode );

   dmDuplex = lpDevMode->dmDuplex;

   if( hb_pcount() > 0 )
      lpDevMode->dmDuplex = hb_parni( 1 );

   hb_retni( dmDuplex );
   GlobalUnlock( pd.hDevMode );
}

 

Note that is does not take the value passed. So apparently the command defaults to "short side binding". I'm not sure who would use that one (3). We need to use long edge binding ( 2 ).

Yes, it would be nice to see this incorporated, with proper options, in the tPrinter class ( printer.prg )

Antonio ????
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Printing double sided

Postby Antonio Linares » Tue Oct 25, 2022 7:22 am

Dear Tim,

Checking it with Mr. Rao

many thanks for your feedback
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Printing double sided

Postby Enrico Maria Giordano » Tue Oct 25, 2022 7:28 am

TimStone wrote:Note that is does not take the value passed.


Yes, it does:

Code: Select all  Expand view  RUN
lpDevMode->dmDuplex = hb_parni( 1 );


Or am I missing something?
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 102 guests