HPDFPRINT TO ERRO

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
jairpinho
Posts: 251
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Been thanked: 5 times
Contact:

Re: HPDFPRINT TO ERRO

Post by jairpinho » Mon Dec 03, 2018 7:17 pm

edk wrote:
Mon Dec 03, 2018 7:09 pm
Show me line 41 proc TESTE

41 @ nNextRow, 15 HPDFPRINT cEdit TO nNextRow + nHeight , 185 FONT cFonte1 size 9 JUSTIFY WRAP
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

edk
Posts: 382
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 110 times
Been thanked: 278 times

Post by edk » Mon Dec 03, 2018 7:34 pm

Also send me your hmg_hpdf.ch and h_HMG_HPDF.Prg

Or try with mine (HMG 3.4.4.)
jair.zip
(20.83 KiB) Downloaded 5 times

User avatar
jairpinho
Posts: 251
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Been thanked: 5 times
Contact:

Post by jairpinho » Mon Dec 03, 2018 8:25 pm

edk wrote:
Mon Dec 03, 2018 7:34 pm
Also send me your hmg_hpdf.ch and h_HMG_HPDF.Prg

Or try with mine (HMG 3.4.4.) jair.zip
with the procedure did not work with your files worked perfectly but the modification before this does not work anymore

46 @ 20, 15 HPDFPRINT cEdit1 TO 40, 198 FONT cFonte1 size 9 COLOR { 0, 0, 0 } RIGHT WRAP
erro3pdf.jpg
erro3pdf.jpg (50.17 KiB) Viewed 141 times
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

edk
Posts: 382
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 110 times
Been thanked: 278 times

Post by edk » Mon Dec 03, 2018 9:00 pm

I'm sorry, but I did not understand what you wrote.
On my h_HMG_HPDF.Prg both the command works correctly:

Code: Select all

@ 20, 15 HPDFPRINT cEdit1 TO 40, 198 FONT cFonte1 size 9 COLOR {0, 0, 0} RIGHT WRAP
as well:

Code: Select all

@ nNextRow, 15 HPDFPRINT cEdit TO nNextRow + nHeight, 185 FONT cFonte1 size 9 JUSTIFY WRAP
Your screenshot shows an error in _HMG_HPDF_MULTILINE_PRINT on line 504. The file I sent to you on this line has the following record:
Bez tytułu.png
Bez tytułu.png (2.1 KiB) Viewed 137 times
and this has nothing to do with the erroneous HMG_UPPER argument.

Have you modified my h_HMG_HPDF.Prg?

Attach your sample prg.

User avatar
jairpinho
Posts: 251
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Been thanked: 5 times
Contact:

Post by jairpinho » Mon Dec 03, 2018 9:08 pm

edk wrote:
Mon Dec 03, 2018 9:00 pm
I'm sorry, but I did not understand what you wrote.
On my h_HMG_HPDF.Prg both the command works correctly:

Code: Select all

@ 20, 15 HPDFPRINT cEdit1 TO 40, 198 FONT cFonte1 size 9 COLOR {0, 0, 0} RIGHT WRAP
as well:

Code: Select all

@ nNextRow, 15 HPDFPRINT cEdit TO nNextRow + nHeight, 185 FONT cFonte1 size 9 JUSTIFY WRAP
Your screenshot shows an error in _HMG_HPDF_MULTILINE_PRINT on line 504. The file I sent to you on this line has the following record:
Bez tytułu.png
and this has nothing to do with the erroneous HMG_UPPER argument.

Have you modified my h_HMG_HPDF.Prg?

Attach your sample prg.

this exactly as you sent me I did a test with your previous example and it did not work

Code: Select all

#include <hmg.ch>
#include "hfcl.ch"
#include "harupdf.ch"

Function Main

        Load Window Main
        Main.Center
        Main.Activate

Return


*******************************************************************************
function edit_pdf()
*******************************************************************************
Local cFonte1:= "Helvetica-Bold"
Local cEdit1 := "1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
Local cEdit2 := "2XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
Local cEdit3 := "3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
Local cEdit4 := "I am thinking about whether the standard function _HMG_HPDF_MULTILINE_PRINT can be forced to transfer text to the next line "+;
			"when it does not fit in the declared width, not like now - by wrapping the text, but wrapping anywhere in the word."

Local cArquivo:= "Assistencia.pdf"
local lSuccess := .f.

   SELECT HPDFDOC cArquivo TO lSuccess papersize HPDF_PAPER_A4
   SET HPDFDOC COMPRESS ALL
   SET HPDFDOC PAGEMODE TO OUTLINE
   SET HPDFINFO AUTHOR      TO 'Jair Pinho'
   SET HPDFINFO CREATOR     TO 'Jair Pinho'
   SET HPDFINFO TITLE      TO 'Assistência'
   SET HPDFINFO SUBJECT     TO 'Criado com LibHaru/HPDF Library'
   SET HPDFINFO KEYWORDS    TO 'HMG, HPDF, Documentation, LibHaru, Harbour, MiniGUI'
   SET HPDFINFO DATECREATED TO date() TIME time()
   SET HPDFDOC ENCODING TO "WinAnsiEncoding"


   if lSuccess
      
        START HPDFPAGE
            SET HPDFDOC PAGEOUTLINE TITLE "Assistencia" 
		@ 95.5, 11 HPDFPRINT "DESCRICAO EQUIPAMENTO: " FONT cFonte1 size 9 COLOR { 0, 0, 0 }

		@ 20, 15 HPDFPRINT RECTANGLE TO 40, 198 PENWIDTH 0.1
		@ 20, 15 HPDFPRINT cEdit1 TO 40, 198 FONT cFonte1 size 9 COLOR { 0, 0, 0 } RIGHT WRAP
		
		@ 150, 15 HPDFPRINT RECTANGLE TO 175, 198 PENWIDTH 0.1
		@ 150, 15 HPDFPRINT cEdit2 TO 175, 198 FONT cFonte1 size 9 COLOR { 0, 0, 0 } JUSTIFY WRAP
		
		@ 180, 15 HPDFPRINT RECTANGLE TO 200, 198 PENWIDTH 0.1
		@ 180, 15 HPDFPRINT cEdit3 TO 200, 198 FONT cFonte1 size 9 COLOR { 0, 0, 0 } JUSTIFY

		@ 205,120 HPDFPRINT "Standard 9px" FONT cFonte1 size 9
		
		@ 205, 15 HPDFPRINT RECTANGLE TO 215, 115 PENWIDTH 0.1
		@ 205, 15 HPDFPRINT cEdit4 TO 215, 115 FONT cFonte1 size 9 CENTER 
		
		@ 225,120 HPDFPRINT "Wrap 9px" FONT cFonte1 size 9
		
		@ 225, 15 HPDFPRINT RECTANGLE TO 235, 115 PENWIDTH 0.1
		@ 225, 15 HPDFPRINT cEdit4 TO 235, 115 FONT cFonte1 size 9 CENTER WRAP
		
		@ 245,120 HPDFPRINT "Standard + Font Size Fit" FONT cFonte1 size 9
		
		@ 245, 15 HPDFPRINT RECTANGLE TO 255, 115 PENWIDTH 0.1
		@ 245, 15 HPDFPRINT cEdit4 TO 255, 115 FONT cFonte1 size 9 CENTER FONTSIZEFIT
		
		@ 265,120 HPDFPRINT "Wrap + Font Size Fit" FONT cFonte1 size 9
		
		@ 265, 15 HPDFPRINT RECTANGLE TO 275, 115 PENWIDTH 0.1
		@ 265, 15 HPDFPRINT cEdit4 TO 275, 115 FONT cFonte1 size 9 CENTER WRAP FONTSIZEFIT
			          page = 1
		END HPDFPAGE

	ENDIF
      END HPDFDOC	 	
      execute file cArquivo			
			
Return Nil			
			
			
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

edk
Posts: 382
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 110 times
Been thanked: 278 times

Post by edk » Mon Dec 03, 2018 9:26 pm

I do not see a problem, your sample works fine with my last hmg_hpdf.ch and h_HMG_HPDF.Prg, which I've attached to you.
See the file Assistencia.pdf from the attachment (it has two pages)
jair.zip
(24.27 KiB) Downloaded 14 times

User avatar
jairpinho
Posts: 251
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Been thanked: 5 times
Contact:

Post by jairpinho » Mon Dec 03, 2018 11:55 pm

edk wrote:
Mon Dec 03, 2018 9:26 pm
I do not see a problem, your sample works fine with my last hmg_hpdf.ch and h_HMG_HPDF.Prg, which I've attached to you.
See the file Assistencia.pdf from the attachment (it has two pages) jair.zip
Edward, I discovered what happened, the folder and files of this project were corrupted I created a new project and it worked normal all the examples are working, I will start to implement in my system.
thanks for the great help this change and very important for the reports in pdf
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

User avatar
Anand
Posts: 319
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 64 times
Been thanked: 44 times

Post by Anand » Tue Dec 04, 2018 9:41 am

Hats Off Edward !
Great Job !!

Regards,

Anand
Image

edk
Posts: 382
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 110 times
Been thanked: 278 times

Post by edk » Tue Dec 04, 2018 10:21 am

Another version: I added support for underlining / strikethrough on a multiline print.
Unfortunately, natively, HARUPDF does not support them, that's why I made them simulations. 😉

Insert this code into the file h_HMG_HPDF.Prg replacing the function "_HMG_HPDF_MULTILINE_PRINT":

Code: Select all

#define bbox_left   1 
#define bbox_top    2
#define bbox_right  3
#define bbox_bottom 4

Function _HMG_HPDF_MULTILINE_PRINT ( nRow, nCol, nToRow, nToCol, cFontName, nFontSize, nRColor, nGColor, nBColor, cText, lBold, lItalic, lUnderline, lStrikeout, lColor, lFont, lSize, cAlign, lWrap, cFit, xVariable )
Local nWidth := _HMG_SYSDATA[ 150 ][ 4 ]
Local nHeight := _HMG_SYSDATA[ 150 ][ 5 ]
Local nTextWidth := 0
Local nxPos := _HMG_HPDF_MM2Pixel( nCol )
Local nyPos :=  nHeight - _HMG_HPDF_MM2Pixel( nRow )
Local nToxPos := nxPos + _HMG_HPDF_MM2Pixel( nToCol - nCol )
Local nToyPos := nyPos - _HMG_HPDF_MM2Pixel( nToRow - nRow )
Local oFont := Nil
Local cFont := ''
Local cTtfFnt // Pablo June, 2014
Local cTextIn, cTextOut, cLine, nLineSpacingPrev, nLineSpacing, nLineCount, nLineLen, bbox, nAreaHeight, nxLine

default cFontName := ''
//default nFontSize := 12
default nFontSize := _HMG_SYSDATA[ 150 ][ 9 ]
default nRColor := 0
default nGColor := 0
default nBColor := 0
default lBold := .f.
default lItalic := .f.
default lUnderline := .f.
default lStrikeout := .f.
default lColor := .f.
default lFont := .f.
default lSize := .f.
default cAlign := ''
default lWrap := .f.		
default cFit := ''
default xVariable := Nil
	
cTtfFnt := cFontName // Pablo June, 2014

If _HMG_SYSDATA[ 150 ][ 1 ] == Nil // PDF object not found!
   _HMG_HPDF_Error( 3 )
   Return Nil
endif
If _HMG_SYSDATA[ 150 ][ 7 ] == Nil // PDF Page object not found!
   _HMG_HPDF_Error( 5 )
   Return Nil
endif

// set color
If lColor
   HPDF_Page_SetRGBFill( _HMG_SYSDATA[ 150 ][ 7 ], nRColor/255, nGColor/255, nBColor/255 )
else
   HPDF_Page_SetRGBFill( _HMG_SYSDATA[ 150 ][ 7 ], 0.0, 0.0, 0.0 )
endIf   

// set font
//If HMG_LEN( alltrim( cFontName ) ) == 0
//   cFontName := _HMG_HPDF_SetFont( cFontName, lBold, lItalic )
//   oFont := HPDF_GetFont( _HMG_SYSDATA[ 150 ][ 1 ], cFontName, _HMG_SYSDATA[ 150 ][ 10 ] )
//else
   // cFontName := alltrim( cFontName )
   cFontName := AllTrim(_HMG_HPDF_SetFont( cFontName, lBold, lItalic ))
   
   if HMG_UPPER (cFileExt (cFontName)) == '.TTF' // load ttf font
   
      cFont := HPDF_LOADTTFONTFROMFILE( _HMG_SYSDATA[ 150 ][ 1 ], cFontName, .t. )
      If HMG_LEN( alltrim( cFont ) ) == 0
         _HMG_HPDF_Error( 6 , cFontName )
         Return Nil
      endif
      oFont := HPDF_GetFont( _HMG_SYSDATA[ 150 ][ 1 ], cFont, _HMG_SYSDATA[ 150 ][ 10 ] )
   else
      If HMG_UPPER( alltrim( cFontName ) ) == "SYMBOL" .or. HMG_UPPER( alltrim( cFontName ) ) == "ZAPFDINGBATS"
         oFont := HPDF_GetFont( _HMG_SYSDATA[ 150 ][ 1 ], cFontName, Nil )
      else   
         oFont := HPDF_GetFont( _HMG_SYSDATA[ 150 ][ 1 ], cFontName, _HMG_SYSDATA[ 150 ][ 10 ] )
      endIf   
   endif
//endIf   

If oFont == Nil
   _HMG_HPDF_Error( 6 , cFontName )
   Return Nil
else
   nLineSpacingPrev := HPDF_Page_GetTextLeading(_HMG_SYSDATA[ 150 ][ 7 ])
   nLineSpacing := nLineSpacingPrev
   bbox := HPDF_Font_GetBBox (oFont)
   IF nLineSpacing == 0		//set default Line spacing, based on: hpdfpago.c -> HPDF_Page_TextRect
	  nLineSpacing := ( bbox [bbox_top] - bbox [bbox_bottom] ) / 1000 * nFontSize
   ENDIF
   
   DO WHILE .T.	//Fitting text
      HPDF_Page_SetFontAndSize( _HMG_SYSDATA[ 150 ][ 7 ], oFont, nFontSize )
      HPDF_Page_SetTextLeading( _HMG_SYSDATA[ 150 ][ 7 ], nLineSpacing )
      
      cTextIn := cText
      cTextOut := ""
      nLineCount := 0
   
      DO WHILE !EMPTY(cTextIn)
         nLineLen := HPDF_Page_MeasureText( _HMG_SYSDATA[ 150 ][ 7 ], cTextIn, nToxPos - nxPos, !lWrap, NIL )
         IF nLineLen = 0
             EXIT
         ENDIF
         nLineCount ++
         cLine := Trim( hb_USubStr( cTextIn , 1 , nLineLen ) )
         cTextIn := hb_USubStr( cTextIn, nLineLen + 1 )
         cTextOut += cLine + IF( !EMPTY( cTextIn ) , " " /* hb_eol() */ , "")
      ENDDO
	  
      nAreaHeight := ( (nLineCount - 1) * nLineSpacing /* Lines: 1 .. Last-1. The height of each line equals the line spacing. */ ) + ;
				 ( ( bbox [bbox_top] - bbox [bbox_bottom] ) / 1000 * nFontSize /* The height of the last line equals the default line spacing for this font */ ) + .01 /* area higher than calculated (floating point and HPDF_Page_TextRect issue) */
	
	  
      IF !(HMG_UPPER( cFit ) == 'FONTSIZEFIT') /* Don't fit font size */ .OR. ;
         nAreaHeight <= nyPos - nToyPos /* Fits */ .OR. ;
         nFontSize <= 4 /* Abandon further reducing the font. */	
         EXIT
      ENDIF
         nFontSize -= 0.1			 //decrease font size
         nLineSpacing := ( bbox [bbox_top] - bbox [bbox_bottom] ) / 1000 * nFontSize  //decrease line spacing
   ENDDO
   
   cText := cTextOut
   
   IF HMG_UPPER( cFit ) == 'HEIGHTFIT'
       nToyPos := nyPos - nAreaHeight
   ENDIF
   
   xVariable := _HMG_HPDF_Pixel2MM ( nyPos - nToyPos ) + nRow  //Return the bottom row "TO nToRow" in mm as a variable by reference.
	
   HPDF_Page_BeginText( _HMG_SYSDATA[ 150 ][ 7 ] )
   do case
      case HMG_UPPER( cAlign ) == 'CENTER'
         HPDF_Page_TextRect( _HMG_SYSDATA[ 150 ][ 7 ], nxPos, nyPos, nToxPos, nToyPos, cText, HPDF_TALIGN_CENTER, Nil )
      case HMG_UPPER( cAlign ) == 'RIGHT'
         HPDF_Page_TextRect( _HMG_SYSDATA[ 150 ][ 7 ], nxPos, nyPos, nToxPos, nToyPos, cText, HPDF_TALIGN_RIGHT, Nil )
      case HMG_UPPER( cAlign ) == 'JUSTIFY'
         HPDF_Page_TextRect( _HMG_SYSDATA[ 150 ][ 7 ], nxPos, nyPos, nToxPos, nToyPos, cText, HPDF_TALIGN_JUSTIFY, Nil )
      otherwise         
         HPDF_Page_TextRect( _HMG_SYSDATA[ 150 ][ 7 ], nxPos, nyPos, nToxPos, nToyPos, cText, HPDF_TALIGN_LEFT, Nil )
   endcase         
   HPDF_Page_EndText( _HMG_SYSDATA[ 150 ][ 7 ] )
   
   //restore previous line spacing
   HPDF_Page_SetTextLeading(_HMG_SYSDATA[ 150 ][ 7 ], nLineSpacingPrev )
   
   If lDoLog // Pablo June, 2014
     HTML_TABLE_LINE(nFHandle,{{StrZero(nRow,4,0)+" ("+StrZero(nyPos,7,2)+")","#FFFFFF",.t.},;
                               {StrZero(nCol,4,0)+" ("+StrZero(nxPos,7,2)+")","#FFFFFF",.t.},;
                         {StrZero(_HMG_SYSDATA[ 150 ][ 13 ],3,0),"#FFFFFF",.t.},;
                         {PadR(If(Empty(cTtfFnt),"<Default>",cTtfFnt),If(HMG_Len(cTtfFnt)>30,HMG_Len(cTtfFnt),30)),"#FFFFFF",.f.},;
                         {StrZero(nFontSize,2,0),"#FFFFFF",.t.},;
                         {If(lBold,"BOLD" ,Space(4))+If(lItalic," ITALIC",Space(7)),"#FFFFFF",.f.},;
                         {cFontName,If(If(Empty(cTtfFnt),HMG_Len(cFontName),HMG_Len(cTtfFnt))==HMG_Len(cFontName),"#FFFFFF","#FFFF66"),.f.}})
   Endif
   
   IF lUnderline .OR. lStrikeout
   	 nyPos -= bbox [bbox_top] / 1000 * nFontSize - IF (lStrikeout, ( nFontSize / 2.5 ) , 0) 
      DO WHILE !EMPTY(cText)
         nLineLen := HPDF_Page_MeasureText( _HMG_SYSDATA[ 150 ][ 7 ], cText, nToxPos - nxPos, !lWrap, NIL )
         IF nLineLen = 0
             EXIT
         ENDIF
         cLine := Trim( hb_USubStr( cText , 1 , nLineLen ) )
         cText := hb_USubStr( cText, nLineLen + 1 )
         nLineLen := HPDF_Page_TextWidth( _HMG_SYSDATA[ 150 ][ 7 ], cLine )
         nxLine := 0
         do case
         	   case HMG_UPPER( cAlign ) == 'CENTER'
         		  nxLine := ( nToxpos - nxPos - nLineLen ) / 2
         	   case HMG_UPPER( cAlign ) == 'RIGHT'
         		  nxLine := nToxpos - nxPos - nLineLen
         	   case HMG_UPPER( cAlign ) == 'JUSTIFY'
         		  IF !EMPTY( cText )
         			nLineLen := nToxpos - nxPos
         		  ENDIF
      	endcase
         
         //simulate underline / strikeout
         _HMG_HPDF_LINE ( _HMG_HPDF_Pixel2MM( nHeight - nyPos ), ;
         					  _HMG_HPDF_Pixel2MM( nxPos + nxLine ) , ;
         					  _HMG_HPDF_Pixel2MM( nHeight - nyPos) , ;
         					  _HMG_HPDF_Pixel2MM( nxPos + nxLine + nLineLen ) , ;
         					  _HMG_HPDF_Pixel2MM( .5 ), ;
         					  nRColor, nGColor, nBColor, .T., lColor )

         nyPos -= nLineSpacing 
         
      ENDDO
  ENDIF
   
endif
Return Nil
Rebuild HMG with BuildLib32.bat

Sample of new support:

Code: Select all

#include "hmg.ch"
#include "harupdf.ch"
Function Main()

Local cFonte1:="segoeui.ttf" //"Helvetica"		

Local cEdit := "Whitnesseth that said Grantor, for and in consideration of the sum of ten dollars, and other good and valuable considerations " +;
				"to said Grantor in hand paid by said Grantee, the receipt whereof is hereby acknowledged, has remised, released and quit claimed, " +;
				"and by these presents does remise, release and quitclaim unto the Grantee all the right, title, interest, claim and demand which " +;
				"the said Grantor has in and the following described land situate, lying and being in current state."

Local nHeight, nNextRow, nBottomRow

SELECT HPDFDOC "sample.pdf" PAPERLENGTH 300 PAPERWIDTH 300 LOG
START HPDFDOC
	SET HPDFDOC ENCODING TO "WinAnsiEncoding"
		
	START HPDFPAGE

		//Adjust the text height of the area and get the bottom row using a variable by reference
		@ 20, 15 HPDFPRINT cEdit TO 25, 185 FONT cFonte1 size 9 STRIKEOUT HEIGHTFIT GETBOTTOM @nBottomRow

		nNextRow := nBottomRow + 1
		
		//Calculate the height of the text of the area with word wrapping.
		nHeight := _HMG_HPDF_GetHeight_MULTILINE_PRINT ( cEdit /* cText */ , 185 - 15 /* nLen ( nToCol - nCol ) */ , cFonte1 /* cFontName */, 9 /* nFontSize */,  /* lBold */, /* lItalic */ , .f. /* lWrap */ )		
		//Print area with calculated height.
	    @ nNextRow, 15 HPDFPRINT cEdit TO nNextRow + nHeight , 185 FONT cFonte1 size 9 COLOR BLUE JUSTIFY STRIKEOUT
		
		nNextRow += nHeight + 1
		
		//Calculate the height of the text of the area without word wrapping.
		nHeight := _HMG_HPDF_GetHeight_MULTILINE_PRINT ( cEdit /* cText */ , 185 - 15 /* nLen ( nToCol - nCol ) */ , cFonte1 /* cFontName */, 10 /* nFontSize */, .T. /* lBold */, /* lItalic */ , .F. /* lWrap */ )	
		//Print  area with calculated height.
		@ nNextRow, 15 HPDFPRINT cEdit TO nNextRow + nHeight , 185 FONT cFonte1 size 10 BOLD COLOR GREEN RIGHT UNDERLINE	
		
		nNextRow += nHeight + 1
		
		//Change line spacing to 6 px
		SET HPDFPAGE LINESPACING TO _HMG_HPDF_Pixel2MM( 9 )		
		
		//Calculate the text height of the area with the previously set line spacing.
		nHeight := _HMG_HPDF_GetHeight_MULTILINE_PRINT ( cEdit /* cText */ , 185 - 15 /* nLen ( nToCol - nCol ) */ , cFonte1 /* cFontName */, 12.5 /* nFontSize */, /* lBold */, /* lItalic */ , /* lWrap */ )
		//Print area with calculated height.
		@ nNextRow, 15 HPDFPRINT cEdit TO nNextRow + nHeight, 185 FONT cFonte1 size 12.5 COLOR RED CENTER STRIKEOUT 
		
		//Restore line spacing to defaults
		SET HPDFPAGE LINESPACING TO 0
		
		nNextRow += nHeight + 1
		
		//Adjust the text height of the area and get the bottom row using a variable by reference
		@ nNextRow, 15 HPDFPRINT "Some short text ABC Ë xyz" TO nNextRow, 185 FONT cFonte1 size 8 UNDERLINE HEIGHTFIT GETBOTTOM @nBottomRow


		nNextRow := nBottomRow + 1
		
		//Calculate the text height of the area.
		nHeight := _HMG_HPDF_GetHeight_MULTILINE_PRINT ( "Some short text ABC Ë xyz" /* cText */ , 185 - 15 /* nLen ( nToCol - nCol ) */ , cFonte1 /* cFontName */, 8 /* nFontSize */, .T. /* lBold */, /* lItalic */ , /* lWrap */ )	
		//Print area with calculated height.
		@ nNextRow, 15 HPDFPRINT "Some short text ABC Ë xyz" TO nNextRow + nHeight, 185 FONT cFonte1 size 8 BOLD RIGHT UNDERLINE
		
		nNextRow += nHeight + 1
		
		//Adjust the font size of the text to the fixed height of the area and get the bottom row using the variable by reference.
		@ nNextRow, 15 HPDFPRINT cEdit TO nNextRow + 12, 185 FONT cFonte1 size 10 UNDERLINE FONTSIZEFIT GETBOTTOM @nBottomRow  
	
		//Print the line of text in the last row.
		@ nBottomRow, 15 HPDFPRINT "Last Row := " + AllTrim(Str(nBottomRow)) + " mm" SIZE 6
		
	END HPDFPAGE
END HPDFDOC
Execute File 'sample.pdf'
Return Nil
sample.png
sample.png (159.6 KiB) Viewed 76 times
Attachments
h_HMG_HPDF.zip
(14.15 KiB) Downloaded 14 times

Post Reply