FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How reduce the size of metafile in printer
Posts: 58
Joined: Thu Oct 13, 2005 01:26 PM
How reduce the size of metafile in printer
Posted: Wed Jan 04, 2006 06:56 PM

Help!

How to reduce the size of a metafile using the metod

oPRINT:ImportWMF("Layout")

???

Posts: 58
Joined: Thu Oct 13, 2005 01:26 PM
I have solved the problem
Posted: Fri Jan 06, 2006 11:37 AM

I have created the method EMF( cfile, right, left, top, bottom )

METHOD EMF( cFile, left, right, top, bottom ) CLASS TPrinter

 Local hMeta,oRect
 Local aData:=PrnGetSize( ::hDC )

 IF ! FILE( cFile )
    Return nil
 Endif

 SaveDC( ::hDCOut )

 hMeta:=GetEnhMetaFile( cFile )

 ::SetIsoTropicMode()
 ::SetWindowExt( aData[1], aData[2] )
 ::SetViewPortExt( aData[1], aData[2] )
 SetViewOrg( ::hDCOut, -1, -1 )

 STRUCT oRect
    MEMBER nLeft   AS LONG
    MEMBER nTop    AS LONG
    MEMBER nRight  AS LONG
    MEMBER nBottom AS LONG
 ENDSTRUCT

 oRect:nLeft   := left
 oRect:nTop    := top
 oRect:nRight  := aData[1] - right  - ::nXoffset - ::nXoffset
 oRect:nBottom := aData[2] - bottom - ::nYoffset - ::nYoffset

 SetBkMode( ::hDCOut, 1 )

 PlayEMF( ::hDCOut, hMeta, oRect:cBuffer , .T. )

 DeleteEnhMetafile( hMeta )

 RestoreDC( ::hDCOut )

Return nil

DLL32 FUNCTION PLAYEMF( hDC AS LONG, hEMF AS LONG, cRect AS LPSTR ) AS BOOL;
PASCAL FROM "PlayEnhMetaFile" LIB "gdi32.dll"

Continue the discussion