FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour PRINT without PREVIEW
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
PRINT without PREVIEW
Posted: Tue Mar 03, 2020 04:25 PM
HI,
when I use this code:
Code (fw): Select all Collapse
    
 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 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: PRINT without PREVIEW
Posted: Tue Mar 03, 2020 05:52 PM
// C:\FWH...\SAMPLES\DAMIANO.PRG

Code (fw): Select all Collapse
#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 - Phone: +55(11)95150-7341
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
Re: PRINT without PREVIEW
Posted: Wed Mar 04, 2020 07:47 AM

it works
thank you!

FiveWin for xHarbour 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)

Continue the discussion