Hello,
In harbour\contrib\hbhpdf there is a cool library for create PDF file.
Would be great use it to create the pdf in FiveWin... any chance?
AntoninoP wrote:can you do a summary? they are 5 pages in Spanish...
//------------------------------------------------------------------------------
METHOD SetPage( nPageSize )
static aFW2HARUSizes
if empty(aFW2HARUSizes)
aFW2HARUSizes := {}
aAdd(aFW2HARUSizes, { 8.5 *72 ,11 *72 }) //#define DMPAPER_LETTER 1 // Letter 8 1/2 x 11 in
aAdd(aFW2HARUSizes, { 8.5 *72 ,11 *72 }) //#define DMPAPER_LETTERSMALL 2 // Letter Small 8 1/2 x 11 in
aAdd(aFW2HARUSizes, {11 *72 ,17 *72 }) //#define DMPAPER_TABLOID 3 // Tabloid 11 x 17 in
aAdd(aFW2HARUSizes, {11 *72 ,17 *72 }) ////#define DMPAPER_LEDGER 4 // Ledger 17 x 11 in
aAdd(aFW2HARUSizes, { 8.5 *72 ,14 *72 }) //#define DMPAPER_LEGAL 5 // Legal 8 1/2 x 14 in
aAdd(aFW2HARUSizes, { 5.5 *72 , 8.5 *72 }) //#define DMPAPER_STATEMENT 6 // Statement 5 1/2 x 8 1/2 in
aAdd(aFW2HARUSizes, { 7.25*72 ,10.5 *72 }) //#define DMPAPER_EXECUTIVE 7 // Executive 7 1/4 x 10 1/2 in
aAdd(aFW2HARUSizes, {29.7 *72/2.54,42 *72/2.54}) //#define DMPAPER_A3 8 // A3 297 x 420 mm
aAdd(aFW2HARUSizes, {21 *72/2.54,29.7 *72/2.54}) //#define DMPAPER_A4 9 // A4 210 x 297 mm
aAdd(aFW2HARUSizes, {21 *72/2.54,29.7 *72/2.54}) //#define DMPAPER_A4SMALL 10 // A4 Small 210 x 297 mm
aAdd(aFW2HARUSizes, {14.8 *72/2.54,21 *72/2.54}) //#define DMPAPER_A5 11 // A5 148 x 210 mm
aAdd(aFW2HARUSizes, {25 *72/2.54,35.4 *72/2.54}) //#define DMPAPER_B4 12 // B4 250 x 354
aAdd(aFW2HARUSizes, {18.2 *72/2.54,25.7 *72/2.54}) //#define DMPAPER_B5 13 // B5 182 x 257 mm
aAdd(aFW2HARUSizes, { 8.5 *72 ,13 *72 }) //#define DMPAPER_FOLIO 14 // Folio 8 1/2 x 13 in
aAdd(aFW2HARUSizes, {25.5 *72/2.54,27.5 *72/2.54}) //#define DMPAPER_QUARTO 15 // Quarto 215 x 275 mm
aAdd(aFW2HARUSizes, {10 *72 ,14 *72 }) //#define DMPAPER_10X14 16 // 10x14 in
aAdd(aFW2HARUSizes, {11 *72 ,17 *72 }) //#define DMPAPER_11X17 17 // 11x17 in
aAdd(aFW2HARUSizes, { 8.5 *72 ,11 *72 }) //#define DMPAPER_NOTE 18 // Note 8 1/2 x 11 in
aAdd(aFW2HARUSizes, {3.875*72 ,8.875*72 }) //#define DMPAPER_ENV_9 19 // Envelope #9 3 7/8 x 8 7/8
aAdd(aFW2HARUSizes, {4.125*72 , 9.5 *72 }) //#define DMPAPER_ENV_10 20 // Envelope #10 4 1/8 x 9 1/2
aAdd(aFW2HARUSizes, { 4.5 *72 ,10.375*72 }) //#define DMPAPER_ENV_11 21 // Envelope #11 4 1/2 x 10 3/8
aAdd(aFW2HARUSizes, { 4.75*72 ,11 *72 }) //#define DMPAPER_ENV_12 22 // Envelope #12 4 3\4 x 11
aAdd(aFW2HARUSizes, { 5 *72 ,11.5 *72 }) //#define DMPAPER_ENV_14 23 // Envelope #14 5 x 11 1/2
aAdd(aFW2HARUSizes, {17 *72 ,22 *72 }) //#define DMPAPER_CSHEET 24 // C size sheet 17 x 22-inches
aAdd(aFW2HARUSizes, {22 *72 ,34 *72 }) //#define DMPAPER_DSHEET 25 // D size sheet 22- by 34-inches
aAdd(aFW2HARUSizes, {34 *72 ,44 *72 }) //#define DMPAPER_ESHEET 26 // E size sheet 34x44
aAdd(aFW2HARUSizes, {11 *72/2.54,22 *72/2.54}) //#define DMPAPER_ENV_DL 27 // Envelope DL 110 x 220mm
aAdd(aFW2HARUSizes, {16.2 *72/2.54,22.9 *72/2.54}) //#define DMPAPER_ENV_C5 28 // Envelope C5 162 x 229 mm
aAdd(aFW2HARUSizes, {23.4 *72/2.54,45.8 *72/2.54}) //#define DMPAPER_ENV_C3 29 // Envelope C3 324 x 458 mm
aAdd(aFW2HARUSizes, {22.9 *72/2.54,32.4 *72/2.54}) //#define DMPAPER_ENV_C4 30 // Envelope C4 229 x 324 mm
aAdd(aFW2HARUSizes, {11.4 *72/2.54,16.2 *72/2.54}) //#define DMPAPER_ENV_C6 31 // Envelope C6 114 x 162 mm
aAdd(aFW2HARUSizes, {11.4 *72/2.54,22.9 *72/2.54}) //#define DMPAPER_ENV_C65 32 // Envelope C65 114 x 229 mm
aAdd(aFW2HARUSizes, {25 *72/2.54,25.3 *72/2.54}) //#define DMPAPER_ENV_B4 33 // Envelope B4 250 x 353 mm
aAdd(aFW2HARUSizes, {17.6 *72/2.54,25 *72/2.54}) //#define DMPAPER_ENV_B5 34 // Envelope B5 176 x 250 mm
aAdd(aFW2HARUSizes, {17.6 *72/2.54,12.5 *72/2.54}) //#define DMPAPER_ENV_B6 35 // Envelope B6 176 x 125 mm
aAdd(aFW2HARUSizes, {11 *72/2.54,23 *72/2.54}) //#define DMPAPER_ENV_ITALY 36 // Envelope 110 x 230 mm
aAdd(aFW2HARUSizes, {3.875*72 , 7.5 *72 }) //#define DMPAPER_ENV_MONARCH 37 // Envelope Monarch 3.875 x 7.5 in
aAdd(aFW2HARUSizes, {3.625*72 , 6.5 *72 }) //#define DMPAPER_ENV_PERSONAL 38 // 6 3/4 Envelope 3 5/8 x 6 1/2 in
aAdd(aFW2HARUSizes, {14.875*72 ,11 *72 }) //#define DMPAPER_FANFOLD_US 39 // US Std Fanfold 14 7/8 x 11 in
aAdd(aFW2HARUSizes, { 8.5 *72 ,12 *72 }) //#define DMPAPER_FANFOLD_STD_GERMAN 40 // German Std Fanfold 8 1/2 x 12 in
aAdd(aFW2HARUSizes, { 8.5 *72 ,13 *72 }) //#define DMPAPER_FANFOLD_LGL_GERMAN 41 // German Legal Fanfold 8 1/2 x 13 in
endif
//------------------------------------------------------------------------------
::nWidth := aFW2HARUSizes[nPageSize,1]
::nHeight := aFW2HARUSizes[nPageSize,2]
::SyncPage()
RETURN Self
//------------------------------------------------------------------------------
METHOD SyncPage()
LOCAL tmp
//------------------------------------------------------------------------------
IF ::hPage != NIL
if ::nOrientation = HPDF_PAGE_LANDSCAPE .and. ::nWidth<::nHeight
tmp := ::nWidth
::nWidth := ::nHeight
::nHeight := tmp
endif
if ::nOrientation = HPDF_PAGE_PORTRAIT .and. ::nWidth>::nHeight
tmp := ::nWidth
::nWidth := ::nHeight
::nHeight := tmp
endif
HPDF_Page_SetWidth( ::hPage, ::nWidth)
HPDF_Page_SetHeight( ::hPage, ::nHeight)
ENDIF
RETURN NIL
METHOD Cmtr2Pix( nRow, nCol )
nRow *= 72 / 2.54
nCol *= 72 / 2.54
RETURN {nRow,nCol}
METHOD Mmtr2Pix( nRow, nCol )
nRow *= 72 / 25.4
nCol *= 72 / 25.4
RETURN {nRow,nCol}
METHOD FillRect(aRect, hBrush)
LOCAL nColor := BrushColor(hBrush)
::Rect(aRect[1],aRect[2],aRect[1]+aRect[3],aRect[2]+aRect[4],nColor)
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
HB_FUNC( BRUSHCOLOR )
{
LOGBRUSH lb;
if( hb_parnl( 1 ) )
{
#ifndef _WIN64
GetObject( ( HGDIOBJ ) hb_parnl( 1 ), sizeof( LOGBRUSH ), ( LPSTR ) &lb );
#else
GetObject( ( HGDIOBJ ) hb_parnll( 1 ), sizeof( LOGBRUSH ), ( LPSTR ) &lb );
#endif
hb_retnl( lb.lbColor );
}
else
hb_retnl( 0 );
}
#pragma ENDDUMP
#include <fivewin.ch>
#define HKEY_LOCAL_MACHINE 2147483650 // 0x80000002
proc main()
LOCAL oReg := TReg32():New(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows NT\CurrentVersion\Fonts", .t.)
LOCAL cKey, cValue
LOCAL nId := 1, aInfos := {}
//? oReg:nError
do while .t.
oReg:nError := MY_REGENUMVALUE(oReg:nHandle, nId, @cKey, @cValue)
aadd(aInfos, { cKey, cValue })
if oReg:nError<>0
exit
endif
nId += 1
enddo
XBROWSER aInfos
return
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
#ifndef _WIN64
#define fw_parh hb_parnl
#else
#define fw_parh hb_parnll
#endif
HB_FUNC( MY_REGENUMVALUE ) // ( nKey, nIndex, @cKeyName, @uValue ) --> nResult
{
BYTE name[ 1024 ];
BYTE value[ 1024 ];
DWORD lName=1024, lValue=1024, type = 0;
hb_retnl( RegEnumValueA( ( HKEY ) fw_parh( 1 ), hb_parnl( 2 ), ( LPSTR ) name, &lName, 0, &type, value, &lValue ) );
hb_storc( ( const char * ) name, 3 );
switch( type )
{
case REG_SZ:
hb_storc( ( const char * ) value, 4 );
break;
case REG_DWORD:
hb_stornl( * ( ( LPDWORD ) value ), 4 );
break;
}
}
#pragma ENDDUMP
HPDF_Page_SetRGBFill( ::hPage, HB_BitAnd(Int( nClrText),0xFF ) / 255.00, HB_BitAnd(HB_BitShift(Int( nClrText),-8),0xFF ) / 255.00,HB_BitAnd(HB_BitShift(Int( nClrText),-16),0xFF ) / 255.00 )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 84 guests