Page 1 of 1

Printing, switching paperbins

Posted: Thu Feb 10, 2011 10:29 am
by HRoesch01
Hi all!

I need to switch paperbins when printing copies.
The logic is as follows: The first copy shall go to
bin 1, all following copies shall go to bin 2.

I tried to implement this in tdcprv3:PrintSeg
in the for k=1 to ::numCopies-loop. But the
printer does not react at all to my setPaperBin (nBin)
statement, it simply prints to standard bin.

Any hints appreciated!

Greetings

Heinz

Re: Printing, switching paperbins

Posted: Thu Feb 10, 2011 11:00 am
by rdonnay
Before calling :setPaperBin() you must first call :endPage(), then after calling :setPaperBin() to must call :startPage().

Re: Printing, switching paperbins

Posted: Thu Feb 10, 2011 11:40 am
by RDalzell
Heinz,

tdcprv3 is a TopDown command, best to ask Clayton directly.

Re: Printing, switching paperbins

Posted: Thu Feb 10, 2011 12:03 pm
by Auge_Ohr
HRoesch01 wrote:o:setPaperBin (nBin)
#Define in c:\ALASKA\XPPW32\Include\xbpdev.ch must not "match" your Printer.

use o:paperBins() to find out if #Define "match" your Printer
this it a HP 2055dn Printer with 2nd Paper Tray
HP_Paperbin.JPG
HP_Paperbin.JPG (18.13 KiB) Viewed 12154 times

Re: Printing, switching paperbins

Posted: Fri Feb 11, 2011 6:39 am
by HRoesch01
Hi Roger!
rdonnay wrote:Before calling :setPaperBin() you must first call :endPage(), then after calling :setPaperBin() to must call :startPage().
Yeah, that did the trick! Thank you for fast and excellent support, as usual!

Since the exact sequence of print methods is of critical importance,
i would like to present the final solution. Just in case someone has
a client, that needs this special type of printing. :mrgreen:

Greetings

Heinz

Code: Select all

IF lPrint
   nCopies := ::nNumCopies
   ::tdcprn3:SetNumCopies (1)

   ******* Give PS to printer object
   ::oPS:mode := XBPPS_MODE_NORMAL
   ::oPs:configure(self)
   ::oPs:setfont(::oFont)

   FOR k := 1 TO nCopies
      if k == 1
         // erste Kopie auf Schacht 1
         nBin := GetPaperBin (::tdcPrn3:DevName, 1)
         if TestMode ()
            alert ("Schacht 1: " + str (nBin))
         endif
         if ! empty (nBin)
            ::tdcPrn3:endPage ()
            ::tdcPrn3:SetPaperBin (nBin)
            ::tdcPrn3:startPage ()
         endif
      else
         // folgende Kopien auf Schacht 2
         nBin := GetPaperBin (::tdcPrn3:DevName, 2)
         if TestMode ()
            alert ("Schacht 2: " + str (nBin))
         endif
         if ! empty (nBin)
            ::tdcPrn3:endPage ()
            ::tdcPrn3:SetPaperBin (nBin)
            ::tdcPrn3:startPage ()
         endif
      endif

      ******* begin output
      ::tdcPrn3:startdoc(cJob)

      IF cMode == 'all'

         nLen := len(::aSegments)
         FOR i := 1 TO nLen
            GraSegDraw(::oPs,::aSegments[i])
            IF i < nLen
               ::tdcPrn3:newpage()
            ENDIF
         NEXT

      ELSEIF cMode == 'curr'
         ******* print current segment
         GraSegDraw(::oPs,::nSeg)

      ELSEIF cMode == 'range'

         FOR i := nP1 TO nP2
            GraSegDraw(::oPs,::aSegments[i])
            IF i < nP2
               ::tdcPrn3:newpage()
            ENDIF
         NEXT

      ENDIF

      ******* end output
      ::tdcPrn3:endDoc()
   NEXT

   ******* Take back PS from printer object
   ::oPS:mode := XBPPS_MODE_HIGH_PRECISION
   ::oPS:configure(::oPage:windevice())
   ::oPS:setfont(::oFont)

   ******* reset PS color attribute
   ::oPS:SetAttrArea(::aAreaAttr)

   ******* resize vp
   ::calcVP(@vnX,@vnY,@vnX2,@vnY2)
   ::oPs:setViewPort({vnX,vnY,vnX2,vnY2})

   ::lPrinted := .T.

ENDIF  // lPrint

Re: Printing, switching paperbins

Posted: Fri Feb 11, 2011 6:46 am
by HRoesch01
Hi Jimmy!
Auge_Ohr wrote:#Define in c:\ALASKA\XPPW32\Include\xbpdev.ch must not "match" your Printer.
Yes, i know. Windows chaos, as usual! :mrgreen:

Since we do not need that very often i have a support
function in our software that alerts the paperBins()-data
for any choosable printer.

The supporter than feeds back the chosen bins by use
of simple system variables. Not too elegant, but it works!

Greetings

Heinz