Otto wrote:Enrico,
here's how I do it: I save an emf file and then reopen add the number and print it.
#include "FiveWin.ch"
#define HORZSIZE 4
#define VERTSIZE 6
#define HORZRES 8
#define VERTRES 10
//----------------------------------------------------------------------------//
INIT PROCEDURE XPrinterInit
EXTEND CLASS TPrinter WITH METHOD xImportWMF
return
//----------------------------------------------------------------------------//
static function xImportWMF( cFile, lPlaceable, oRechnung, lLastPage )
local Self := HB_QSelf()
local hMeta, hOld, hWMF
local aData := PrnGetSize( ::hDC )
local aInfo := Array( 5 )
local cEndText := ""
local oPrnFont, oPrnFont2
//RKSV
local nRow := 0
local cDst := ""
local aQRCodePosition := { 0,0,0,0 }
local cDepRgNr := ""
*----------------------------------------------------------
// local cBmpFile := "c:\xwinhotel\qrtemp.bmp"
if oRechnung:nBARZHG <> 0
cEndText := "BAR " + ALLTRIM( transform( oRechnung:nBARZHG,"99,999.99" ) )
endif
if oRechnung:nKARTE <> 0
cEndText := cEndText + " " + ALLTRIM( oRechnung:cCREDITCARD)
endif
if oRechnung:nKREDIT <> 0
cEndText := cEndText + " KRE. " + ALLTRIM( transform(oRechnung:nKREDIT,"99,999.99"))
endif
if oRechnung:nSCHECK <> 0
cEndText := cEndText + " SCHECK " + ALLTRIM( transform(oRechnung:nSCHECK,"99,999.99"))
endif
cEndText := cEndText + " " + oRechnung:cUSERName
DEFAULT lPlaceable := .T.
if ! File( cFile )
return nil
endif
SaveDC( ::hDCOut )
#ifdef __CLIPPER__
if lPlaceable
hMeta := GetPMetaFile( cFile, aInfo )
else
hMeta := GetMetaFile( cFile )
endif
#else
if Upper( cFileExt( cFile ) ) == "EMF"
hMeta := GetEnhMetaFile( cFile )
else
hOld = GetPMetaFile( cFile, aInfo )
hMeta = WMF2EMF( hOld, ::hDCOut )
endif
#endif
::SetIsoTropicMode()
::SetWindowExt( GetDeviceCaps( ::hDC, HORZRES ),;
GetDeviceCaps( ::hDC, VERTRES ) ) // aData[ 1 ], aData[ 2 ] )
::SetViewPortExt( GetDeviceCaps( ::hDC, HORZRES ),;
GetDeviceCaps( ::hDC, VERTRES ) ) // aData[ 1 ], aData[ 2 ] )
if ! ::lMeta
SetViewOrg( ::hDCOut, -::nXoffset, -::nYoffset )
endif
SetBkMode( ::hDCOut, 1 )
if Upper( cFileExt( cFile ) ) == "EMF"
PlayEnhMetafile( ::hDCOut, hMeta,, .t. )
//----------------------------------------------------------------------------//
DEFINE FONT oPrnFont NAME "Arial" SIZE 17 * ( ::nHorzRes()/2400), 50*(::nVertRes()/3250) // FNTNORMAL
DEFINE FONT oPrnFont2 NAME "Arial" SIZE Setup():nFntZHG * ( ::nHorzRes()/2400), 30 * (::nVertRes()/3250) * + ( Setup():nFntZHG/10 ) // FNTNORMAL
cDepRgNr := Setup():KassenID +"-" + ALLTRIM( oRechnung:cFLDNR_DEP )+"-" + ALLTRIM(str(oRechnung:nRgNr))
if UPPER( right( cFile, 5 ) ) = "1.EMF"
::CmSay( Setup():RgNr_ROW, Setup():RgNr_COL, cDepRgNr + " - Kopie", oPrnFont )
else
::CmSay( Setup():RgNr_ROW2, Setup():RgNr_COL2, cDepRgNr + " - Kopie", oPrnFont )
endif
if lLastPage = .t.
::CmSay( Setup():EndTXT_ROW, Setup():EndTXT_COL, "Bezahlt: " + cEndText, oPrnFont2 ) //Zahlungsart
::CmSay( Setup():Aufteilung_ROW, Setup():Aufteilung_COL, "Erlösauft: " + oRechnung:Erloesaufteilung(), oPrnFont )
cDst := Setup():cRKSVPfad + "\" + ALLTRIM( Setup():KassenID )+ "\QR\qr" + ALLTRIM( oRechnung:cFLDNR_DEP ) + ".bmp"
//Lesen der QRCode-position
aQRCodePosition[1] := VAL( GetPvProfString( "QRCodePosition" , "Top", "5000", ".\ini\RunTime.ini" ) )
aQRCodePosition[2] := VAL( GetPVProfString( "QRCodePosition" , "Left", "100", ".\ini\RunTime.ini" ) )
aQRCodePosition[3] := VAL( GetPVProfString( "QRCodePosition" , "nWidth", "700", ".\ini\RunTime.ini" ) )
aQRCodePosition[4] := VAL( GetPVProfString( "QRCodePosition" , "nHeight", "700", ".\ini\RunTime.ini" ) )
::SayBitmap( aQRCodePosition[1], aQRCodePosition[2], cDst, aQRCodePosition[3], aQRCodePosition[4] )
// nRow := Setup():Aufteilung_ROW - 500
// ::SayBitmap( 500, 1000, cBmpFile, 600, 600 )
endif
release oPrnFont
release oPrnFont2
//----------------------------------------------------------------------------//
else
PlayMetaFile( ::hDCOut, hWMF := EMF2WMF( hMeta, ::hDCOut ) )
DeleteMetafile( hWMF )
endif
DeleteEnhMetafile( hMeta )
if ! Empty( hOld )
DeleteMetafile( hOld )
endif
RestoreDC( ::hDCOut )
return nil
//----------------------------------------------------------------------------//
Enrico Maria Giordano wrote:It is required for printing something like this in each page:
Page no. x of y
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 51 guests