Page 2 of 2

Re: Printing double sided

PostPosted: Tue Oct 25, 2022 7:01 pm
by TimStone
I saw that after my last post, but the question becomes, how is it passed ?

C is not my strength ... but is PRNDUPLEX( 2 ) really passing the specific value correctly ?

Re: Printing double sided

PostPosted: Tue Oct 25, 2022 9:42 pm
by Antonio Linares
Dear Tim,

function PRNDUPLEX() just uses one parameter and it is properly assigned here:

lpDevMode->dmDuplex = hb_parni( 1 );

Re: Printing double sided

PostPosted: Tue Oct 25, 2022 9:57 pm
by TimStone
Antonio,

The the problem persists. The use of 1 outputs to just one side of the page ( correctly ).

Option 2 or 3 result in the same short side binding. One of them should be short side, and the other long side ( preferred but does not occur ).
I checked the referenced Microsoft site, Googled the process, etc, and it should work. However, in testing ( multiple times ) it doesn't. I always get short sided binding with either 2 or 3 .

Tim

Re: Printing double sided

PostPosted: Wed Oct 26, 2022 8:45 am
by nageswaragunupudi
Enrico Maria Giordano wrote:
TimStone wrote:Note that is does not take the value passed.


Yes, it does:

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


Or am I missing something?


You are right.
Code: Select all  Expand view
nPrevMode := PRNDUPLEX( nNewMode )

woks perfectly.

Re: Printing double sided

PostPosted: Wed Oct 26, 2022 2:05 pm
by nageswaragunupudi
Code: Select all  Expand view

/* duplex enable */
#define DMDUP_SIMPLEX    1
#define DMDUP_VERTICAL   2
#define DMDUP_HORIZONTAL 3
 


In portait mode, if we want to stitch/staple the book on left side (long edge), use DMDUP_VERTICAL(2), otherwise (very uncommon) if we plan to staple on the top (short side) then use DMDUP_HORIZONTAL(3)

In case of landscape printing, if we want to staple the book on left side (short edge) then use DMDUP_HORIZONTA( 3 ), or if we want to staple on the top (long edge) use DMDUP_VERTICAL(2).

I have tested all and working well.

Re: Printing double sided

PostPosted: Wed Oct 26, 2022 4:25 pm
by TimStone
At what point are you issuing the command ? Are you passing it as a numeric ( 2 ) or string ( "2" ).

Code: Select all  Expand view

 // Present the print selection option window and find the type
   nPrnOpt := PRNSEL()
   IF nPrnOpt = 0                               // If Exit is specified, leave the print report function
      RETURN NIL
   ENDIF

   // Now tell the print engine the type of format to use
   IF nPrnOpt = 1
      PRINT oPrn NAME "Workorder Printing" PREVIEW FROM USER MODAL // Preview with alternate printer selection
   ELSEIF nPrnOpt = 2
      PRINT oPrn NAME "Workorder Printing" PREVIEW MODAL // Preview with default printer
   ELSEIF nPrnOpt = 3
      PRINT oPrn NAME "Workorder Printing" FROM USER // Send to user selected printer
   ELSEIF nPrnOpt = 4
      PRINT oPrn NAME "Workorder Printing"      // Send to default printer
   ENDIF


   // ?????????  HERE ??????????
   PRNDUPLEX( 2 )



   // Define the brush
   // Set the resolution divided by the standard 8.5x11 inch paper rows/columns
   nRsp := oPrn:nVertRes() / 68                 // Number of rows
   nCsp := oPrn:nHorzRes() / 85                 // Number of columns
   // Now send the number of copies to the printer
   oPrn:SetCopies( nPrnCopies )
 
   // Turn on the first page - print the header data
   PAGE
   WOHEADER( oPrn, aHead )
....

   // End of print
   ENDPAGE
   oPrn:SetCopies( 1 )
   ENDPRINT
 


The ... represent actions like setting fonts, brushes, colors, and printing the individual lines of output.

Re: Printing double sided

PostPosted: Wed Oct 26, 2022 10:03 pm
by TimStone
This may be an issue with my printer. If I use the option to select a printer, and in that Windows setup control select the proper output ( long binding ), it still comes out the same way. I can let it ride for now ...

Re: Printing double sided

PostPosted: Thu Oct 27, 2022 12:57 am
by nageswaragunupudi
Code: Select all  Expand view

PRINT ....
// Anywhere between PRINT between ENDPRINT
nSaveDuplex := PRNDUPLEX(  2 or 3 )
// ...
// ...
ENDPRINT
PRNDUPLEX( nSaveDuplex )
 

I am using Numeric value.

Re: Printing double sided

PostPosted: Thu Oct 27, 2022 1:08 am
by TimStone
That is what I’vve done so I will leave it in. The output is wrong on my printer but hopefully client printers will be good. Thank you


Sent from my iPhone using Tapatalk

Re: Printing double sided

PostPosted: Thu Oct 27, 2022 1:31 am
by nageswaragunupudi
That is what I’vve done so I will leave it in. The output is wrong on my printer but hopefully client printers will be good. Thank you

Let us try again your tomorrow.
Please post a small self contained program.
Let us also add this
Code: Select all  Expand view
if ISDUPLEXPRINTER()
   PRNDUPLEX( n )
endif