New features:
***********************************************************
HMG HPDF
HPDFPRINT command improvements:
- UNDERLINE style support added (simulation).
- STRIKEOUT style support added (simulation).
- ANGLE <nAngle> attribute has been added - text rotation by angle <nAngle>
- TOP | MIDDLE vertical alignment style has been added for the ANGLE attribute
- optionally define styles BOLD | ITALIC | UNDERLINE | STRIKEOUT has been added - optional attribute IF <lValid>
New commands:
- SET HPDFDOC FONT NAME TO <cFontName> - set the default font as <cFontName>.
- SET HPDFDOC FONT SIZE TO <nFontSize> - set the default font size to <nFontSize>.
Removal of noticed bugs.
Sample:
- sample-1.png (138.19 KiB) Viewed 4561 times
Code: Select all
#include "hmg.ch"
#include "harupdf.ch"
Function Main()
SELECT HPDFDOC "sample.pdf" PAPERLENGTH 300 PAPERWIDTH 300 LOG
START HPDFDOC
START HPDFPAGE
SET HPDFDOC ENCODING TO "WinAnsiEncoding"
@ 5, 10 HPDFPRINT "Default font and size." UNDERLINE
@ 10,100 HPDFPRINT "This is a sample Text CENTER." CENTER
@ 15,200 HPDFPRINT "This is a sample Text in BOLD RIGHT." BOLD RIGHT
@ 20, 10 HPDFPRINT "This is a sample Text in ITALIC." ITALIC
SET HPDFDOC FONT SIZE TO 8
SET HPDFDOC FONT NAME TO "Arial Narrow"
@ 30, 10 HPDFPRINT "Arial Narrow 8" FONT "Helvetica" SIZE 12 UNDERLINE IF .T.
@ 35, 10 HPDFPRINT "This is a sample Text."
@ 40, 10 HPDFPRINT "This is a sample Text in BOLD IF .T." BOLD IF .T.
@ 45, 10 HPDFPRINT "This is a sample Text in ITALIC IF .T. " ITALIC IF .T.
SET HPDFDOC FONT SIZE TO 10
SET HPDFDOC FONT NAME TO "Courier"
@ 55, 10 HPDFPRINT "Courier 10" FONT "Helvetica" SIZE 12 UNDERLINE
@ 60, 10 HPDFPRINT "This is a sample Text."
@ 65, 10 HPDFPRINT "This is a sample Text in BOLD IF .F." BOLD IF .F.
@ 70, 10 HPDFPRINT "This is a sample Text in ITALIC IF .F." ITALIC IF .F.
SET HPDFDOC FONT SIZE TO 18
SET HPDFDOC FONT NAME TO "Times-Roman"
lBold := .T.
@ 85, 10 HPDFPRINT "Times-Roman (built-in) 18" FONT "Helvetica" SIZE 12 UNDERLINE STRIKEOUT IF .F.
@ 90, 10 HPDFPRINT "This is a sample Text BOLD IF lBold ITALIC UNDERLINE STRIKEOUT" BOLD IF lBold ITALIC UNDERLINE STRIKEOUT
SET HPDFDOC FONT NAME TO "Times"
@ 115, 10 HPDFPRINT "Times 18" FONT "Helvetica" SIZE 12 UNDERLINE
@ 120, 10 HPDFPRINT "This is a sample Text baseline................................................................"
@ 120, 150 HPDFPRINT "Sample Text BOLD IF .T. ANGLE 90" BOLD IF .T. COLOR {255,0,0} ANGLE 90
@ 120, 150 HPDFPRINT "Sample Text BOLD IF .F. ANGLE -90" BOLD IF .F. COLOR {255,0,0} ANGLE -90
@ 120, 170 HPDFPRINT "Sample Text UNDERLINE ANGLE 90 TOP" UNDERLINE COLOR {0,255,0} ANGLE 90 TOP
@ 120, 190 HPDFPRINT "Sample Text ITALIC IF .T. STRIKEOUT ANGLE 90 MIDDLE" ITALIC IF .T. STRIKEOUT COLOR {0,0,255} ANGLE 90 MIDDLE
SET HPDFDOC FONT SIZE TO 13
SET HPDFDOC FONT NAME TO "Symbol"
@ 135, 10 HPDFPRINT "Symbol 13" FONT "Helvetica" SIZE 12 UNDERLINE
@ 140, 10 HPDFPRINT "This is a sample Text."
SET HPDFDOC FONT SIZE TO 6
SET HPDFDOC FONT NAME TO "ZapfDingbats"
@ 150, 10 HPDFPRINT "ZapfDingbats 6" FONT "Helvetica" SIZE 12 UNDERLINE
@ 155, 10 HPDFPRINT "This is a sample Text."
SET HPDFDOC FONT SIZE TO 22
SET HPDFDOC FONT NAME TO "MAIAN.TTF"
@ 170, 10 HPDFPRINT "MAIAN.TTF 22" FONT "Helvetica" SIZE 12 UNDERLINE
@ 175, 10 HPDFPRINT "This is a sample Text."
SET HPDFDOC FONT SIZE TO
SET HPDFDOC FONT NAME TO
@ 190, 10 HPDFPRINT "Back to Defaults"
END HPDFPAGE
END HPDFDOC
Execute File 'sample.pdf'
Return Nil
***********************************************************
PRINT SYSTEM
1) For SELECT PRINTER <cPrinter> | DEFAULT ... and SELECT PRINTER DIALOG ... :
PRINT command improvements:
- optionally define styles BOLD | ITALIC | UNDERLINE | STRIKEOUT has been added - optional attribute IF <lValid>
Sample:
Code: Select all
#include "hmg.ch"
Function Main()
DEFINE WINDOW Win_1 ;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 400 ;
TITLE 'Test' ;
MAIN
@ 50, 50 BUTTON Button_1 CAPTION "Test" ACTION PrintTest()
END WINDOW
CENTER WINDOW Win_1
ACTIVATE WINDOW Win_1
Return
*------------------------------------------------------------------------------*
Procedure PrintTest
*------------------------------------------------------------------------------*
LOCAL lSuccess, IsPreview, xTab := 50, aList:={ {"Code","000001"} , {"Description","#PEPPER MARMALADE"} , {"Price", 2.35} , {"Code","000002"} , {"Description","!NEW"} , {"Price", 123.45} }, i, xRow := 20
SELECT PRINTER DIALOG TO lSuccess PREVIEW
If lSuccess == .F.
MsgInfo('Print Error')
Return
EndIf
START PRINTDOC
START PRINTPAGE
FOR i=1 TO LEN(aList)
@ xRow,20 PRINT aList[i][1] + REPLICATE(".", 100) TO xRow + 5, xTab + .5 ;
FONT "Arial" ;
SIZE 10
@ xRow,xTab PRINT ": " + ALLTRIM(hb_ValToStr( aList [i][2] )) ;
FONT "Arial" ;
SIZE 10 BOLD IF ALLTRIM(hb_ValToStr( aList [i][2] ))='!' STRIKEOUT IF ALLTRIM(hb_ValToStr( aList [i][2] ))='#'
xRow += 5
Next i
END PRINTPAGE
END PRINTDOC
Return
2) For SELECT PRINTER PDF <PDF File> TO <Success>:
PRINT command improvements:
- UNDERLINE style support added (simulation).
- STRIKEOUT style support added (simulation).
- ANGLE <nAngle> attribute has been added - text rotation by angle <nAngle>
- TOP | MIDDLE vertical alignment style has been added for the ANGLE attribute
- optionally define styles BOLD | ITALIC | UNDERLINE | STRIKEOUT has been added - optional attribute IF <lValid>
Sample:
Code: Select all
#include "hmg.ch"
Function Main()
DEFINE WINDOW Win_1 ;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 400 ;
TITLE 'Test' ;
MAIN
@ 50, 50 BUTTON Button_1 CAPTION "Test" ACTION PrintTest()
END WINDOW
CENTER WINDOW Win_1
ACTIVATE WINDOW Win_1
Return
*------------------------------------------------------------------------------*
Procedure PrintTest
*------------------------------------------------------------------------------*
LOCAL lSuccess
SELECT PRINTER PDF "test.pdf" TO lSuccess
If lSuccess == .F.
MsgInfo('Print Error')
Return
EndIf
START PRINTDOC
START PRINTPAGE
@ 5, 10 PRINT "Default font and size." UNDERLINE
@ 10,100 PRINT "This is a sample Text CENTER." CENTER
@ 15,200 PRINT "This is a sample Text in BOLD RIGHT." BOLD RIGHT
@ 20, 10 PRINT "This is a sample Text in ITALIC." ITALIC
SET HPDFDOC FONT SIZE TO 8
SET HPDFDOC FONT NAME TO "Arial Narrow"
@ 30, 10 PRINT "Arial Narrow 8" FONT "Helvetica" SIZE 12 UNDERLINE IF .T.
@ 35, 10 PRINT "This is a sample Text."
@ 40, 10 PRINT "This is a sample Text in BOLD IF .T." BOLD IF .T.
@ 45, 10 PRINT "This is a sample Text in ITALIC IF .T. " ITALIC IF .T.
SET HPDFDOC FONT SIZE TO 10
SET HPDFDOC FONT NAME TO "Courier"
@ 55, 10 PRINT "Courier 10" FONT "Helvetica" SIZE 12 UNDERLINE
@ 60, 10 PRINT "This is a sample Text."
@ 65, 10 PRINT "This is a sample Text in BOLD IF .F." BOLD IF .F.
@ 70, 10 PRINT "This is a sample Text in ITALIC IF .F." ITALIC IF .F.
SET HPDFDOC FONT SIZE TO 18
SET HPDFDOC FONT NAME TO "Times-Roman"
lBold := .T.
@ 85, 10 PRINT "Times-Roman (built-in) 18" FONT "Helvetica" SIZE 12 UNDERLINE STRIKEOUT IF .F.
@ 90, 10 PRINT "This is a sample Text BOLD IF lBold ITALIC UNDERLINE STRIKEOUT" BOLD IF lBold ITALIC UNDERLINE STRIKEOUT
SET HPDFDOC FONT NAME TO "Times"
@ 115, 10 PRINT "Times 18" FONT "Helvetica" SIZE 12 UNDERLINE
@ 120, 10 PRINT "This is a sample Text baseline................................................................"
@ 120, 150 PRINT "Sample Text BOLD IF .T. ANGLE 90" BOLD IF .T. COLOR {255,0,0} ANGLE 90
@ 120, 150 PRINT "Sample Text BOLD IF .F. ANGLE -90" BOLD IF .F. COLOR {255,0,0} ANGLE -90
@ 120, 170 PRINT "Sample Text UNDERLINE ANGLE 90 TOP" UNDERLINE COLOR {0,255,0} ANGLE 90 TOP
@ 120, 190 PRINT "Sample Text ITALIC IF .T. STRIKEOUT ANGLE 90 MIDDLE" ITALIC IF .T. STRIKEOUT COLOR {0,0,255} ANGLE 90 MIDDLE
SET HPDFDOC FONT SIZE TO 13
SET HPDFDOC FONT NAME TO "Symbol"
@ 135, 10 PRINT "Symbol 13" FONT "Helvetica" SIZE 12 UNDERLINE
@ 140, 10 PRINT "This is a sample Text."
SET HPDFDOC FONT SIZE TO 6
SET HPDFDOC FONT NAME TO "ZapfDingbats"
@ 150, 10 PRINT "ZapfDingbats 6" FONT "Helvetica" SIZE 12 UNDERLINE
@ 155, 10 PRINT "This is a sample Text."
SET HPDFDOC FONT SIZE TO 22
SET HPDFDOC FONT NAME TO "MAIAN.TTF"
@ 170, 10 PRINT "MAIAN.TTF 22" FONT "Helvetica" SIZE 12 UNDERLINE
@ 175, 10 PRINT "This is a sample Text."
SET HPDFDOC FONT SIZE TO
SET HPDFDOC FONT NAME TO
@ 190, 10 PRINT "Back to Defaults"
END PRINTPAGE
END PRINTDOC
Return
Sources:
Files from the attachment should be copied to the folder where HMG 3.4.4 is installed, and then rebuild HMG (BuildLib32.bat).
Remember to make a backup copy of the replaced files.
==========================================================
References:
==========================================================
PRINT DATA
----------------------------------------------------------
Prints Data
@ <Row> , <Col> PRINT [ DATA ] <xData>
[ TO <nToRow> , <nToCol> ]
[ FONT <cFontName> ]
[ SIZE <nFontSize> ]
[ BOLD [ IF lBold ] ]
[ ITALIC [ IF lItalic ] ]
[ UNDERLINE [ IF lUnderline ] ]
[ STRIKEOUT [ IF lStrikeout ] ]
[ COLOR <aColor> ]
[ RIGHT | CENTER ]
[ ANGLE <nAngleInDegrees> ]
[ TOP | MIDDLE ]
- <xData> type can be character, numeric, date, logical or memo.
- Logical data is shown as 'Yes' or 'No' (translated according selected language).
- If <xData> is multi-line text (character or memo types), you must specify TO <nToRow> , <nToCol> optional parameters.
- When <xData> type is numeric, digits are printed begining exactly at specified position (without leading spaces).
- If optional RIGHT clause is used <Row> , <Col> indicates the right coordinates of <xData> (unless TO <nToRow> , <nToCol> is specified.)
- If optional CENTER clause is used <Row> , <Col> indicates the center coordinates of <xData> (unless TO <nToRow> , <nToCol> is specified.)
- If optional IF clause for the styles: BOLD | ITALIC | UNDERLINE | STRIKEOUT is used, then the style will be active when the expression given after IF return "true".
- Support for the UNDERLINE and STRIKEOUT style for PDF has been added. (Style simulation). (Unless TO <nToRow> , <nToCol> is specified.)
- Support for the ANGLE rotation for PDF has been added. (Unless TO <nToRow> , <nToCol> is specified.)
- If optional TOP clause is used <Row> , <Col> indicates the top coordinates of rotated <xData> (unless TO <nToRow> , <nToCol> is specified) (only supported by SELECT PRINTER PDF <PDF File> TO <Success>).
- If optional MIDDLE clause is used <Row> , <Col> indicates the middle coordinates of rotated <xData> (unless TO <nToRow> , <nToCol> is specified.) (only supported by SELECT PRINTER PDF <PDF File> TO <Success>).
Units: <Row> , <Col> units are milimeters.
Sample:
@ 10, 10 PRINT "Test BOLD" FONT "Arial" SIZE 10 BOLD IF lBold ITALIC
Prints "Test BOLD" as italicised and bolded, when lBold is "true".
==========================================================
HMG HPDF
----------------------------------------------------------
HPDFPRINT Prints Data
@ <Row> , <Col> HPDFPRINT [ DATA ] <xData>
[ TO <nToRow> , <nToCol> ]
[ FONT <cFontName> ]
[ SIZE <nFontSize> ]
[ BOLD [ IF lBold ] ]
[ ITALIC [ IF lItalic ] ]
[ UNDERLINE [ IF lUnderline ] ]
[ STRIKEOUT [ IF lStrikeout ] ]
[ COLOR <aColor> ]
[ RIGHT | CENTER | JUSTIFY]
[ ANGLE <nAngleInDegrees> ]
[ TOP | MIDDLE ]
- If <xData> is multi-line text (character or memo types), you must specify TO <nToRow> , <nToCol> optional parameters.
- If optional RIGHT clause is used <Row> , <Col> indicates the right coordinates of <xData> (unless TO <nToRow> , <nToCol> is specified.)
- If optional CENTER clause is used <Row> , <Col> indicates the center coordinates of <xData> (unless TO <nToRow> , <nToCol> is specified.)
- Optional JUSTIFY clause is valid when TO <nToRow> , <nToCol> is specified.
- If optional IF clause for the styles: BOLD | ITALIC | UNDERLINE | STRIKEOUT is used, then the style will be active when the expression given after IF return "true".
- Support for the UNDERLINE and STRIKEOUT style has been added. (Style simulation). (Unless TO <nToRow> , <nToCol> is specified.)
- Support for the ANGLE rotation has been added. (Unless TO <nToRow> , <nToCol> is specified.)
- If optional TOP clause is used <Row> , <Col> indicates the top coordinates of rotated <xData> (unless TO <nToRow> , <nToCol> is specified)
- If optional MIDDLE clause is used <Row> , <Col> indicates the middle coordinates of rotated <xData> (unless TO <nToRow> , <nToCol> is specified.)
Units: <Row> , <Col> units are milimeters.
Sample:
@ 10, 10 HPDFPRINT "Test BOLD" FONT "Arial" SIZE 10 BOLD IF lBold ITALIC
Prints "Test BOLD" as italicised and bolded, when lBold is "true".
----------------------------------------------------------
SET HPDFDOC FONT NAME TO <cFontName>
Set the default font as <cFontName>.
SET HPDFDOC FONT NAME TO - restores the "Helvetica" font as the default.
----------------------------------------------------------
SET HPDFDOC FONT SIZE TO <nFontSize>
Set the default font size to <nFontSize>.
SET HPDFDOC FONT SIZE TO - restores font size 12 as the default.
==========================================================