PRINT without PREVIEW

Post Reply
User avatar
damianodec
Posts: 372
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia
Contact:

PRINT without PREVIEW

Post by damianodec »

HI,
when I use this code:

Code: Select all

    
 PRINT oPrn NAME "Cartellino finiti" PREVIEW
    
        DEFINE FONT oFont NAME "Bahnschrift Light Condensed" SIZE 0, -18 BOLD OF oPrn
        DEFINE FONT oFont2 NAME "Bahnschrift Light Condensed" SIZE 0, -26 BOLD OF oPrn  
        DEFINE FONT oFont3 NAME "Bahnschrift Light Condensed" SIZE 0, -20 BOLD OF oPrn  

    nRowStep = oPrn:nVertRes() / 40     // 56  righe
    nColStep = oPrn:nHorzRes() / 80    // 170 colonne
    
    PAGE
    oPrn:SetCopies(nCopie)

    oPrn:Say(nRowStep * 2,nColStep * 65,Transform(m_get[01],"@ 99/99/9999"),oFont3) //Data
....
ENDPAGE
ENDPRINT
I get Preview window and then print the page.
but if I Use PRINT command without PREVIEW I get a empty page.
any help?
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: PRINT without PREVIEW

Post by karinha »

// C:\FWH...\SAMPLES\DAMIANO.PRG

Code: Select all

#Include "FiveWin.ch"

FUNCTION Main()

   LOCAL cComeFrom := "With preview"

   // oPrn:SetCopies( nCopie ) // Does not work
   LOCAL nCopie := 1

   nSetCopies( nCopie, cComeFrom ) // nCopies

RETURN NIL

FUNCTION nSetCopies( nCopie, cComeFrom )

   LOCAL nI

   FOR nI := 1 TO nCopie

      MsgRun( "PREVIEW.  WAIT...", ;
              "Wait a Moment... ", ;
              { || CursorWait(), WinExec( Imp_Damiano( cComeFrom ) ), 3 } )

   NEXT

RETURN NIL

FUNCTION Imp_Damiano( cComeFrom )

   LOCAL aPrn, oPrn, oFont, oFont2, oFont3, m_Get := ARRAY(5)
   LOCAL nRowStep, nColStep

   m_Get[01] := DTOC( DATE() )

   aPrn := GetPrinters()

   IF Empty( aPrn )
      RETURN NIL
   ENDIF

   PRINTER oPrn PREVIEW MODAL

   IF EMPTY( oPrn:hDC )
      oPrn:End()
      RETURN( .F. )
   ENDIF

   oPrn:End()

   IF cComeFrom = "Directtoprinter"

      PRINT oPrn NAME "Cartellino finiti"      // Direct to the printer

   ELSEIF cComeFrom = "With preview"

      PRINT oPrn NAME "Cartellino finiti" PREVIEW MODAL // With preview

   ELSEIF cComeFrom = "GeneratePDF"

     PRINT oPrn PREVIEW                                 // Generate PDF

   ENDIF
   
   DEFINE FONT oFont  NAME "Bahnschrift Light Condensed" SIZE 0, - 18 BOLD OF oPrn
   DEFINE FONT oFont2 NAME "Bahnschrift Light Condensed" SIZE 0, - 26 BOLD OF oPrn
   DEFINE FONT oFont3 NAME "Bahnschrift Light Condensed" SIZE 0, - 20 BOLD OF oPrn

   nRowStep = oPrn:nVertRes() / 40     // 56  righe
   nColStep = oPrn:nHorzRes() / 80    // 170 colonne
   
   PAGE

      oPrn:Say( nRowStep * 2, nColStep * 65, TRANSF( m_Get[01],"@D 99/99/9999" ), oFont3 ) //Data

   ENDPAGE

   ENDPRINT

   IF cComeFrom = "GeneratePDF"

      FWSavePreviewToPDF( oPrn, "Cartellino.pdf", .F. )

   ENDIF

   oFont:End()
   oFont2:End()
   oFont3:End()

RETURN NIL
 
Regards.
João Santos - São Paulo - Brasil
User avatar
damianodec
Posts: 372
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia
Contact:

Re: PRINT without PREVIEW

Post by damianodec »

it works
thank you!
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Post Reply