c:\harbour\contrib\hbvpdf
hbvpdf.prg |
Type | Function | Source | Line |
FUNCTION | pdfAtSay( cString, nRow, nCol, cUnits, lExact, cId )
function pdfAtSay( cString, nRow, nCol, cUnits, lExact, cId ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local _nFont, lReverse, nAt
DEFAULT nRow to aReport[ REPORTLINE ]
DEFAULT cUnits to "R"
DEFAULT lExact to .f.
DEFAULT cId to ""
IF aReport[ HEADEREDIT ]
return pdfHeader( "PDFATSAY", cId, { cString, nRow, nCol, cUnits, lExact } )
ENDIF
IF ( nAt := at( "#pagenumber#", cString ) ) > 0
cString := left( cString, nAt - 1 ) + ltrim(str( pdfPageNumber())) + substr( cString, nAt + 12 )
ENDIF
lReverse := .f.
IF cUnits == "M"
nRow := pdfM2Y( nRow )
nCol := pdfM2X( nCol )
ELSEIF cUnits == "R"
IF .not. lExact
pdfCheckLine( nRow )
nRow := nRow + aReport[ PDFTOP ]
ENDIF
nRow := pdfR2D( nRow )
nCol := pdfM2X( aReport[ PDFLEFT ] ) + ;
nCol * 100.00 / aReport[ REPORTWIDTH ] * ;
( aReport[ PAGEX ] - pdfM2X( aReport[ PDFLEFT ] ) * 2 - 9.0 ) / 100.00
ENDIF
IF !empty( cString )
cString := pdfStringB( cString )
IF right( cString, 1 ) == chr(255) //reverse
cString := left( cString, len( cString ) - 1 )
//pdfBox( nCol, nRow + aReport[ FONTSIZE ] - 2.0, nCol + pdfM2X( pdfLen( cString )) + 1, nRow + 2 * aReport[ FONTSIZE ] - 1.5,,100, "D")
pdfBox( aReport[ PAGEY ] - nRow - aReport[ FONTSIZE ] + 2.0 , nCol, aReport[ PAGEY ] - nRow + 2.0, nCol + pdfM2X( pdfLen( cString )) + 1,,100, "D")
//aReport[ PAGEBUFFER ] += " 1 g "
pdfAddBuffer( " 1 g " )
lReverse := .t.
ELSEIF right( cString, 1 ) == chr(254) //underline
cString := left( cString, len( cString ) - 1 )
//pdfBox( nCol, nRow - 1.5, nCol + pdfM2X( pdfLen( cString )) + 1, nRow - 1,,100, "D")
pdfBox( aReport[ PAGEY ] - nRow + 0.5, nCol, aReport[ PAGEY ] - nRow + 1, nCol + pdfM2X( pdfLen( cString )) + 1,,100, "D")
ENDIF
// version 0.01
IF ( nAt := at( chr(253), cString )) > 0 // some color text inside
/*
aReport[ PAGEBUFFER ] += CRLF + ;
Chr_RGB( substr( cString, nAt + 1, 1 )) + " " + ;
Chr_RGB( substr( cString, nAt + 2, 1 )) + " " + ;
Chr_RGB( substr( cString, nAt + 3, 1 )) + " rg "
*/
pdfAddBuffer( CRLF + ;
Chr_RGB( substr( cString, nAt + 1, 1 )) + " " + ;
Chr_RGB( substr( cString, nAt + 2, 1 )) + " " + ;
Chr_RGB( substr( cString, nAt + 3, 1 )) + " rg " )
cString := stuff( cString, nAt, 4, "")
ENDIF
// version 0.01
_nFont := ascan( aReport[ FONTS ], {|arr| arr[1] == aReport[ FONTNAME ]} )
IF !( aReport[ FONTNAME ] == aReport[ FONTNAMEPREV ] )
aReport[ FONTNAMEPREV ] := aReport[ FONTNAME ]
//aReport[ PAGEBUFFER ] += CRLF + "BT /Fo" + ltrim(str( _nFont )) + " " + ltrim(transform( aReport[ FONTSIZE ], "999.99")) + " Tf " + ltrim(transform( nCol, "9999.99" )) + " " + ltrim(transform( nRow, "9999.99" )) + " Td (" + cString + ") Tj ET"
pdfAddBuffer( CRLF + "BT /Fo" + ltrim(str( _nFont )) + " " + ltrim(transform( aReport[ FONTSIZE ], "999.99")) + " Tf " + ltrim(transform( nCol, "9999.99" )) + " " + ltrim(transform( nRow, "9999.99" )) + " Td (" + cString + ") Tj ET" )
ELSEIF aReport[ FONTSIZE ] != aReport[ FONTSIZEPREV ]
aReport[ FONTSIZEPREV ] := aReport[ FONTSIZE ]
//aReport[ PAGEBUFFER ] += CRLF + "BT /Fo" + ltrim(str( _nFont )) + " " + ltrim(transform( aReport[ FONTSIZE ], "999.99")) + " Tf " + ltrim(transform( nCol, "9999.99" )) + " " + ltrim(transform( nRow, "9999.99" )) + " Td (" + cString + ") Tj ET"
pdfAddBuffer( CRLF + "BT /Fo" + ltrim(str( _nFont )) + " " + ltrim(transform( aReport[ FONTSIZE ], "999.99")) + " Tf " + ltrim(transform( nCol, "9999.99" )) + " " + ltrim(transform( nRow, "9999.99" )) + " Td (" + cString + ") Tj ET" )
ELSE
//aReport[ PAGEBUFFER ] += CRLF + "BT " + ltrim(transform( nCol, "9999.99" )) + " " + ltrim(transform( nRow, "9999.99" )) + " Td (" + cString + ") Tj ET"
pdfAddBuffer( CRLF + "BT " + ltrim(transform( nCol, "9999.99" )) + " " + ltrim(transform( nRow, "9999.99" )) + " Td (" + cString + ") Tj ET" )
ENDIF
IF lReverse
//aReport[ PAGEBUFFER ] += " 0 g "
pdfAddBuffer( " 0 g " )
ENDIF
ENDIF
return nil
| hbvpdf.prg | 10 |
FUNCTION | pdfBold()
function pdfBold() /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
IF pdfGetFontInfo("NAME") = "Times"
aReport[ FONTNAME ] := 2
ELSEIF pdfGetFontInfo("NAME") = "Helvetica"
aReport[ FONTNAME ] := 6
ELSE
aReport[ FONTNAME ] := 10 // Courier // 0.04
ENDIF
aadd( aReport[ PAGEFONTS ], aReport[ FONTNAME ] )
IF ascan( aReport[ FONTS ], { |arr| arr[1] == aReport[ FONTNAME ] } ) == 0
aadd( aReport[ FONTS ], { aReport[ FONTNAME ], ++aReport[ NEXTOBJ ] } )
ENDIF
return nil
| hbvpdf.prg | 93 |
FUNCTION | pdfBoldItalic()
function pdfBoldItalic() /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
IF pdfGetFontInfo("NAME") = "Times"
aReport[ FONTNAME ] := 4
ELSEIF pdfGetFontInfo("NAME") = "Helvetica"
aReport[ FONTNAME ] := 8
ELSE
aReport[ FONTNAME ] := 12 // 0.04
ENDIF
aadd( aReport[ PAGEFONTS ], aReport[ FONTNAME ] )
IF ascan( aReport[ FONTS ], { |arr| arr[1] == aReport[ FONTNAME ] } ) == 0
aadd( aReport[ FONTS ], { aReport[ FONTNAME ], ++aReport[ NEXTOBJ ] } )
ENDIF
return nil
| hbvpdf.prg | 109 |
FUNCTION | pdfBookAdd( cTitle, nLevel, nPage, nLine )
function pdfBookAdd( cTitle, nLevel, nPage, nLine ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
aadd( aReport[ BOOKMARK ], { nLevel, alltrim( cTitle ), 0, 0, 0, 0, 0, 0, nPage, IIF( nLevel == 1, aReport[ PAGEY ], aReport[ PAGEY ] - nLine * 72 / aReport[ LPI ] ) })
return Nil
| hbvpdf.prg | 125 |
FUNCTION | pdfBookClose( )
function pdfBookClose( ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
aReport[ BOOKMARK ] := nil
return Nil
| hbvpdf.prg | 131 |
STATIC FUNCTION | pdfBookCount( nRecno, nCurLevel )
static function pdfBookCount( nRecno, nCurLevel ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local nTempLevel := 0, nCount := 0, nLen := len( aReport[ BOOKMARK ] )
++nRecno
while nRecno <= nLen
nTempLevel := aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
IF nTempLevel <= nCurLevel
exit
ELSE
IF nCurLevel + 1 == nTempLevel
++nCount
ENDIF
ENDIF
++nRecno
enddo
return -1 * nCount
| hbvpdf.prg | 137 |
STATIC FUNCTION | pdfBookFirst( nRecno, nCurLevel, nObj )
static function pdfBookFirst( nRecno, nCurLevel, nObj ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local nFirst := 0, nLen := len( aReport[ BOOKMARK ] )
++nRecno
IF nRecno <= nLen
IF nCurLevel + 1 == aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
nFirst := nRecno
ENDIF
ENDIF
return IIF( nFirst == 0, nFirst, nObj + nFirst )
| hbvpdf.prg | 155 |
STATIC FUNCTION | pdfBookLast( nRecno, nCurLevel, nObj )
static function pdfBookLast( nRecno, nCurLevel, nObj ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local nLast := 0, nLen := len( aReport[ BOOKMARK ] )
++nRecno
IF nRecno <= nLen
IF nCurLevel + 1 == aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
while nRecno <= nLen .and. nCurLevel + 1 <= aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
IF nCurLevel + 1 == aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
nLast := nRecno
ENDIF
++nRecno
enddo
ENDIF
ENDIF
return IIF( nLast == 0, nLast, nObj + nLast )
| hbvpdf.prg | 167 |
STATIC FUNCTION | pdfBookNext( nRecno, nCurLevel, nObj )
static function pdfBookNext( nRecno, nCurLevel, nObj ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local nTempLevel := 0, nNext := 0, nLen := len( aReport[ BOOKMARK ] )
++nRecno
while nRecno <= nLen
nTempLevel := aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
IF nCurLevel > nTempLevel
exit
ELSEIF nCurLevel == nTempLevel
nNext := nRecno
exit
ELSE
// keep going
ENDIF
++nRecno
enddo
return IIF( nNext == 0, nNext, nObj + nNext )
| hbvpdf.prg | 184 |
FUNCTION | pdfBookOpen( )
function pdfBookOpen( ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
aReport[ BOOKMARK ] := {}
return Nil
| hbvpdf.prg | 203 |
STATIC FUNCTION | pdfBookParent( nRecno, nCurLevel, nObj )
static function pdfBookParent( nRecno, nCurLevel, nObj ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local nTempLevel := 0
local nParent := 0
--nRecno
while nRecno > 0
nTempLevel := aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
IF nTempLevel < nCurLevel
nParent := nRecno
exit
ENDIF
--nRecno
enddo
return IIF( nParent == 0, nObj - 1, nObj + nParent )
| hbvpdf.prg | 209 |
STATIC FUNCTION | pdfBookPrev( nRecno, nCurLevel, nObj )
static function pdfBookPrev( nRecno, nCurLevel, nObj ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local nTempLevel := 0
local nPrev := 0
--nRecno
while nRecno > 0
nTempLevel := aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
IF nCurLevel > nTempLevel
exit
ELSEIF nCurLevel == nTempLevel
nPrev := nRecno
exit
ELSE
// keep going
ENDIF
--nRecno
enddo
return IIF( nPrev == 0, nPrev, nObj + nPrev )
| hbvpdf.prg | 225 |
FUNCTION | pdfBox( x1, y1, x2, y2, nBorder, nShade, cUnits, cColor, cId )
function pdfBox( x1, y1, x2, y2, nBorder, nShade, cUnits, cColor, cId ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local cBoxColor
DEFAULT nBorder to 0
DEFAULT nShade to 0
DEFAULT cUnits to "M"
DEFAULT cColor to ""
// version 0.02
cBoxColor := ""
IF !empty( cColor )
cBoxColor := " " + Chr_RGB( substr( cColor, 2, 1 )) + " " + ;
Chr_RGB( substr( cColor, 3, 1 )) + " " + ;
Chr_RGB( substr( cColor, 4, 1 )) + " rg "
IF empty( alltrim( cBoxColor ) )
cBoxColor := ""
ENDIF
ENDIF
// version 0.02
IF aReport[ HEADEREDIT ]
return pdfHeader( "PDFBOX", cId, { x1, y1, x2, y2, nBorder, nShade, cUnits } )
ENDIF
IF cUnits == "M"
y1 += 0.5
y2 += 0.5
IF nShade > 0
// version 0.02
//aReport[ PAGEBUFFER ] += CRLF + transform( 1.00 - nShade / 100.00, "9.99") + " g " + cBoxColor + ltrim(str(pdfM2X( y1 ))) + " " + ltrim(str(pdfM2Y( x1 ))) + " " + ltrim(str(pdfM2X( y2 - y1 ))) + " -" + ltrim(str(pdfM2X( x2 - x1 ))) + " re f 0 g"
pdfAddBuffer( CRLF + transform( 1.00 - nShade / 100.00, "9.99") + " g " + cBoxColor + ltrim(str(pdfM2X( y1 ))) + " " + ltrim(str(pdfM2Y( x1 ))) + " " + ltrim(str(pdfM2X( y2 - y1 ))) + " -" + ltrim(str(pdfM2X( x2 - x1 ))) + " re f 0 g" )
ENDIF
IF nBorder > 0
/*
aReport[ PAGEBUFFER ] += CRLF + "0 g " + ltrim(str(pdfM2X( y1 ))) + " " + ltrim(str(pdfM2Y( x1 ))) + " " + ltrim(str(pdfM2X( y2 - y1 ))) + " -" + ltrim(str(pdfM2X( nBorder ))) + " re f"
aReport[ PAGEBUFFER ] += CRLF + "0 g " + ltrim(str(pdfM2X( y2 - nBorder ))) + " " + ltrim(str(pdfM2Y( x1 ))) + " " + ltrim(str(pdfM2X( nBorder ))) + " -" + ltrim(str(pdfM2X( x2 - x1 ))) + " re f"
aReport[ PAGEBUFFER ] += CRLF + "0 g " + ltrim(str(pdfM2X( y1 ))) + " " + ltrim(str(pdfM2Y( x2 - nBorder ))) + " " + ltrim(str(pdfM2X( y2 - y1 ))) + " -" + ltrim(str(pdfM2X( nBorder ))) + " re f"
aReport[ PAGEBUFFER ] += CRLF + "0 g " + ltrim(str(pdfM2X( y1 ))) + " " + ltrim(str(pdfM2Y( x1 ))) + " " + ltrim(str(pdfM2X( nBorder ))) + " -" + ltrim(str(pdfM2X( x2 - x1 ))) + " re f"
*/
pdfAddBuffer( CRLF + "0 g " + ltrim(str(pdfM2X( y1 ))) + " " + ltrim(str(pdfM2Y( x1 ))) + " " + ltrim(str(pdfM2X( y2 - y1 ))) + " -" + ltrim(str(pdfM2X( nBorder ))) + " re f" )
pdfAddBuffer( CRLF + "0 g " + ltrim(str(pdfM2X( y2 - nBorder ))) + " " + ltrim(str(pdfM2Y( x1 ))) + " " + ltrim(str(pdfM2X( nBorder ))) + " -" + ltrim(str(pdfM2X( x2 - x1 ))) + " re f" )
pdfAddBuffer( CRLF + "0 g " + ltrim(str(pdfM2X( y1 ))) + " " + ltrim(str(pdfM2Y( x2 - nBorder ))) + " " + ltrim(str(pdfM2X( y2 - y1 ))) + " -" + ltrim(str(pdfM2X( nBorder ))) + " re f" )
pdfAddBuffer( CRLF + "0 g " + ltrim(str(pdfM2X( y1 ))) + " " + ltrim(str(pdfM2Y( x1 ))) + " " + ltrim(str(pdfM2X( nBorder ))) + " -" + ltrim(str(pdfM2X( x2 - x1 ))) + " re f" )
ENDIF
ELSEIF cUnits == "D"// "Dots"
//x1, y1, x2, y2 - nTop, nLeft, nBottom, nRight
IF nShade > 0
// version 0.02
//aReport[ PAGEBUFFER ] += CRLF + transform( 1.00 - nShade / 100.00, "9.99") + " g " + cBoxColor + ltrim(str( y1 )) + " " + ltrim(str( aReport[ PAGEY ] - x1 )) + " " + ltrim(str( y2 - y1 )) + " -" + ltrim(str( x2 - x1 )) + " re f 0 g"
pdfAddBuffer( CRLF + transform( 1.00 - nShade / 100.00, "9.99") + " g " + cBoxColor + ltrim(str( y1 )) + " " + ltrim(str( aReport[ PAGEY ] - x1 )) + " " + ltrim(str( y2 - y1 )) + " -" + ltrim(str( x2 - x1 )) + " re f 0 g" )
ENDIF
IF nBorder > 0
/*
1
ÚÄÄÄÄÄ¿
4 ³ ³ 2
ÀÄÄÄÄÄÙ
3
*/
/*
aReport[ PAGEBUFFER ] += CRLF + "0 g " + ltrim(str( y1 )) + " " + ltrim(str( aReport[ PAGEY ] - x1 )) + " " + ltrim(str( y2 - y1 )) + " -" + ltrim(str( nBorder )) + " re f"
aReport[ PAGEBUFFER ] += CRLF + "0 g " + ltrim(str( y2 - nBorder )) + " " + ltrim(str( aReport[ PAGEY ] - x1 )) + " " + ltrim(str( nBorder )) + " -" + ltrim(str( x2 - x1 )) + " re f"
aReport[ PAGEBUFFER ] += CRLF + "0 g " + ltrim(str( y1 )) + " " + ltrim(str( aReport[ PAGEY ] - x2 + nBorder )) + " " + ltrim(str( y2 - y1 )) + " -" + ltrim(str( nBorder )) + " re f"
aReport[ PAGEBUFFER ] += CRLF + "0 g " + ltrim(str( y1 )) + " " + ltrim(str( aReport[ PAGEY ] - x1 )) + " " + ltrim(str( nBorder )) + " -" + ltrim(str( x2 - x1 )) + " re f"
*/
pdfAddBuffer( CRLF + "0 g " + ltrim(str( y1 )) + " " + ltrim(str( aReport[ PAGEY ] - x1 )) + " " + ltrim(str( y2 - y1 )) + " -" + ltrim(str( nBorder )) + " re f" )
pdfAddBuffer( CRLF + "0 g " + ltrim(str( y2 - nBorder )) + " " + ltrim(str( aReport[ PAGEY ] - x1 )) + " " + ltrim(str( nBorder )) + " -" + ltrim(str( x2 - x1 )) + " re f" )
pdfAddBuffer( CRLF + "0 g " + ltrim(str( y1 )) + " " + ltrim(str( aReport[ PAGEY ] - x2 + nBorder )) + " " + ltrim(str( y2 - y1 )) + " -" + ltrim(str( nBorder )) + " re f" )
pdfAddBuffer( CRLF + "0 g " + ltrim(str( y1 )) + " " + ltrim(str( aReport[ PAGEY ] - x1 )) + " " + ltrim(str( nBorder )) + " -" + ltrim(str( x2 - x1 )) + " re f" )
ENDIF
ENDIF
return nil
| hbvpdf.prg | 245 |
FUNCTION | pdfBox1( nTop, nLeft, nBottom, nRight, nBorderWidth, cBorderColor, cBoxColor )
function pdfBox1( nTop, nLeft, nBottom, nRight, nBorderWidth, cBorderColor, cBoxColor ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
DEFAULT nBorderWidth to 0.5
DEFAULT cBorderColor to chr(0) + chr(0) + chr(0)
DEFAULT cBoxColor to chr(255) + chr(255) + chr(255)
/*
aReport[ PAGEBUFFER ] += CRLF + ;
Chr_RGB( substr( cBorderColor, 1, 1 )) + " " + ;
Chr_RGB( substr( cBorderColor, 2, 1 )) + " " + ;
Chr_RGB( substr( cBorderColor, 3, 1 )) + ;
" RG" + ;
CRLF + ;
Chr_RGB( substr( cBoxColor, 1, 1 )) + " " + ;
Chr_RGB( substr( cBoxColor, 2, 1 )) + " " + ;
Chr_RGB( substr( cBoxColor, 3, 1 )) + ;
" rg" + ;
CRLF + ltrim(str( nBorderWidth )) + " w" + ;
CRLF + ltrim( str ( nLeft + nBorderWidth / 2 )) + " " + ;
CRLF + ltrim( str ( aReport[ PAGEY ] - nBottom + nBorderWidth / 2)) + " " + ;
CRLF + ltrim( str ( nRight - nLeft - nBorderWidth )) + ;
CRLF + ltrim( str ( nBottom - nTop - nBorderWidth )) + " " + ;
" re" + ;
CRLF + "B"
*/
pdfAddBuffer( CRLF + ;
Chr_RGB( substr( cBorderColor, 1, 1 )) + " " + ;
Chr_RGB( substr( cBorderColor, 2, 1 )) + " " + ;
Chr_RGB( substr( cBorderColor, 3, 1 )) + ;
" RG" + ;
CRLF + ;
Chr_RGB( substr( cBoxColor, 1, 1 )) + " " + ;
Chr_RGB( substr( cBoxColor, 2, 1 )) + " " + ;
Chr_RGB( substr( cBoxColor, 3, 1 )) + ;
" rg" + ;
CRLF + ltrim(str( nBorderWidth )) + " w" + ;
CRLF + ltrim( str ( nLeft + nBorderWidth / 2 )) + " " + ;
CRLF + ltrim( str ( aReport[ PAGEY ] - nBottom + nBorderWidth / 2)) + " " + ;
CRLF + ltrim( str ( nRight - nLeft - nBorderWidth )) + ;
CRLF + ltrim( str ( nBottom - nTop - nBorderWidth )) + " " + ;
" re" + ;
CRLF + "B" )
return nil
| hbvpdf.prg | 323 |
FUNCTION | pdfCenter( cString, nRow, nCol, cUnits, lExact, cId )
function pdfCenter( cString, nRow, nCol, cUnits, lExact, cId ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local nLen, nAt
DEFAULT nRow to aReport[ REPORTLINE ]
DEFAULT cUnits to "R"
DEFAULT lExact to .f.
DEFAULT nCol to IIF( cUnits == "R", aReport[ REPORTWIDTH ] / 2, aReport[ PAGEX ] / 72 * 25.4 / 2 )
IF aReport[ HEADEREDIT ]
return pdfHeader( "PDFCENTER", cId, { cString, nRow, nCol, cUnits, lExact } )
ENDIF
IF ( nAt := at( "#pagenumber#", cString ) ) > 0
cString := left( cString, nAt - 1 ) + ltrim(str( pdfPageNumber())) + substr( cString, nAt + 12 )
ENDIF
nLen := pdfLen( cString ) / 2
IF cUnits == "R"
IF .not. lExact
pdfCheckLine( nRow )
nRow := nRow + aReport[ PDFTOP ]
ENDIF
ENDIF
pdfAtSay( cString, pdfR2M( nRow ), IIF( cUnits == "R", aReport[ PDFLEFT ] + ( aReport[ PAGEX ] / 72 * 25.4 - 2 * aReport[ PDFLEFT ] ) * nCol / aReport[ REPORTWIDTH ], nCol ) - nLen, "M", lExact )
return nil
| hbvpdf.prg | 368 |
STATIC FUNCTION | pdfCheckLine( nRow )
static function pdfCheckLine( nRow ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
IF nRow + aReport[ PDFTOP ] > aReport[ PDFBOTTOM ]
pdfNewPage()
nRow := aReport[ REPORTLINE ]
ENDIF
aReport[ REPORTLINE ] := nRow
return nil
| hbvpdf.prg | 395 |
FUNCTION | pdfClose()
function pdfClose() /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local nI, cTemp, nCurLevel, nObj1, nLast, nCount, nFirst, nRecno, nBooklen
FIELD FIRST, PREV, NEXT, LAST, COUNT, PARENT, PAGE, COORD, TITLE, LEVEL
pdfClosePage()
// kids
aReport[ REFS ][ 2 ] := aReport[ DOCLEN ]
cTemp := ;
"1 0 obj"+CRLF+;
"<<"+CRLF+;
"/Type /Pages /Count " + ltrim(str(aReport[ REPORTPAGE ])) + CRLF +;
"/Kids ["
for nI := 1 to aReport[ REPORTPAGE ]
cTemp += " " + ltrim(str( aReport[ PAGES ][ nI ] )) + " 0 R"
next
cTemp += " ]" + CRLF + ;
">>" + CRLF + ;
"endobj" + CRLF
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
// info
++aReport[ REPORTOBJ ]
aadd( aReport[ REFS ], aReport[ DOCLEN ] )
cTemp := ltrim(str( aReport[ REPORTOBJ ] )) + " 0 obj" + CRLF + ;
"<<" + CRLF + ;
"/Producer ()" + CRLF + ;
"/Title ()" + CRLF + ;
"/Author ()" + CRLF + ;
"/Creator ()" + CRLF + ;
"/Subject ()" + CRLF + ;
"/Keywords ()" + CRLF + ;
"/CreationDate (D:" + str(year(date()), 4) + padl( month(date()), 2, "0") + padl( day(date()), 2, "0") + substr( time(), 1, 2 ) + substr( time(), 4, 2 ) + substr( time(), 7, 2 ) + ")" + CRLF + ;
">>" + CRLF + ;
"endobj" + CRLF
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
// root
++aReport[ REPORTOBJ ]
aadd( aReport[ REFS ], aReport[ DOCLEN ] )
cTemp := ltrim(str( aReport[ REPORTOBJ ] )) + " 0 obj" + CRLF + ;
"<< /Type /Catalog /Pages 1 0 R /Outlines " + ltrim(str( aReport[ REPORTOBJ ] + 1 )) + " 0 R" + IIF( ( nBookLen := len( aReport[ BOOKMARK ] )) > 0, " /PageMode /UseOutlines", "") + " >>" + CRLF + "endobj" + CRLF
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
++aReport[ REPORTOBJ ]
nObj1 := aReport[ REPORTOBJ ]
IF nBookLen > 0
nRecno := 1
nFirst := aReport[ REPORTOBJ ] + 1
nLast := 0
nCount := 0
while nRecno <= nBookLen
nCurLevel := aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
aReport[ BOOKMARK ][ nRecno ][ BOOKPARENT ] := pdfBookParent( nRecno, nCurLevel, aReport[ REPORTOBJ ] )
aReport[ BOOKMARK ][ nRecno ][ BOOKPREV ] := pdfBookPrev( nRecno, nCurLevel, aReport[ REPORTOBJ ] )
aReport[ BOOKMARK ][ nRecno ][ BOOKNEXT ] := pdfBookNext( nRecno, nCurLevel, aReport[ REPORTOBJ ] )
aReport[ BOOKMARK ][ nRecno ][ BOOKFIRST ] := pdfBookFirst( nRecno, nCurLevel, aReport[ REPORTOBJ ] )
aReport[ BOOKMARK ][ nRecno ][ BOOKLAST ] := pdfBookLast( nRecno, nCurLevel, aReport[ REPORTOBJ ] )
aReport[ BOOKMARK ][ nRecno ][ BOOKCOUNT ] := pdfBookCount( nRecno, nCurLevel )
IF nCurLevel == 1
nLast := nRecno
++nCount
ENDIF
++nRecno
enddo
nLast += aReport[ REPORTOBJ ]
cTemp := ltrim(str( aReport[ REPORTOBJ ] )) + " 0 obj" + CRLF + "<< /Type /Outlines /Count " + ltrim(str( nCount )) + " /First " + ltrim(str( nFirst )) + " 0 R /Last " + ltrim(str( nLast )) + " 0 R >>" + CRLF + "endobj" //+ CRLF
aadd( aReport[ REFS ], aReport[ DOCLEN ] )
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
++aReport[ REPORTOBJ ]
nRecno := 1
FOR nI := 1 to nBookLen
//cTemp := IIF ( nI > 1, CRLF, "") + ltrim(str( aReport[ REPORTOBJ ] + nI - 1)) + " 0 obj" + CRLF + ;
cTemp := CRLF + ltrim(str( aReport[ REPORTOBJ ] + nI - 1)) + " 0 obj" + CRLF + ;
"<<" + CRLF + ;
"/Parent " + ltrim(str( aReport[ BOOKMARK ][ nRecno ][ BOOKPARENT ])) + " 0 R" + CRLF + ;
"/Dest [" + ltrim(str( aReport[ PAGES ][ aReport[ BOOKMARK ][ nRecno ][ BOOKPAGE ] ] )) + " 0 R /XYZ 0 " + ltrim( str( aReport[ BOOKMARK ][ nRecno ][ BOOKCOORD ])) + " 0]" + CRLF + ;
"/Title (" + alltrim( aReport[ BOOKMARK ][ nRecno ][ BOOKTITLE ]) + ")" + CRLF + ;
IIF( aReport[ BOOKMARK ][ nRecno ][ BOOKPREV ] > 0, "/Prev " + ltrim(str( aReport[ BOOKMARK ][ nRecno ][ BOOKPREV ])) + " 0 R" + CRLF, "") + ;
IIF( aReport[ BOOKMARK ][ nRecno ][ BOOKNEXT ] > 0, "/Next " + ltrim(str( aReport[ BOOKMARK ][ nRecno ][ BOOKNEXT ])) + " 0 R" + CRLF, "") + ;
IIF( aReport[ BOOKMARK ][ nRecno ][ BOOKFIRST ] > 0, "/First " + ltrim(str( aReport[ BOOKMARK ][ nRecno ][ BOOKFIRST ])) + " 0 R" + CRLF, "") + ;
IIF( aReport[ BOOKMARK ][ nRecno ][ BOOKLAST ] > 0, "/Last " + ltrim(str( aReport[ BOOKMARK ][ nRecno ][ BOOKLAST ])) + " 0 R" + CRLF, "") + ;
IIF( aReport[ BOOKMARK ][ nRecno ][ BOOKCOUNT ] != 0, "/Count " + ltrim(str( aReport[ BOOKMARK ][ nRecno ][ BOOKCOUNT ])) + CRLF, "") + ;
">>" + CRLF + "endobj" + CRLF
// "/Dest [" + ltrim(str( aReport[ BOOKMARK ][ nRecno ][ BOOKPAGE ] * 3 )) + " 0 R /XYZ 0 " + ltrim( str( aReport[ BOOKMARK ][ nRecno ][ BOOKCOORD ])) + " 0]" + CRLF + ;
// "/Dest [" + ltrim(str( aReport[ PAGES ][ nRecno ] )) + " 0 R /XYZ 0 " + ltrim( str( aReport[ BOOKMARK ][ nRecno ][ BOOKCOORD ])) + " 0]" + CRLF + ;
aadd( aReport[ REFS ], aReport[ DOCLEN ] + 2 )
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
++nRecno
NEXT
pdfBookClose()
aReport[ REPORTOBJ ] += nBookLen - 1
ELSE
cTemp := ltrim(str( aReport[ REPORTOBJ ] )) + " 0 obj" + CRLF + "<< /Type /Outlines /Count 0 >>" + CRLF + "endobj" + CRLF
aadd( aReport[ REFS ], aReport[ DOCLEN ] )
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
ENDIF
cTemp := CRLF
aReport[ DOCLEN ] += len( cTemp )
++aReport[ REPORTOBJ ]
cTemp += "xref" + CRLF + ;
"0 " + ltrim(str( aReport[ REPORTOBJ ] )) + CRLF +;
padl( aReport[ REFS ][ 1 ], 10, "0") + " 65535 f" + CRLF
for nI := 2 to len( aReport[ REFS ] )
cTemp += padl( aReport[ REFS ][ nI ], 10, "0") + " 00000 n" + CRLF
next
cTemp += "trailer << /Size " + ltrim(str( aReport[ REPORTOBJ ] )) + " /Root " + ltrim(str( nObj1 - 1 )) + " 0 R /Info " + ltrim(str( nObj1 - 2 )) + " 0 R >>" + CRLF + ;
"startxref" + CRLF + ;
ltrim(str( aReport[ DOCLEN ] )) + CRLF + ;
"%%EOF" + CRLF
fwrite( aReport[ HANDLE ], cTemp )
/*
IF aReport[ OPTIMIZE ]
pdfOptimize( ) coming !
ENDIF
*/
fclose( aReport[ HANDLE ] )
aReport := nil
return nil
| hbvpdf.prg | 405 |
STATIC FUNCTION | pdfClosePage()
static function pdfClosePage() /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local cTemp, cBuffer, nBuffer, nRead, nI, k, nImage, nFont, nImageHandle
local cImage, nTemp1, nLength
aadd( aReport[ REFS ], aReport[ DOCLEN ] )
aadd( aReport[ PAGES ], aReport[ REPORTOBJ ] + 1 )
cTemp := ;
ltrim(str( ++aReport[ REPORTOBJ ] )) + " 0 obj" + CRLF + ;
"<<" + CRLF + ;
"/Type /Page /Parent 1 0 R" + CRLF + ;
"/Resources " + ltrim(str( ++aReport[ REPORTOBJ ] )) + " 0 R" + CRLF + ;
"/MediaBox [ 0 0 " + ltrim(transform( aReport[ PAGEX ], "9999.99")) + " " + ;
ltrim(transform(aReport[ PAGEY ], "9999.99")) + " ]" + CRLF + ;
"/Contents " + ltrim(str( ++aReport[ REPORTOBJ ] )) + " 0 R" + CRLF + ;
">>" + CRLF + ;
"endobj" + CRLF
// "/Contents [ " + ltrim(str( ++aReport[ REPORTOBJ ] )) + " 0 R ]" + CRLF + ;
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
aadd( aReport[ REFS ], aReport[ DOCLEN ] )
cTemp := ;
ltrim(str(aReport[ REPORTOBJ ] - 1)) + " 0 obj" + CRLF + ;
"<<"+CRLF+;
"/ColorSpace << /DeviceRGB /DeviceGray >>" + CRLF + ; //version 0.01
"/ProcSet [ /PDF /Text /ImageB /ImageC ]"
IF len( aReport[ PAGEFONTS ] ) > 0
cTemp += CRLF + ;
"/Font" + CRLF + ;
"<<"
for nI := 1 to len( aReport[ PAGEFONTS ] )
nFont := ascan( aReport[ FONTS ], { |arr| arr[1] == aReport[ PAGEFONTS ][ nI ] } )
//IF nFont == 0
// alert("New font after!!!")
//ENDIF
cTemp += CRLF + "/Fo" + ltrim(str( nFont )) + " " + ltrim(str( aReport[ FONTS ][ nFont ][ 2 ])) + " 0 R"
next
cTemp += CRLF + ">>"
ENDIF
IF len( aReport[ PAGEIMAGES ] ) > 0
cTemp += CRLF + "/XObject" + CRLF + "<<"
for nI := 1 to len( aReport[ PAGEIMAGES ] )
nImage := ascan( aReport[ IMAGES ], { |arr| arr[1] == aReport[ PAGEIMAGES ][ nI ][ 1 ] } )
IF nImage == 0
aadd( aReport[ IMAGES ], { aReport[ PAGEIMAGES ][ nI ][ 1 ], ++aReport[ NEXTOBJ ], pdfImageInfo( aReport[ PAGEIMAGES ][ nI ][ 1 ] ) } )
nImage := len( aReport[ IMAGES ] )
ENDIF
cTemp += CRLF + "/Image" + ltrim(str( nImage )) + " " + ltrim(str( aReport[ IMAGES ][ nImage ][ 2 ])) + " 0 R"
next
cTemp += CRLF + ">>"
ENDIF
cTemp += CRLF + ">>" + CRLF + "endobj" + CRLF
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
aadd( aReport[ REFS ], aReport[ DOCLEN ] )
cTemp := ltrim(str( aReport[ REPORTOBJ ] )) + " 0 obj << /Length " + ;
ltrim(str( aReport[ REPORTOBJ ] + 1 )) + " 0 R >>" + CRLF +;
"stream"
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
/*
IF len( aReport[ PAGEIMAGES ] ) > 0
cTemp := ""
for nI := 1 to len( aReport[ PAGEIMAGES ] )
cTemp += CRLF + "q"
nImage := ascan( aReport[ IMAGES ], { |arr| arr[1] == aReport[ PAGEIMAGES ][ nI ][ 1 ] } )
cTemp += CRLF + ltrim(str( IIF( aReport[ PAGEIMAGES ][ nI ][ 5 ] == 0, pdfM2X( aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_WIDTH ] / aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_XRES ] * 25.4 ), aReport[ PAGEIMAGES ][ nI ][ 5 ]))) + ;
" 0 0 " + ;
ltrim(str( IIF( aReport[ PAGEIMAGES ][ nI ][ 4 ] == 0, pdfM2X( aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_HEIGHT ] / aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_YRES ] * 25.4 ), aReport[ PAGEIMAGES ][ nI ][ 4 ]))) + ;
" " + ltrim(str( aReport[ PAGEIMAGES ][ nI ][ 3 ] )) + ;
" " + ltrim(str( aReport[ PAGEY ] - aReport[ PAGEIMAGES ][ nI ][ 2 ] - ;
IIF( aReport[ PAGEIMAGES ][ nI ][ 4 ] == 0, pdfM2X( aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_HEIGHT ] / aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_YRES ] * 25.4 ), aReport[ PAGEIMAGES ][ nI ][ 4 ]))) + " cm"
cTemp += CRLF + "/Image" + ltrim(str( nImage )) + " Do"
cTemp += CRLF + "Q"
next
aReport[ PAGEBUFFER ] := cTemp + aReport[ PAGEBUFFER ]
ENDIF
cTemp := aReport[ PAGEBUFFER ]
cTemp += CRLF + "endstream" + CRLF + ;
"endobj" + CRLF
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
aadd( aReport[ REFS ], aReport[ DOCLEN ] )
cTemp := ltrim(str( ++aReport[ REPORTOBJ ] )) + " 0 obj" + CRLF + ;
ltrim(str(len( aReport[ PAGEBUFFER ] ))) + CRLF + ;
"endobj" + CRLF
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
*/
cImage := ""
IF len( aReport[ PAGEIMAGES ] ) > 0
for nI := 1 to len( aReport[ PAGEIMAGES ] )
cTemp := ""
cTemp += CRLF + "q"
nImage := ascan( aReport[ IMAGES ], { |arr| arr[1] == aReport[ PAGEIMAGES ][ nI ][ 1 ] } )
cTemp += CRLF + ltrim(str( IIF( aReport[ PAGEIMAGES ][ nI ][ 5 ] == 0, pdfM2X( aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_WIDTH ] / aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_XRES ] * 25.4 ), aReport[ PAGEIMAGES ][ nI ][ 5 ]))) + ;
" 0 0 " + ;
ltrim(str( IIF( aReport[ PAGEIMAGES ][ nI ][ 4 ] == 0, pdfM2X( aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_HEIGHT ] / aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_YRES ] * 25.4 ), aReport[ PAGEIMAGES ][ nI ][ 4 ]))) + ;
" " + ltrim(str( aReport[ PAGEIMAGES ][ nI ][ 3 ] )) + ;
" " + ltrim(str( aReport[ PAGEY ] - aReport[ PAGEIMAGES ][ nI ][ 2 ] - ;
IIF( aReport[ PAGEIMAGES ][ nI ][ 4 ] == 0, pdfM2X( aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_HEIGHT ] / aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_YRES ] * 25.4 ), aReport[ PAGEIMAGES ][ nI ][ 4 ]))) + " cm"
cTemp += CRLF + "/Image" + ltrim(str( nImage )) + " Do"
cTemp += CRLF + "Q"
cImage += cTemp
next
//aReport[ PAGEBUFFER ] := cTemp + aReport[ PAGEBUFFER ]
ENDIF
//cTemp := aReport[ PAGEBUFFER ]
//cTemp += CRLF + "endstream" + CRLF + ;
//"endobj" + CRLF
nTemp1 := len( cImage ) + IIF( aReport[ BUFFERHANDLE ] > 0, FileSize( aReport[ BUFFERHANDLE ] ), len( aReport[ PAGEBUFFER ] ))
pdfAddBuffer( CRLF + "endstream" + CRLF + "endobj" + CRLF )
aReport[ DOCLEN ] += len( cImage ) + IIF( aReport[ BUFFERHANDLE ] > 0, FileSize( aReport[ BUFFERHANDLE ] ), len( aReport[ PAGEBUFFER ] ))
fwrite( aReport[ HANDLE ], cImage )
IF aReport[ BUFFERHANDLE ] > 0
nLength := FILESIZE( aReport[ BUFFERHANDLE ] )
FSEEK( aReport[ BUFFERHANDLE ], 0 )
nBuffer := 8192
cBuffer := space( nBuffer )
k := 0
while k < nLength
IF k + nBuffer <= nLength
nRead := nBuffer
ELSE
nRead := nLength - k
ENDIF
fread( aReport[ BUFFERHANDLE ], @cBuffer, nRead )
fwrite( aReport[ HANDLE ], cBuffer, nRead )
k += nRead
enddo
fclose( aReport[ BUFFERHANDLE ] )
aReport[ BUFFERHANDLE ] := 0
ELSE
fwrite( aReport[ HANDLE ], aReport[ PAGEBUFFER ] )
ENDIF
aadd( aReport[ REFS ], aReport[ DOCLEN ] )
/*
cTemp := ltrim(str( ++aReport[ REPORTOBJ ] )) + " 0 obj" + CRLF + ;
ltrim(str(len( aReport[ PAGEBUFFER ] ))) + CRLF + ;
"endobj" + CRLF
*/
cTemp := ltrim(str( ++aReport[ REPORTOBJ ] )) + " 0 obj" + CRLF + ;
ltrim(str( nTemp1 )) + CRLF + ;
"endobj" + CRLF
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
for nI := 1 to len( aReport[ FONTS ] )
IF aReport[ FONTS ][ nI ][ 2 ] > aReport[ REPORTOBJ ]
aadd( aReport[ REFS ], aReport[ DOCLEN ] )
cTemp := ;
ltrim(str( aReport[ FONTS ][ nI ][ 2 ] )) + " 0 obj" + CRLF + ;
"<<" + CRLF + ;
"/Type /Font" + CRLF + ;
"/Subtype /Type1" + CRLF + ;
"/Name /Fo" + ltrim(str( nI )) + CRLF + ;
"/BaseFont /" + aReport[ TYPE1 ][ aReport[ FONTS ][ nI ][ 1 ] ] + CRLF + ;
"/Encoding /WinAnsiEncoding" + CRLF + ;
">>" + CRLF + ;
"endobj" + CRLF
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
ENDIF
next
for nI := 1 to len( aReport[ IMAGES ] )
IF aReport[ IMAGES ][ nI ][ 2 ] > aReport[ REPORTOBJ ]
aadd( aReport[ REFS ], aReport[ DOCLEN ] )
// "/Filter /CCITTFaxDecode" for B&W only ?
cTemp := ;
ltrim(str( aReport[ IMAGES ][ nI ][ 2 ] )) + " 0 obj" + CRLF + ;
"<<" + CRLF + ;
"/Type /XObject" + CRLF + ;
"/Subtype /Image" + CRLF + ;
"/Name /Image" + ltrim(str(nI)) + CRLF + ;
"/Filter [" + IIF( at( ".JPG", upper( aReport[ IMAGES ][ nI ][ 1 ]) ) > 0, " /DCTDecode", "" ) + " ]" + CRLF + ;
"/Width " + ltrim(str( aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_WIDTH ] )) + CRLF + ;
"/Height " + ltrim(str( aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_HEIGHT ] )) + CRLF + ;
"/BitsPerComponent " + ltrim(str( aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_BITS ] )) + CRLF + ;
"/ColorSpace /" + IIF( aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_SPACE ] == 1, "DeviceGray", "DeviceRGB") + CRLF + ;
"/Length " + ltrim(str( aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_LENGTH ])) + CRLF + ;
">>" + CRLF + ;
"stream" + CRLF
// "/ColorSpace /" + IIF( aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_BITS ] == 1, "DeviceGray", "DeviceRGB") + CRLF + ;
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
nImageHandle := fopen( aReport[ IMAGES ][ nI ][ 1 ] )
fseek( nImageHandle, aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_FROM ] )
nBuffer := 8192
cBuffer := space( nBuffer )
k := 0
while k < aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_LENGTH ]
IF k + nBuffer <= aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_LENGTH ]
nRead := nBuffer
ELSE
nRead := aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_LENGTH ] - k
ENDIF
fread( nImageHandle, @cBuffer, nRead )
aReport[ DOCLEN ] += nRead
fwrite( aReport[ HANDLE ], cBuffer, nRead )
k += nRead
enddo
fclose( nImageHandle )
cTemp := CRLF + "endstream" + CRLF + ;
"endobj" + CRLF
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
ENDIF
next
aReport[ REPORTOBJ ] := aReport[ NEXTOBJ ]
aReport[ NEXTOBJ ] := aReport[ REPORTOBJ ] + 4
aReport[ PAGEBUFFER ] := ""
return nil
| hbvpdf.prg | 550 |
STATIC FUNCTION | pdfGetFontInfo( cParam )
static function pdfGetFontInfo( cParam ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local cRet
IF cParam == "NAME"
IF left( aReport[ TYPE1 ][ aReport[ FONTNAME ] ], 5 ) == "Times"
cRet := "Times"
ELSEIF left( aReport[ TYPE1 ][ aReport[ FONTNAME ] ], 9 ) == "Helvetica"
cRet := "Helvetica"
ELSE
cRet := "Courier" // 0.04
ENDIF
ELSE // size
cRet := int(( aReport[ FONTNAME ] - 1 ) % 4)
ENDIF
return cRet
| hbvpdf.prg | 813 |
FUNCTION | pdfImage( cFile, nRow, nCol, cUnits, nHeight, nWidth, cId )
function pdfImage( cFile, nRow, nCol, cUnits, nHeight, nWidth, cId ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
DEFAULT nRow to aReport[ REPORTLINE ]
DEFAULT nCol to 0
DEFAULT nHeight to 0
DEFAULT nWidth to 0
DEFAULT cUnits to "R"
DEFAULT cId to ""
IF aReport[ HEADEREDIT ]
return pdfHeader( "PDFIMAGE", cId, { cFile, nRow, nCol, cUnits, nHeight, nWidth } )
ENDIF
IF cUnits == "M"
nRow := aReport[ PAGEY ] - pdfM2Y( nRow )
nCol := pdfM2X( nCol )
nHeight := aReport[ PAGEY ] - pdfM2Y( nHeight )
nWidth := pdfM2X( nWidth )
ELSEIF cUnits == "R"
//IF .not. lExact
// pdfCheckLine( nRow )
// nRow := nRow + aReportStyle[ PDFTOP ]
//ENDIF
nRow := aReport[ PAGEY ] - pdfR2D( nRow )
nCol := pdfM2X( aReport[ PDFLEFT ] ) + ;
nCol * 100.00 / aReport[ REPORTWIDTH ] * ;
( aReport[ PAGEX ] - pdfM2X( aReport[ PDFLEFT ] ) * 2 - 9.0 ) / 100.00
nHeight := aReport[ PAGEY ] - pdfR2D( nHeight )
nWidth := pdfM2X( aReport[ PDFLEFT ] ) + ;
nWidth * 100.00 / aReport[ REPORTWIDTH ] * ;
( aReport[ PAGEX ] - pdfM2X( aReport[ PDFLEFT ] ) * 2 - 9.0 ) / 100.00
ELSEIF cUnits == "D"
ENDIF
aadd( aReport[ PAGEIMAGES ], { cFile, nRow, nCol, nHeight, nWidth } )
return nil
| hbvpdf.prg | 830 |
FUNCTION | pdfItalic()
function pdfItalic() /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
IF pdfGetFontInfo("NAME") = "Times"
aReport[ FONTNAME ] := 3
ELSEIF pdfGetFontInfo("NAME") = "Helvetica"
aReport[ FONTNAME ] := 7
ELSE
aReport[ FONTNAME ] := 11 // 0.04
ENDIF
aadd( aReport[ PAGEFONTS ], aReport[ FONTNAME ] )
IF ascan( aReport[ FONTS ], { |arr| arr[1] == aReport[ FONTNAME ] } ) == 0
aadd( aReport[ FONTS ], { aReport[ FONTNAME ], ++aReport[ NEXTOBJ ] } )
ENDIF
return nil
| hbvpdf.prg | 870 |
FUNCTION | pdfLen( cString )
function pdfLen( cString ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local nWidth := 0.00, nI, nLen, nArr, nAdd := ( aReport[ FONTNAME ] - 1 ) % 4
nLen := len( cString )
IF right( cString, 1 ) == chr(255) .or. right( cString, 1 ) == chr(254 )// reverse or underline
--nLen
ENDIF
IF pdfGetFontInfo("NAME") = "Times"
nArr := 1
ELSEIF pdfGetFontInfo("NAME") = "Helvetica"
nArr := 2
ELSE
nArr := 3 // 0.04
ENDIF
For nI:= 1 To nLen
nWidth += aReport[ FONTWIDTH ][ nArr ][ ( asc( substr( cString, nI, 1 )) - 32 ) * 4 + 1 + nAdd ] * 25.4 * aReport[ FONTSIZE ] / 720.00 / 100.00
Next
return nWidth
| hbvpdf.prg | 886 |
STATIC FUNCTION | pdfM2R( mm )
static function pdfM2R( mm ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
return int( aReport[ LPI ] * mm / 25.4 )
| hbvpdf.prg | 907 |
STATIC FUNCTION | pdfM2X( n )
static function pdfM2X( n ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
return n * 72 / 25.4
| hbvpdf.prg | 912 |
STATIC FUNCTION | pdfM2Y( n )
static function pdfM2Y( n ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
return aReport[ PAGEY ] - n * 72 / 25.4
| hbvpdf.prg | 917 |
FUNCTION | pdfNewLine( n )
function pdfNewLine( n ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
DEFAULT n to 1
IF aReport[ REPORTLINE ] + n + aReport[ PDFTOP ] > aReport[ PDFBOTTOM ]
pdfNewPage()
aReport[ REPORTLINE ] += 1
ELSE
aReport[ REPORTLINE ] += n
ENDIF
return aReport[ REPORTLINE ]
| hbvpdf.prg | 922 |
FUNCTION | pdfNewPage( _cPageSize, _cPageOrient, _nLpi, _cFontName, _nFontType, _nFontSize )
function pdfNewPage( _cPageSize, _cPageOrient, _nLpi, _cFontName, _nFontType, _nFontSize )/*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ*/
local nAdd := 76.2
DEFAULT _cPageSize to aReport[ PAGESIZE ]
DEFAULT _cPageOrient to aReport[ PAGEORIENT ]
DEFAULT _nLpi to aReport[ LPI ]
DEFAULT _cFontName to pdfGetFontInfo("NAME")
DEFAULT _nFontType to pdfGetFontInfo("TYPE")
DEFAULT _nFontSize to aReport[ FONTSIZE ]
IF !empty(aReport[ PAGEBUFFER ])
pdfClosePage()
ENDIF
aReport[ PAGEFONTS ] := {}
aReport[ PAGEIMAGES ] := {}
++aReport[ REPORTPAGE ] // NEW !!!
pdfPageSize( _cPageSize )
pdfPageOrient( _cPageOrient )
pdfSetLPI( _nLpi )
pdfSetFont( _cFontName, _nFontType, _nFontSize )
pdfDrawHeader()
aReport[ REPORTLINE ] := 0//5
aReport[ FONTNAMEPREV ] := 0
aReport[ FONTSIZEPREV ] := 0
// version 0.07
aReport[ PDFBOTTOM ] := aReport[ PAGEY ] / 72 * aReport[ LPI ] - 1 // bottom, default "LETTER", "P", 6
return nil
| hbvpdf.prg | 934 |
FUNCTION | pdfNormal()
function pdfNormal() /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
IF pdfGetFontInfo("NAME") = "Times"
aReport[ FONTNAME ] := 1
ELSEIF pdfGetFontInfo("NAME") = "Helvetica"
aReport[ FONTNAME ] := 5
ELSE
aReport[ FONTNAME ] := 9 // 0.04
ENDIF
aadd( aReport[ PAGEFONTS ], aReport[ FONTNAME ] )
IF ascan( aReport[ FONTS ], { |arr| arr[1] == aReport[ FONTNAME ] } ) == 0
aadd( aReport[ FONTS ], { aReport[ FONTNAME ], ++aReport[ NEXTOBJ ] } )
ENDIF
return nil
| hbvpdf.prg | 970 |
FUNCTION | pdfOpen( cFile, nLen, lOptimize )
function pdfOpen( cFile, nLen, lOptimize ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local cTemp, nI, nJ, n1, n2 := 896, n12
DEFAULT nLen to 200
DEFAULT lOptimize to .f.
aReport[ FONTNAME ] := 1
aReport[ FONTSIZE ] := 10
aReport[ LPI ] := 6
aReport[ PAGESIZE ] := "LETTER"
aReport[ PAGEORIENT ] := "P"
aReport[ PAGEX ] := 8.5 * 72
aReport[ PAGEY ] := 11.0 * 72
aReport[ REPORTWIDTH ] := nLen // 200 // should be as parameter
aReport[ REPORTPAGE ] := 0
aReport[ REPORTLINE ] := 0 //5
aReport[ FONTNAMEPREV ] := 0
aReport[ FONTSIZEPREV ] := 0
aReport[ PAGEBUFFER ] := ""
aReport[ REPORTOBJ ] := 1 //2
aReport[ DOCLEN ] := 0
aReport[ TYPE1 ] := { "Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItalic", "Helvetica", "Helvetica-Bold", "Helvetica-Oblique", "Helvetica-BoldOblique", "Courier", "Courier-Bold", "Courier-Oblique", "Courier-BoldOblique" } // 0.04
aReport[ MARGINS ] := .t.
aReport[ HEADEREDIT ] := .f.
aReport[ NEXTOBJ ] := 0
aReport[ PDFTOP ] := 1 // top
aReport[ PDFLEFT ] := 10 // left & right
aReport[ PDFBOTTOM ] := aReport[ PAGEY ] / 72 * aReport[ LPI ] - 1 // bottom, default "LETTER", "P", 6
aReport[ HANDLE ] := fcreate( cFile )
aReport[ PAGES ] := {}
aReport[ REFS ] := { 0, 0 }
aReport[ BOOKMARK ] := {}
aReport[ HEADER ] := {}
aReport[ FONTS ] := {}
aReport[ IMAGES ] := {}
aReport[ PAGEIMAGES ] := {}
aReport[ PAGEFONTS ] := {}
// TOFIX: This external file dependency should be removed.
cTemp := vpdf_FontsDat() // times, times-bold, times-italic, times-bolditalic, helvetica..., courier... // 0.04
n1 := len( cTemp ) / ( 2 * n2 )
aReport[ FONTWIDTH ] := array( n1, n2 )
aReport[ OPTIMIZE ] := lOptimize
aReport[ BUFFERHANDLE ] := 0
aReport[ NEXTOBJ ] := aReport[ REPORTOBJ ] + 4
n12 := 2 * n2 // 0.04
for nI := 1 to n1
for nJ := 1 to n2
aReport[ FONTWIDTH ][ nI ][ nJ ] := bin2i(substr( cTemp, ( nI - 1 ) * n12 + ( nJ - 1 ) * 2 + 1, 2 ))
next
next
/*
aReportStyle := { ;
{ 2.475, 4.0, 4.9, 6.4, 7.5, 3 , 64.0 , "P6", 60, 10 }, ;
{ 3.3 , 5.4, 6.5, 8.6, 10.0, 6 , 85.35, "P8", 78, 10 }, ;
{ 2.475, 4.0, 4.9, 6.4, 7.5, 2.9, 48.9 , "L6", 45, 10 }, ;
{ 3.3 , 5.4, 6.5, 8.6, 10.0, 5.85, 65.2 , "L8", 58, 10 }, ;
{ 2.475, 4.0, 4.9, 6.4, 7.5, 2.9, 82.0 , "P6", 78, 10 }, ;
{ 3.3 , 5.4, 6.5, 8.6, 10.0, 6 , 109.35 , "P8", 102, 10 } ;
}
*/
aReport[ DOCLEN ] := 0
cTemp := "%PDF-1.3" + CRLF
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
//pdfNewPage( "LETTER", "P", 6 )
return nil
| hbvpdf.prg | 986 |
FUNCTION | pdfPageSize( _cPageSize )
function pdfPageSize( _cPageSize ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local nSize, aSize := { { "LETTER", 8.50, 11.00 }, ;
{ "LEGAL" , 8.50, 14.00 }, ;
{ "LEDGER", 11.00, 17.00 }, ;
{ "EXECUTIVE", 7.25, 10.50 }, ;
{ "A4", 8.27, 11.69 }, ;
{ "A3", 11.69, 16.54 }, ;
{ "JIS B4", 10.12, 14.33 }, ;
{ "JIS B5", 7.16, 10.12 }, ;
{ "JPOST", 3.94, 5.83 }, ;
{ "JPOSTD", 5.83, 7.87 }, ;
{ "COM10", 4.12, 9.50 }, ;
{ "MONARCH", 3.87, 7.50 }, ;
{ "C5", 6.38, 9.01 }, ;
{ "DL", 4.33, 8.66 }, ;
{ "B5", 6.93, 9.84 } }
DEFAULT _cPageSize to "LETTER"
nSize := ascan( aSize, { |arr| arr[ 1 ] = _cPageSize } )
IF nSize == 0 //.or. nSize > 2 //0.05
nSize := 1
ENDIF
aReport[ PAGESIZE ] := aSize[ nSize ][ 1 ]
IF aReport[ PAGEORIENT ] = "P"
aReport[ PAGEX ] := aSize[ nSize ][ 2 ] * 72
aReport[ PAGEY ] := aSize[ nSize ][ 3 ] * 72
ELSE
aReport[ PAGEX ] := aSize[ nSize ][ 3 ] * 72
aReport[ PAGEY ] := aSize[ nSize ][ 2 ] * 72
ENDIF
// version 0.07
aReport[ PDFBOTTOM ] := aReport[ PAGEY ] / 72 * aReport[ LPI ] - 1 // bottom, default "LETTER", "P", 6
return nil
| hbvpdf.prg | 1064 |
FUNCTION | pdfPageOrient( _cPageOrient )
function pdfPageOrient( _cPageOrient ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
DEFAULT _cPageOrient to "P"
aReport[ PAGEORIENT ] := _cPageOrient
pdfPageSize( aReport[ PAGESIZE ] )
return nil
| hbvpdf.prg | 1105 |
STATIC FUNCTION | pdfR2D( nRow )
static function pdfR2D( nRow ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
return aReport[ PAGEY ] - nRow * 72 / aReport[ LPI ]
| hbvpdf.prg | 1114 |
STATIC FUNCTION | pdfR2M( nRow )
static function pdfR2M( nRow ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
return 25.4 * nRow / aReport[ LPI ]
| hbvpdf.prg | 1119 |
FUNCTION | pdfPageNumber( n )
function pdfPageNumber( n ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
DEFAULT n to 0
IF n > 0
aReport[ REPORTPAGE ] := n // NEW !!!
ENDIF
return aReport[ REPORTPAGE ]
| hbvpdf.prg | 1124 |
FUNCTION | pdfReverse( cString )
function pdfReverse( cString ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
return cString + chr(255)
| hbvpdf.prg | 1133 |
FUNCTION | pdfRJust( cString, nRow, nCol, cUnits, lExact, cId )
function pdfRJust( cString, nRow, nCol, cUnits, lExact, cId ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local nLen, nAdj := 1.0, nAt
DEFAULT nRow to aReport[ REPORTLINE ]
DEFAULT cUnits to "R"
DEFAULT lExact to .f.
IF aReport[ HEADEREDIT ]
return pdfHeader( "PDFRJUST", cId, { cString, nRow, nCol, cUnits, lExact } )
ENDIF
IF ( nAt := at( "#pagenumber#", cString ) ) > 0
cString := left( cString, nAt - 1 ) + ltrim(str( pdfPageNumber())) + substr( cString, nAt + 12 )
ENDIF
nLen := pdfLen( cString )
IF cUnits == "R"
IF .not. lExact
pdfCheckLine( nRow )
nRow := nRow + aReport[ PDFTOP ]
ENDIF
ENDIF
pdfAtSay( cString, pdfR2M( nRow ), IIF( cUnits == "R", aReport[ PDFLEFT ] + ( aReport[ PAGEX ] / 72 * 25.4 - 2 * aReport[ PDFLEFT ] ) * nCol / aReport[ REPORTWIDTH ] - nAdj, nCol ) - nLen, "M", lExact )
return nil
| hbvpdf.prg | 1138 |
FUNCTION | pdfSetFont( _cFont, _nType, _nSize, cId )
function pdfSetFont( _cFont, _nType, _nSize, cId ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
DEFAULT _cFont to "Times"
DEFAULT _nType to 0
DEFAULT _nSize to 10
IF aReport[ HEADEREDIT ]
return pdfHeader( "PDFSETFONT", cId, { _cFont, _nType, _nSize } )
ENDIF
_cFont := upper( _cFont )
aReport[ FONTSIZE ] := _nSize
IF _cFont == "TIMES"
aReport[ FONTNAME ] := _nType + 1
ELSEIF _cFont == "HELVETICA"
aReport[ FONTNAME ] := _nType + 5
ELSE
aReport[ FONTNAME ] := _nType + 9 // 0.04
ENDIF
aadd( aReport[ PAGEFONTS ], aReport[ FONTNAME ] )
IF ascan( aReport[ FONTS ], { |arr| arr[1] == aReport[ FONTNAME ] } ) == 0
aadd( aReport[ FONTS ], { aReport[ FONTNAME ], ++aReport[ NEXTOBJ ] } )
ENDIF
return nil
| hbvpdf.prg | 1165 |
FUNCTION | pdfSetLPI(_nLpi)
function pdfSetLPI(_nLpi) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local cLpi := alltrim(str(_nLpi))
DEFAULT _nLpi to 6
cLpi := iif(cLpi$"1;2;3;4;6;8;12;16;24;48",cLpi,"6")
aReport[ LPI ] := val( cLpi )
pdfPageSize( aReport[ PAGESIZE ] )
return nil
| hbvpdf.prg | 1195 |
FUNCTION | pdfStringB( cString )
function pdfStringB( cString ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
cString := strtran( cString, "(", "\(" )
cString := strtran( cString, ")", "\)" )
return cString
| hbvpdf.prg | 1207 |
FUNCTION | pdfTextCount( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits )
function pdfTextCount( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits )/*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ*/
return pdfText( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits, .f. )
| hbvpdf.prg | 1214 |
FUNCTION | pdfText( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits, cColor, lPrint )
function pdfText( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits, cColor, lPrint )/*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ*/
local cDelim := chr(0)+chr(9)+chr(10)+chr(13)+chr(26)+chr(32)+chr(138)+chr(141)
local nI, cTemp, cToken, k, nL, nRow, nLines, nLineLen, nStart
local lParagraph, nSpace, nNew, nTokenLen, nCRLF, nTokens, nLen
DEFAULT nTab to -1
DEFAULT cUnits to 'R'
DEFAULT nJustify to 4 // justify
DEFAULT lPrint to .t.
DEFAULT cColor to ""
IF cUnits == "M"
nTop := pdfM2R( nTop )
ELSEIF cUnits == "R"
nLeft := pdfX2M( pdfM2X( aReport[ PDFLEFT ] ) + ;
nLeft * 100.00 / aReport[ REPORTWIDTH ] * ;
( aReport[ PAGEX ] - pdfM2X( aReport[ PDFLEFT ] ) * 2 - 9.0 ) / 100.00 )
ENDIF
aReport[ REPORTLINE ] := nTop - 1
nSpace := pdfLen( " " )
nLines := 0
nCRLF := 0
nNew := nTab
cString := alltrim( cString )
nTokens := numtoken( cString, cDelim )
nTokenLen := 0.00
nStart := 1
IF nJustify == 1 .or. nJustify == 4
nLeft := nLeft
ELSEIF nJustify == 2
nLeft := nLeft - nLength / 2
ELSEIF nJustify == 3
nLeft := nLeft - nLength
ENDIF
nL := nLeft
nL += nNew * nSpace // first always paragraph
nLineLen := nSpace * nNew - nSpace
lParagraph := .t.
nI := 1
while nI <= nTokens
cToken := token( cString, cDelim, nI )
nTokenLen := pdfLen( cToken )
nLen := len( cToken )
IF nLineLen + nSpace + nTokenLen > nLength
IF nStart == nI // single word > nLength
k := 1
while k <= nLen
cTemp := ""
nLineLen := 0.00
nL := nLeft
IF lParagraph
nLineLen += nSpace * nNew
IF nJustify != 2
nL += nSpace * nNew
ENDIF
lParagraph := .f.
ENDIF
IF nJustify == 2
nL := nLeft + ( nLength - pdfLen( cTemp ) ) / 2
ELSEIF nJustify == 3
nL := nLeft + nLength - pdfLen( cTemp )
ENDIF
while k <= nLen .and. ( ( nLineLen += pdfLen( substr( cToken, k, 1 ))) <= nLength )
nLineLen += pdfLen( substr( cToken, k, 1 ))
cTemp += substr( cToken, k, 1 )
++k
enddo
IF empty( cTemp ) // single character > nlength
cTemp := substr( cToken, k, 1 )
++k
ENDIF
++nLines
IF lPrint
nRow := pdfNewLine( 1 )
// version 0.02
pdfAtSay( cColor + cTemp, pdfR2M( nRow + aReport[ PDFTOP ] ), nL, "M" )
ENDIF
enddo
++nI
nStart := nI
ELSE
pdfTextPrint( nI - 1, nLeft, @lParagraph, nJustify, nSpace, nNew, nLength, @nLineLen, @nLines, @nStart, cString, cDelim, cColor, lPrint )
ENDIF
/*
nFinish := nI - 1
nL := nLeft
IF lParagraph
IF nJustify != 2
nL += nSpace * nNew
ENDIF
ENDIF
IF nJustify == 3 // right
nL += nLength - nLineLen
ELSEIF nJustify == 2 // center
nL += ( nLength - nLineLen ) / 2
ENDIF
++nLines
IF lPrint
nRow := pdfNewLine( 1 )
ENDIF
nB := nSpace
IF nJustify == 4
nB := ( nLength - nLineLen + ( nFinish - nStart ) * nSpace ) / ( nFinish - nStart )
ENDIF
for nJ := nStart to nFinish
cToken := token( cString, cDelim, nJ )
IF lPrint
pdfAtSay( cToken, pdfR2M( nRow + aReportStyle[ aReport[ REPORTSTYLE ] ][ 6 ] ), nL, "M" )
ENDIF
nL += pdfLen ( cToken ) + nB
next
nStart := nFinish + 1
ENDIF
lParagraph := .f.
nLineLen := 0.00
nLineLen += nSpace * nNew
*/
ELSEIF ( nI == nTokens ) .or. ( nI < nTokens .and. ( nCRLF := pdfTextNextPara( cString, cDelim, nI ) ) > 0 )
IF nI == nTokens
nLineLen += nSpace + nTokenLen
ENDIF
pdfTextPrint( nI, nLeft, @lParagraph, nJustify, nSpace, nNew, nLength, @nLineLen, @nLines, @nStart, cString, cDelim, cColor, lPrint )
/*
nFinish := nI
nL := nLeft
IF lParagraph
IF nJustify != 2
nL += nSpace * nNew
ENDIF
ENDIF
IF nJustify == 3 // right
nL += nLength - nLineLen
ELSEIF nJustify == 2 // center
nL += ( nLength - nLineLen ) / 2
ENDIF
++nLines
IF lPrint
nRow := pdfNewLine( 1 )
ENDIF
nB := nSpace
IF nJustify == 4
nB := ( nLength - nLineLen + ( nFinish - nStart ) * nSpace ) / ( nFinish - 1 - nStart )
ENDIF
for nJ := nStart to nFinish
cToken := token( cString, cDelim, nJ )
IF lPrint
pdfAtSay( cToken, pdfR2M( nRow + aReportStyle[ aReport[ REPORTSTYLE ] ][ 6 ] ), nL, "M" )
ENDIF
nL += pdfLen ( cToken ) + nB
next
nStart := nFinish + 1
lParagraph := .f.
nLineLen := 0.00
nLineLen += nSpace * nNew
*/
++nI
IF nCRLF > 1
nLines += nCRLF - 1
ENDIF
IF lPrint
nRow := pdfNewLine( nCRLF - 1 )
ENDIF
ELSE
nLineLen += nSpace + nTokenLen
++nI
ENDIF
enddo
return nLines
| hbvpdf.prg | 1219 |
STATIC FUNCTION | pdfTextPrint( nI, nLeft, lParagraph, nJustify, nSpace, nNew, nLength, nLineLen, nLines, nStart, cString, cDelim, cColor, lPrint )
static function pdfTextPrint( nI, nLeft, lParagraph, nJustify, nSpace, nNew, nLength, nLineLen, nLines, nStart, cString, cDelim, cColor, lPrint )/*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ*/
local nFinish, nL, nB, nJ, cToken, nRow
nFinish := nI
nL := nLeft
IF lParagraph
IF nJustify != 2
nL += nSpace * nNew
ENDIF
ENDIF
IF nJustify == 3 // right
nL += nLength - nLineLen
ELSEIF nJustify == 2 // center
nL += ( nLength - nLineLen ) / 2
ENDIF
++nLines
IF lPrint
nRow := pdfNewLine( 1 )
ENDIF
nB := nSpace
IF nJustify == 4
nB := ( nLength - nLineLen + ( nFinish - nStart ) * nSpace ) / ( nFinish - nStart )
ENDIF
for nJ := nStart to nFinish
cToken := token( cString, cDelim, nJ )
IF lPrint
// version 0.02
pdfAtSay( cColor + cToken, pdfR2M( nRow + aReport[ PDFTOP ] ), nL, "M" )
ENDIF
nL += pdfLen ( cToken ) + nB
next
nStart := nFinish + 1
lParagraph := .f.
nLineLen := 0.00
nLineLen += nSpace * nNew
return nil
| hbvpdf.prg | 1411 |
STATIC FUNCTION | pdfTextNextPara( cString, cDelim, nI )
static function pdfTextNextPara( cString, cDelim, nI ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local nAt, cAt, nCRLF, nNew, nRat, nRet := 0
// check if next spaces paragraph(s)
nAt := attoken( cString, cDelim, nI ) + len( token( cString, cDelim, nI ) )
cAt := substr( cString, nAt, attoken( cString, cDelim, nI + 1 ) - nAt )
nCRLF := numat( chr(13) + chr(10), cAt )
nRat := rat( chr(13) + chr(10), cAt )
nNew := len( cAt ) - nRat - IIF( nRat > 0, 1, 0 )
IF nCRLF > 1 .or. ( nCRLF == 1 .and. nNew > 0 )
nRet := nCRLF
ENDIF
return nRet
| hbvpdf.prg | 1457 |
FUNCTION | pdfUnderLine( cString )
function pdfUnderLine( cString ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
return cString + chr(254)
| hbvpdf.prg | 1472 |
STATIC FUNCTION | pdfX2M( n )
static function pdfX2M( n ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
return n * 25.4 / 72
| hbvpdf.prg | 1477 |
STATIC FUNCTION | TimeAsAMPM( cTime )
static function TimeAsAMPM( cTime ) /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
IF VAL(cTime) < 12
cTime += " am"
ELSEIF VAL(cTime) == 12
cTime += " pm"
ELSE
cTime := STR(VAL(cTime) - 12, 2) + SUBSTR(cTime, 3) + " pm"
ENDIF
cTime := left( cTime, 5 ) + substr( cTime, 10 )
return cTime
| hbvpdf.prg | 1482 |
FUNCTION | pdfOpenHeader( cFile )
function pdfOpenHeader( cFile )
local nErrorCode := 0, nAt
DEFAULT cFile to ""
IF !empty( cFile )
cFile := alltrim( cFile )
IF len( cFile ) > 12 .or. ;
at( ' ', cFile ) > 0 .or. ;
( at( ' ', cFile ) == 0 .and. len( cFile ) > 8 ) .or. ;
( ( nAt := at( '.', cFile )) > 0 .and. len( substr( cFile, nAt + 1 )) > 3 )
SWPRUNCMD( "copy " + cFile + " temp.tmp > nul", 0, "", "")
cFile := "temp.tmp"
ENDIF
//aReport[ HEADER ] := FT_RestArr( cFile, @nErrorCode )
aReport[ HEADER ] := File2Array( cFile )
ELSE
aReport[ HEADER ] := {}
ENDIF
aReport[ MARGINS ] := .t.
return nil
| hbvpdf.prg | 1494 |
FUNCTION | pdfEditOnHeader()
function pdfEditOnHeader()
aReport[ HEADEREDIT ] := .t.
aReport[ MARGINS ] := .t.
return nil
| hbvpdf.prg | 1514 |
FUNCTION | pdfEditOffHeader()
function pdfEditOffHeader()
aReport[ HEADEREDIT ] := .f.
aReport[ MARGINS ] := .t.
return nil
| hbvpdf.prg | 1519 |
FUNCTION | pdfCloseHeader()
function pdfCloseHeader()
aReport[ HEADER ] := {}
aReport[ MARGINS ] := .f.
return nil
| hbvpdf.prg | 1524 |
FUNCTION | pdfDeleteHeader( cId )
function pdfDeleteHeader( cId )
local nRet := -1, nId
cId := upper( cId )
nId := ascan( aReport[ HEADER ], {| arr | arr[ 3 ] == cId })
IF nId > 0
nRet := len( aReport[ HEADER ] ) - 1
aDel( aReport[ HEADER ], nId )
aSize( aReport[ HEADER ], nRet )
aReport[ MARGINS ] := .t.
ENDIF
return nRet
| hbvpdf.prg | 1529 |
FUNCTION | pdfEnableHeader( cId )
function pdfEnableHeader( cId )
local nId
cId := upper( cId )
nId := ascan( aReport[ HEADER ], {| arr | arr[ 3 ] == cId })
IF nId > 0
aReport[ HEADER ][ nId ][ 1 ] := .t.
aReport[ MARGINS ] := .t.
ENDIF
return nil
| hbvpdf.prg | 1541 |
FUNCTION | pdfDisableHeader( cId )
function pdfDisableHeader( cId )
local nId
cId := upper( cId )
nId := ascan( aReport[ HEADER ], {| arr | arr[ 3 ] == cId })
IF nId > 0
aReport[ HEADER ][ nId ][ 1 ] := .f.
aReport[ MARGINS ] := .t.
ENDIF
return nil
| hbvpdf.prg | 1551 |
FUNCTION | pdfSaveHeader( cFile )
function pdfSaveHeader( cFile )
local nErrorCode := 0
//FT_SaveArr( aReport[ HEADER ], 'temp.tmp', @nErrorCode )
Array2File( 'temp.tmp', aReport[ HEADER ] )
SWPRUNCMD( "copy temp.tmp " + cFile + " > nul", 0, "", "")
return nil
| hbvpdf.prg | 1561 |
FUNCTION | pdfHeader( cFunction, cId, arr )
function pdfHeader( cFunction, cId, arr )
local nId, nI, nLen, nIdLen
nId := 0
IF !empty( cId )
cId := upper( cId )
nId := ascan( aReport[ HEADER ], {| arr | arr[ 3 ] == cId })
ENDIF
IF nId == 0
nLen := len( aReport[ HEADER ] )
IF empty( cId )
cId := cFunction
nIdLen := len( cId )
for nI := 1 to nLen
IF aReport[ HEADER ][ nI ][ 2 ] == cId
IF val( substr( aReport[ HEADER ][ nI ][ 3 ], nIdLen + 1 ) ) > nId
nId := val( substr( aReport[ HEADER ][ nI ][ 3 ], nIdLen + 1 ) )
ENDIF
ENDIF
next
++nId
cId += ltrim(str(nId))
ENDIF
aadd( aReport[ HEADER ], { .t., cFunction, cId } )
++nLen
for nI := 1 to len( arr )
aadd( aReport[ HEADER ][ nLen ], arr[ nI ] )
next
ELSE
aSize( aReport[ HEADER ][ nId ], 3 )
for nI := 1 to len( arr )
aadd( aReport[ HEADER ][ nId ], arr[ nI ] )
next
ENDIF
return cId
| hbvpdf.prg | 1568 |
FUNCTION | pdfDrawHeader()
function pdfDrawHeader()
local nI, _nFont, _nSize, nLen := len( aReport[ HEADER ] )
IF nLen > 0
// save font
_nFont := aReport[ FONTNAME ]
_nSize := aReport[ FONTSIZE ]
for nI := 1 to nLen
IF aReport[ HEADER ][ nI ][ 1 ] // enabled
do case
case aReport[ HEADER ][ nI ][ 2 ] == "PDFATSAY"
pdfAtSay( aReport[ HEADER ][ nI ][ 4 ], aReport[ HEADER ][ nI ][ 5 ], aReport[ HEADER ][ nI ][ 6 ], aReport[ HEADER ][ nI ][ 7 ], aReport[ HEADER ][ nI ][ 8 ], aReport[ HEADER ][ nI ][ 3 ] )
case aReport[ HEADER ][ nI ][ 2 ] == "PDFCENTER"
pdfCenter( aReport[ HEADER ][ nI ][ 4 ], aReport[ HEADER ][ nI ][ 5 ], aReport[ HEADER ][ nI ][ 6 ], aReport[ HEADER ][ nI ][ 7 ], aReport[ HEADER ][ nI ][ 8 ], aReport[ HEADER ][ nI ][ 3 ] )
case aReport[ HEADER ][ nI ][ 2 ] == "PDFRJUST"
pdfRJust( aReport[ HEADER ][ nI ][ 4 ], aReport[ HEADER ][ nI ][ 5 ], aReport[ HEADER ][ nI ][ 6 ], aReport[ HEADER ][ nI ][ 7 ], aReport[ HEADER ][ nI ][ 8 ], aReport[ HEADER ][ nI ][ 3 ] )
case aReport[ HEADER ][ nI ][ 2 ] == "PDFBOX"
pdfBox( aReport[ HEADER ][ nI ][ 4 ], aReport[ HEADER ][ nI ][ 5 ], aReport[ HEADER ][ nI ][ 6 ], aReport[ HEADER ][ nI ][ 7 ], aReport[ HEADER ][ nI ][ 8 ], aReport[ HEADER ][ nI ][ 9 ], aReport[ HEADER ][ nI ][ 10 ], aReport[ HEADER ][ nI ][ 3 ] )
case aReport[ HEADER ][ nI ][ 2 ] == "PDFSETFONT"
pdfSetFont( aReport[ HEADER ][ nI ][ 4 ], aReport[ HEADER ][ nI ][ 5 ], aReport[ HEADER ][ nI ][ 6 ], aReport[ HEADER ][ nI ][ 3 ] )
case aReport[ HEADER ][ nI ][ 2 ] == "PDFIMAGE"
pdfImage( aReport[ HEADER ][ nI ][ 4 ], aReport[ HEADER ][ nI ][ 5 ], aReport[ HEADER ][ nI ][ 6 ], aReport[ HEADER ][ nI ][ 7 ], aReport[ HEADER ][ nI ][ 8 ], aReport[ HEADER ][ nI ][ 9 ], aReport[ HEADER ][ nI ][ 3 ] )
endcase
ENDIF
next
aReport[ FONTNAME ] := _nFont
aReport[ FONTSIZE ] := _nSize
IF aReport[ MARGINS ]
pdfMargins()
ENDIF
ELSE
IF aReport[ MARGINS ]
aReport[ PDFTOP ] := 1 // top
aReport[ PDFLEFT ] := 10 // left & right
aReport[ PDFBOTTOM ] := aReport[ PAGEY ] / 72 * aReport[ LPI ] - 1 // bottom, default "LETTER", "P", 6
aReport[ MARGINS ] := .f.
ENDIF
ENDIF
return nil
| hbvpdf.prg | 1603 |
FUNCTION | pdfMargins( nTop, nLeft, nBottom )
function pdfMargins( nTop, nLeft, nBottom )
local nI, nLen := len( aReport[ HEADER ] ), nTemp, aTemp, nHeight
// version 0.07 begin
DEFAULT nTop to 1 // top
DEFAULT nLeft to 10 // left & right
DEFAULT nBottom to aReport[ PAGEY ] / 72 * aReport[ LPI ] - 1 // bottom, default "LETTER", "P", 6
aReport[ PDFTOP ] := nTop
aReport[ PDFLEFT ] := nLeft
aReport[ PDFBOTTOM ] := nBottom
// version 0.07 end
for nI := 1 to nLen
IF aReport[ HEADER ][ nI ][ 1 ] // enabled
IF aReport[ HEADER ][ nI ][ 2 ] == "PDFSETFONT"
ELSEIF aReport[ HEADER ][ nI ][ 2 ] == "PDFIMAGE"
IF aReport[ HEADER ][ nI ][ 8 ] == 0 // picture in header, first at all, not at any page yet
aTemp := pdfImageInfo( aReport[ HEADER ][ nI ][ 4 ] )
nHeight := aTemp[ IMAGE_HEIGHT ] / aTemp[ IMAGE_YRES ] * 25.4
IF aReport[ HEADER ][ nI ][ 7 ] == "D"
nHeight := pdfM2X( nHeight )
ENDIF
ELSE
nHeight := aReport[ HEADER ][ nI ][ 8 ]
ENDIF
IF aReport[ HEADER ][ nI ][ 7 ] == "M"
nTemp := aReport[ PAGEY ] / 72 * 25.4 / 2
IF aReport[ HEADER ][ nI ][ 5 ] < nTemp
nTemp := ( aReport[ HEADER ][ nI ][ 5 ] + nHeight ) * aReport[ LPI ] / 25.4 // top
IF nTemp > aReport[ PDFTOP ]
aReport[ PDFTOP ] := nTemp
ENDIF
ELSE
nTemp := aReport[ HEADER ][ nI ][ 5 ] * aReport[ LPI ] / 25.4 // top
IF nTemp < aReport[ PDFBOTTOM ]
aReport[ PDFBOTTOM ] := nTemp
ENDIF
ENDIF
ELSEIF aReport[ HEADER ][ nI ][ 7 ] == "D"
nTemp := aReport[ PAGEY ] / 2
IF aReport[ HEADER ][ nI ][ 5 ] < nTemp
nTemp := ( aReport[ HEADER ][ nI ][ 5 ] + nHeight ) * aReport[ LPI ] / 72 // top
IF nTemp > aReport[ PDFTOP ]
aReport[ PDFTOP ] := nTemp
ENDIF
ELSE
nTemp := aReport[ HEADER ][ nI ][ 5 ] * aReport[ LPI ] / 72 // top
IF nTemp < aReport[ PDFBOTTOM ]
aReport[ PDFBOTTOM ] := nTemp
ENDIF
ENDIF
ENDIF
ELSEIF aReport[ HEADER ][ nI ][ 2 ] == "PDFBOX"
IF aReport[ HEADER ][ nI ][ 10 ] == "M"
nTemp := aReport[ PAGEY ] / 72 * 25.4 / 2
IF aReport[ HEADER ][ nI ][ 4 ] < nTemp .and. ;
aReport[ HEADER ][ nI ][ 6 ] < nTemp
nTemp := aReport[ HEADER ][ nI ][ 6 ] * aReport[ LPI ] / 25.4 // top
IF nTemp > aReport[ PDFTOP ]
aReport[ PDFTOP ] := nTemp
ENDIF
ELSEIF aReport[ HEADER ][ nI ][ 4 ] < nTemp .and. ;
aReport[ HEADER ][ nI ][ 6 ] > nTemp
nTemp := ( aReport[ HEADER ][ nI ][ 4 ] + aReport[ HEADER ][ nI ][ 8 ] ) * aReport[ LPI ] / 25.4 // top
IF nTemp > aReport[ PDFTOP ]
aReport[ PDFTOP ] := nTemp
ENDIF
nTemp := ( aReport[ HEADER ][ nI ][ 6 ] - aReport[ HEADER ][ nI ][ 8 ] ) * aReport[ LPI ] / 25.4 // top
IF nTemp < aReport[ PDFBOTTOM ]
aReport[ PDFBOTTOM ] := nTemp
ENDIF
ELSEIF aReport[ HEADER ][ nI ][ 4 ] > nTemp .and. ;
aReport[ HEADER ][ nI ][ 6 ] > nTemp
nTemp := aReport[ HEADER ][ nI ][ 4 ] * aReport[ LPI ] / 25.4 // top
IF nTemp < aReport[ PDFBOTTOM ]
aReport[ PDFBOTTOM ] := nTemp
ENDIF
ENDIF
ELSEIF aReport[ HEADER ][ nI ][ 10 ] == "D"
nTemp := aReport[ PAGEY ] / 2
IF aReport[ HEADER ][ nI ][ 4 ] < nTemp .and. ;
aReport[ HEADER ][ nI ][ 6 ] < nTemp
nTemp := aReport[ HEADER ][ nI ][ 6 ] / aReport[ LPI ] // top
IF nTemp > aReport[ PDFTOP ]
aReport[ PDFTOP ] := nTemp
ENDIF
ELSEIF aReport[ HEADER ][ nI ][ 4 ] < nTemp .and. ;
aReport[ HEADER ][ nI ][ 6 ] > nTemp
nTemp := ( aReport[ HEADER ][ nI ][ 4 ] + aReport[ HEADER ][ nI ][ 8 ] ) / aReport[ LPI ] // top
IF nTemp > aReport[ PDFTOP ]
aReport[ PDFTOP ] := nTemp
ENDIF
nTemp := ( aReport[ HEADER ][ nI ][ 6 ] - aReport[ HEADER ][ nI ][ 8 ] ) / aReport[ LPI ] // top
IF nTemp < aReport[ PDFBOTTOM ]
aReport[ PDFBOTTOM ] := nTemp
ENDIF
ELSEIF aReport[ HEADER ][ nI ][ 4 ] > nTemp .and. ;
aReport[ HEADER ][ nI ][ 6 ] > nTemp
nTemp := aReport[ HEADER ][ nI ][ 4 ] / aReport[ LPI ] // top
IF nTemp < aReport[ PDFBOTTOM ]
aReport[ PDFBOTTOM ] := nTemp
ENDIF
ENDIF
ENDIF
ELSE
IF aReport[ HEADER ][ nI ][ 7 ] == "R"
nTemp := aReport[ HEADER ][ nI ][ 5 ] // top
IF aReport[ HEADER ][ nI ][ 5 ] > aReport[ PAGEY ] / 72 * aReport[ LPI ] / 2
IF nTemp < aReport[ PDFBOTTOM ]
aReport[ PDFBOTTOM ] := nTemp
ENDIF
ELSE
IF nTemp > aReport[ PDFTOP ]
aReport[ PDFTOP ] := nTemp
ENDIF
ENDIF
ELSEIF aReport[ HEADER ][ nI ][ 7 ] == "M"
nTemp := aReport[ HEADER ][ nI ][ 5 ] * aReport[ LPI ] / 25.4 // top
IF aReport[ HEADER ][ nI ][ 5 ] > aReport[ PAGEY ] / 72 * 25.4 / 2
IF nTemp < aReport[ PDFBOTTOM ]
aReport[ PDFBOTTOM ] := nTemp
ENDIF
ELSE
IF nTemp > aReport[ PDFTOP ]
aReport[ PDFTOP ] := nTemp
ENDIF
ENDIF
ELSEIF aReport[ HEADER ][ nI ][ 7 ] == "D"
nTemp := aReport[ HEADER ][ nI ][ 5 ] / aReport[ LPI ] // top
IF aReport[ HEADER ][ nI ][ 5 ] > aReport[ PAGEY ] / 2
IF nTemp < aReport[ PDFBOTTOM ]
aReport[ PDFBOTTOM ] := nTemp
ENDIF
ELSE
IF nTemp > aReport[ PDFTOP ]
aReport[ PDFTOP ] := nTemp
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
next
aReport[ MARGINS ] := .f.
return nil
| hbvpdf.prg | 1654 |
FUNCTION | pdfCreateHeader( _file, _size, _orient, _lpi, _width )
function pdfCreateHeader( _file, _size, _orient, _lpi, _width )
local ;
aReportStyle := { ;
{ 1, 2, 3, 4, 5, 6 }, ; //"Default"
{ 2.475, 4.0, 4.9, 6.4, 7.5, 64.0 }, ; //"P6"
{ 3.3 , 5.4, 6.5, 8.6, 10.0, 85.35 }, ; //"P8"
{ 2.475, 4.0, 4.9, 6.4, 7.5, 48.9 }, ; //"L6"
{ 3.3 , 5.4, 6.5, 8.6, 10.0, 65.2 }, ; //"L8"
{ 2.475, 4.0, 4.9, 6.4, 7.5, 82.0 }, ; //"P6"
{ 3.3 , 5.4, 6.5, 8.6, 10.0, 109.35 } ; //"P8"
}
local nStyle := 1, nAdd := 0.00
DEFAULT _size to aReport[ PAGESIZE ]
DEFAULT _orient to aReport[ PAGEORIENT ]
DEFAULT _lpi to aReport[ LPI ]
DEFAULT _width to 200
IF _size == "LETTER"
IF _orient == "P"
IF _lpi == 6
nStyle := 2
ELSEIF _lpi == 8
nStyle := 3
ENDIF
ELSEIF _orient == "L"
IF _lpi == 6
nStyle := 4
ELSEIF _lpi == 8
nStyle := 5
ENDIF
ENDIF
ELSEIF _size == "LEGAL"
IF _orient == "P"
IF _lpi == 6
nStyle := 6
ELSEIF _lpi == 8
nStyle := 7
ENDIF
ELSEIF _orient == "L"
IF _lpi == 6
nStyle := 4
ELSEIF _lpi == 8
nStyle := 5
ENDIF
ENDIF
ENDIF
pdfEditOnHeader()
IF _size == "LEGAL"
nAdd := 76.2
ENDIF
IF _orient == "P"
pdfBox( 5.0, 5.0, 274.0 + nAdd, 210.0, 1.0 )
pdfBox( 6.5, 6.5, 272.5 + nAdd, 208.5, 0.5 )
pdfBox( 11.5, 9.5, 22.0 , 205.5, 0.5, 5 )
pdfBox( 23.0, 9.5, 33.5 , 205.5, 0.5, 5 )
pdfBox( 34.5, 9.5, 267.5 + nAdd, 205.5, 0.5 )
ELSE
pdfBox( 5.0, 5.0, 210.0, 274.0 + nAdd, 1.0 )
pdfBox( 6.5, 6.5, 208.5, 272.5 + nAdd, 0.5 )
pdfBox( 11.5, 9.5, 22.0, 269.5 + nAdd, 0.5, 5 )
pdfBox( 23.0, 9.5, 33.5, 269.5 + nAdd, 0.5, 5 )
pdfBox( 34.5, 9.5, 203.5, 269.5 + nAdd, 0.5 )
ENDIF
pdfSetFont("Helvetica", BOLD, 10) // 0.04
pdfAtSay( "Test Line 1", aReportStyle[ nStyle ][ 1 ], 1, "R", .t. )
pdfSetFont("Times", BOLD, 18)
pdfCenter( "Test Line 2", aReportStyle[ nStyle ][ 2 ],,"R", .t. )
pdfSetFont("Times", BOLD, 12)
pdfCenter( "Test Line 3", aReportStyle[ nStyle ][ 3 ],,"R", .t. )
pdfSetFont("Helvetica", BOLD, 10) // 0.04
pdfAtSay( "Test Line 4", aReportStyle[ nStyle ][ 4 ], 1, "R", .t. )
pdfSetFont("Helvetica", BOLD, 10) // 0.04
pdfAtSay( "Test Line 5", aReportStyle[ nStyle ][ 5 ], 1, "R", .t. )
pdfAtSay( dtoc( date()) + " " + TimeAsAMPM( time() ), aReportStyle[ nStyle ][ 6 ], 1, "R", .t. )
pdfRJust( "Page: #pagenumber#", aReportStyle[ nStyle ][ 6 ], aReport[ REPORTWIDTH ], "R", .t. )
pdfEditOffHeader()
pdfSaveHeader( _file )
return nil
| hbvpdf.prg | 1836 |
FUNCTION | pdfImageInfo( cFile )
function pdfImageInfo( cFile )
local cTemp := upper(substr( cFile, rat('.', cFile) + 1 )), aTemp := {}
do case
case cTemp == "TIF"
aTemp := pdfTIFFInfo( cFile )
case cTemp == "JPG"
aTemp := pdfJPEGInfo( cFile )
endcase
return aTemp
| hbvpdf.prg | 1930 |
FUNCTION | pdfTIFFInfo( cFile )
function pdfTIFFInfo( cFile )
local c40 := chr(0)+chr(0)+chr(0)+chr(0)
local aType := {"BYTE","ASCII","SHORT","LONG","RATIONAL","SBYTE","UNDEFINED","SSHORT","SLONG","SRATIONAL","FLOAT","DOUBLE"}
local aCount := { 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8 }
local nTemp, nHandle, cValues, c2, nFieldType, nCount, nPos, nTag, nValues
local nOffset, cTemp, cIFDNext, nIFD, nFields, cTag, nPages, nn
local nWidth := 0, nHeight := 0, nBits := 0, nFrom := 0, nLength := 0, xRes := 0, yRes := 0, aTemp := {}, nSpace
nHandle := fopen( cFile )
c2 := ' '
fread( nHandle, @c2, 2 )
/*
if c2 == 'II' .or. c2 == 'MM'
else
alert("Not II or MM")
endif
*/
fread( nHandle, @c2, 2 )
/*
if !( c2 == '*' ) + chr(0)
alert("Not *")
endif
*/
cIFDNext := ' '
fread( nHandle, @cIFDNext, 4 )
cTemp := space(12)
nPages := 0
while !( cIFDNext == c40 ) //read IFD's
nIFD := bin2l( cIFDNext )
fseek( nHandle, nIFD )
//?'*** IFD ' + ltrim(str( ++nPages ))
fread( nHandle, @c2, 2 )
nFields := bin2i( c2 )
for nn := 1 to nFields
fread( nHandle, @cTemp, 12 )
nTag := bin2w( substr( cTemp, 1, 2 ) )
nFieldType := bin2w(substr( cTemp, 3, 2 ))
/*
1 = BYTE 8-bit unsigned integer.
2 = ASCII 8-bit byte that contains a 7-bit ASCII code; the last byte
must be NUL (binary zero).
3 = SHORT 16-bit (2-byte) unsigned integer.
4 = LONG 32-bit (4-byte) unsigned integer.
5 = RATIONAL Two LONGs: the first represents the numerator of a
fraction; the second, the denominator.
In TIFF 6.0, some new field types have been defined:
6 = SBYTE An 8-bit signed (twos-complement) integer.
7 = UNDEFINED An 8-bit byte that may contain anything, depending on
the definition of the field.
8 = SSHORT A 16-bit (2-byte) signed (twos-complement) integer.
9 = SLONG A 32-bit (4-byte) signed (twos-complement) integer.
10 = SRATIONAL Two SLONG’s: the first represents the numerator of a
fraction, the second the denominator.
11 = FLOAT Single precision (4-byte) IEEE format.
12 = DOUBLE Double precision (8-byte) IEEE format.
*/
nCount := bin2l(substr( cTemp, 5, 4 ))
nOffset := bin2l(substr( cTemp, 9, 4 ))
IF nCount > 1 .or. nFieldType == RATIONAL .or. nFieldType == SRATIONAL
nPos := filepos( nHandle )
fseek( nHandle, nOffset)
nValues := nCount * aCount[ nFieldType ]
cValues := space( nValues )
fread( nHandle, @cValues, nValues )
fseek( nHandle, nPos )
ELSE
cValues := substr( cTemp, 9, 4 )
ENDIF
IF nFieldType == ASCII
--nCount
ENDIF
//?'Tag'
//??' ' + padr( nTag, 10 )
cTag := ''
do case
case nTag == 256
/*
ImageWidth
Tag = 256 (100.H)
Type = SHORT or LONG
The number of columns in the image, i.e., the number of pixels per scanline.
*/
//??'ImageWidth'
cTag := 'ImageWidth'
/*
IF nFieldType != SHORT .and. nFieldType != LONG
alert('Wrong Type for ImageWidth')
ENDIF
*/
IF nFieldType == SHORT
nWidth := bin2w(substr( cValues, 1, 2 ))
ELSEIF nFieldType == LONG
nWidth := bin2l(substr( cValues, 1, 4 ))
ENDIF
case nTag == 257
/*
ImageLength
Tag = 257 (101.H)
Type = SHORT or LONG
The number of rows (sometimes described as scanlines) in the image.
*/
//??'ImageLength'
cTag := 'ImageLength'
/*
IF nFieldType != SHORT .and. nFieldType != LONG
alert('Wrong Type for ImageLength')
ENDIF
*/
IF nFieldType == SHORT
nHeight := bin2w(substr( cValues, 1, 2 ))
ELSEIF nFieldType == LONG
nHeight := bin2l(substr( cValues, 1, 4 ))
ENDIF
case nTag == 258
/*
BitsPerSample
Tag = 258 (102.H)
Type = SHORT
The number of bits per component.
Allowable values for Baseline TIFF grayscale images are 4 and 8, allowing either
16 or 256 distinct shades of gray.
*/
//??'BitsPerSample'
cTag := 'BitsPerSample'
nTemp := 0
IF nFieldType == SHORT
nTemp := bin2w( cValues )
ELSE
//alert('Wrong Type for BitsPerSample')
ENDIF
nBits := nTemp
//IF nTemp != 4 .and. nTemp != 8
// alert('Wrong Value for BitsPerSample')
//ENDIF
case nTag == 259
/*
Compression
Tag = 259 (103.H)
Type = SHORT
Values:
1 = No compression, but pack data into bytes as tightly as possible, leaving no unused
bits (except at the end of a row). The component values are stored as an array of
type BYTE. Each scan line (row) is padded to the next BYTE boundary.
2 = CCITT Group 3 1-Dimensional Modified Huffman run length encoding. See
Section 10 for a description of Modified Huffman Compression.
32773 = PackBits compression, a simple byte-oriented run length scheme. See the
PackBits section for details.
Data compression applies only to raster image data. All other TIFF fields are
unaffected.
Baseline TIFF readers must handle all three compression schemes.
*/
//??'Compression'
cTag := 'Compression'
nTemp := 0
IF nFieldType == SHORT
nTemp := bin2w( cValues )
ELSE
//alert('Wrong Type for Compression')
ENDIF
//IF nTemp != 1 .and. nTemp != 2 .and. nTemp != 32773
// alert('Wrong Value for Compression')
//ENDIF
case nTag == 262
/*
PhotometricInterpretation
Tag = 262 (106.H)
Type = SHORT
Values:
0 = WhiteIsZero. For bilevel and grayscale images: 0 is imaged as white. The maxi-mum
value is imaged as black. This is the normal value for Compression=2.
1 = BlackIsZero. For bilevel and grayscale images: 0 is imaged as black. The maxi-mum
value is imaged as white. If this value is specified for Compression=2, the
image should display and print reversed.
*/
//??'PhotometricInterpretation'
cTag := 'PhotometricInterpretation'
nTemp := -1
IF nFieldType == SHORT
nTemp := bin2w( cValues )
ELSE
//alert('Wrong Type for PhotometricInterpretation')
ENDIF
IF nTemp != 0 .and. nTemp != 1 .and. nTemp != 2 .and. nTemp != 3
//alert('Wrong Value for PhotometricInterpretation')
ENDIF
case nTag == 264
/*
CellWidth
The width of the dithering or halftoning matrix used to create a dithered or
halftoned bilevel file.Tag = 264 (108.H)
Type = SHORT
N = 1
No default. See also Threshholding.
*/
//??'CellWidth'
cTag := 'CellWidth'
IF nFieldType != SHORT
//alert('Wrong Type for CellWidth')
ENDIF
case nTag == 265
/*
CellLength
The length of the dithering or halftoning matrix used to create a dithered or
halftoned bilevel file.
Tag = 265 (109.H)
Type = SHORT
N = 1
This field should only be present if Threshholding = 2
No default. See also Threshholding.
*/
//??'CellLength'
cTag := 'CellLength'
IF nFieldType != SHORT
//alert('Wrong Type for CellLength')
ENDIF
case nTag == 266
/*
FillOrder
The logical order of bits within a byte.
Tag = 266 (10A.H)
Type = SHORT
N = 1
*/
//??'FillOrder'
cTag := 'FillOrder'
IF nFieldType != SHORT
//alert('Wrong Type for FillOrder')
ENDIF
case nTag == 273
/*
StripOffsets
Tag = 273 (111.H)
Type = SHORT or LONG
For each strip, the byte offset of that strip.
*/
//??'StripOffsets'
cTag := 'StripOffsets'
IF nFieldType != SHORT .and. nFieldType != LONG
//alert('Wrong Type for StripOffsets')
ENDIF
IF nFieldType == SHORT
nFrom := bin2w(substr( cValues, 1, 2 ))
ELSEIF nFieldType == LONG
nFrom := bin2l(substr( cValues, 1, 4 ))
ENDIF
case nTag == 277
/*
SamplesPerPixel
Tag = 277 (115.H)
Type = SHORT
The number of components per pixel. This number is 3 for RGB images, unless
extra samples are present. See the ExtraSamples field for further information.
*/
//??'SamplesPerPixel'
cTag := 'SamplesPerPixel'
IF nFieldType != SHORT
//alert('Wrong Type for SamplesPerPixel')
ENDIF
case nTag == 278
/*
RowsPerStrip
Tag = 278 (116.H)
Type = SHORT or LONG
The number of rows in each strip (except possibly the last strip.)
For example, if ImageLength is 24, and RowsPerStrip is 10, then there are 3
strips, with 10 rows in the first strip, 10 rows in the second strip, and 4 rows in the
third strip. (The data in the last strip is not padded with 6 extra rows of dummy
data.)
*/
//??'RowsPerStrip'
cTag := 'RowsPerStrip'
IF nFieldType != SHORT .and. nFieldType != LONG
//alert('Wrong Type for RowsPerStrip')
ENDIF
case nTag == 279
/*
StripByteCounts
Tag = 279 (117.H)
Type = SHORT or LONG
For each strip, the number of bytes in that strip after any compression.
*/
//??'StripByteCounts'
cTag := 'StripByteCounts'
IF nFieldType != SHORT .and. nFieldType != LONG
//alert('Wrong Type for StripByteCounts')
ENDIF
IF nFieldType == SHORT
nLength := bin2w(substr( cValues, 1, 2 ))
ELSEIF nFieldType == LONG
nLength := bin2l(substr( cValues, 1, 4 ))
ENDIF
nLength *= nCount // Count all strips !!!
case nTag == 282
/*
XResolution
Tag = 282 (11A.H)
Type = RATIONAL
The number of pixels per ResolutionUnit in the ImageWidth (typically, horizontal
- see Orientation) direction.
*/
//??'XResolution'
cTag := 'XResolution'
IF nFieldType != RATIONAL
//alert('Wrong Type for XResolution')
ENDIF
xRes := bin2l(substr( cValues, 1, 4 ))
case nTag == 283
/*
YResolution
Tag = 283 (11B.H)
Type = RATIONAL
The number of pixels per ResolutionUnit in the ImageLength (typically, vertical)
direction.
*/
//??'YResolution'
cTag := 'YResolution'
IF nFieldType != RATIONAL
//alert('Wrong Type for YResolution')
ENDIF
yRes := bin2l(substr( cValues, 1, 4 ))
case nTag == 284
//??'PlanarConfiguration'
cTag := 'PlanarConfiguration'
IF nFieldType != SHORT
//alert('Wrong Type for PlanarConfiguration')
ENDIF
case nTag == 288
/*
FreeOffsets
For each string of contiguous unused bytes in a TIFF file, the byte offset of the
string.
Tag = 288 (120.H)
Type = LONG
Not recommended for general interchange.
See also FreeByteCounts.
*/
//??'FreeOffsets'
cTag := 'FreeOffsets'
IF nFieldType != LONG
//alert('Wrong Type for FreeOffsets')
ENDIF
case nTag == 289
/*
FreeByteCounts
For each string of contiguous unused bytes in a TIFF file, the number of bytes in
the string.
Tag = 289 (121.H)
Type = LONG
Not recommended for general interchange.
See also FreeOffsets.
*/
//??'FreeByteCounts'
cTag := 'FreeByteCounts'
IF nFieldType != LONG
//alert('Wrong Type for FreeByteCounts')
ENDIF
case nTag == 296
/*
ResolutionUnit
Tag = 296 (128.H)
Type = SHORT
Values:
1 = No absolute unit of measurement. Used for images that may have a non-square
aspect ratio but no meaningful absolute dimensions.
2 = Inch.
3 = Centimeter.
Default = 2 (inch).
*/
//??'ResolutionUnit'
cTag := 'ResolutionUnit'
nTemp := 0
IF nFieldType == SHORT
nTemp := bin2w( cValues )
ELSE
//alert('Wrong Type for ResolutionUnit')
ENDIF
IF nTemp != 1 .and. nTemp != 2 .and. nTemp != 3
//alert('Wrong Value for ResolutionUnit')
ENDIF
case nTag == 305
//??'Software'
cTag := 'Software'
IF nFieldType != ASCII
//alert('Wrong Type for Software')
ENDIF
case nTag == 306
/*
DateTime
Date and time of image creation.
Tag = 306 (132.H)
Type = ASCII
N = 2 0
The format is: YYYY:MM:DD HH:MM:SS, with hours like those on a 24-hour
clock, and one space character between the date and the time. The length of the
string, including the terminating NUL, is 20 bytes.
*/
//??'DateTime'
cTag := 'DateTime'
IF nFieldType != ASCII
//alert('Wrong Type for DateTime')
ENDIF
case nTag == 315
/*
Artist
Person who created the image.
Tag = 315 (13B.H)
Type = ASCII
Note: some older TIFF files used this tag for storing Copyright information.
*/
//??'Artist'
cTag := 'Artist'
IF nFieldType != ASCII
//alert('Wrong Type for Artist')
ENDIF
case nTag == 320
/*
ColorMap
Tag = 320 (140.H)
Type = SHORT
N = 3 * (2**BitsPerSample)
This field defines a Red-Green-Blue color map (often called a lookup table) for
palette color images. In a palette-color image, a pixel value is used to index into an
RGB-lookup table. For example, a palette-color pixel having a value of 0 would
be displayed according to the 0th Red, Green, Blue triplet.
In a TIFF ColorMap, all the Red values come first, followed by the Green values,
then the Blue values. In the ColorMap, black is represented by 0,0,0 and white is
represented by 65535, 65535, 65535.
*/
//??'ColorMap'
cTag := 'ColorMap'
IF nFieldType != SHORT
//alert('Wrong Type for ColorMap')
ENDIF
case nTag == 338
/*
ExtraSamples
Description of extra components.
Tag = 338 (152.H)
Type = SHORT
N = m
*/
//??'ExtraSamples'
cTag := 'ExtraSamples'
IF nFieldType != SHORT
//alert('Wrong Type for ExtraSamples')
ENDIF
case nTag == 33432
/*
Copyright
Copyright notice.
Tag = 33432 (8298.H)
Type = ASCII
Copyright notice of the person or organization that claims the copyright to the
image. The complete copyright statement should be listed in this field including
any dates and statements of claims. For example, “Copyright, John Smith, 19xx.
All rights reserved.
*/
//??'Copyright'
cTag := 'Copyright'
IF nFieldType != ASCII
//alert('Wrong Type for Copyright')
ENDIF
otherwise
//??'Unknown'
cTag := 'Unknown'
endcase
/*
??padr( cTag, 30 )
??' type ' + padr(aType[ nFieldType ], 10) + ' count ' + ltrim(str(nCount)) + ' <'
do case
case nFieldType == BYTE
for nI := 1 to nCount
??' ' + ltrim(str(asc( substr( cValues, nI, 1 ))))
next
case nFieldType == ASCII
??' '
for nI := 1 to nCount
??substr( cValues, nI, 1 )
next
case nFieldType == SHORT
for nI := 1 to nCount
??' ' + ltrim(str(bin2w(substr( cValues, ( nI - 1 ) * 2 + 1, 2 ))))
next
case nFieldType == LONG
for nI := 1 to nCount
??' ' + ltrim(str(bin2l(substr( cValues, ( nI - 1 ) * 4 + 1, 4 ))))
next
case nFieldType == RATIONAL
for nI := 1 to nCount
??' ' + ltrim(str(bin2l(substr( cValues, ( nI - 1 ) * 8 + 1, 4 )))) + '/' + ltrim(str(bin2l(substr( cValues, nI + 4, 4 ))))
next
case nFieldType == SBYTE
for nI := 1 to nCount
??' ' + ltrim(str(asc( substr( cValues, nI, 1 ))))
next
case nFieldType == UNDEFINED
for nI := 1 to nCount
??' ' + substr( cValues, nI, 1 )
next
case nFieldType == SSHORT
for nI := 1 to nCount
??' ' + ltrim(str(bin2i(substr( cValues, ( nI - 1 ) * 2 + 1, 2 ))))
next
case nFieldType == SLONG
for nI := 1 to nCount
??' ' + ltrim(str(bin2l(substr( cValues, ( nI - 1 ) * 4 + 1, 4 ))))
next
case nFieldType == SRATIONAL
for nI := 1 to nCount
??' ' + ltrim(str(bin2l(substr( cValues, ( nI - 1 ) * 8 + 1, 4 )))) + '/' + ltrim(str(bin2l(substr( cValues, nI + 4, 4 ))))
next
case nFieldType == FLOAT
case nFieldType == DOUBLE
for nI := 1 to nCount
??' ' + ltrim(str(ctof(substr( cValues, ( nI - 1 ) * 8 + 1, 8 ))))
next
endcase
??' >'
*/
next
fread( nHandle, @cIFDNext, 4 )
enddo
fclose( nHandle )
aadd( aTemp, nWidth )
aadd( aTemp, nHeight )
aadd( aTemp, xRes )
aadd( aTemp, yRes )
aadd( aTemp, nBits )
aadd( aTemp, nFrom )
aadd( aTemp, nLength )
nSpace := 0
aadd( aTemp, nSpace )
return aTemp
| hbvpdf.prg | 1940 |
FUNCTION | pdfJPEGInfo( cFile )
function pdfJPEGInfo( cFile )
local c255, nAt, nHandle
local nWidth := 0, nHeight := 0, nBits := 8, nFrom := 0, nLength := 0, xRes := 0, yRes := 0, aTemp := {}
local nBuffer := 20000
local nSpace := 3 // 3 - RGB, 1 - GREY, 4 - CMYK
nHandle := fopen( cFile )
c255 := space( nBuffer )
fread( nHandle, @c255, nBuffer )
xRes := asc(substr( c255, 15, 1 )) * 256 + asc(substr( c255, 16, 1 ))
yRes := asc( substr( c255, 17, 1 )) * 256 + asc(substr( c255, 18, 1 ))
//nAt := at( chr(255) + chr(192), c255 ) + 5
nAt := rat( chr(255) + chr(192), c255 ) + 5
nHeight := asc(substr( c255, nAt, 1 )) * 256 + asc(substr( c255, nAt + 1, 1 ))
nWidth := asc( substr( c255, nAt + 2, 1 )) * 256 + asc(substr( c255, nAt + 3, 1 ))
nSpace := asc( substr( c255, nAt + 4, 1 ))
nLength := filesize( nHandle )
fclose( nHandle )
aadd( aTemp, nWidth )
aadd( aTemp, nHeight )
aadd( aTemp, xRes )
aadd( aTemp, yRes )
aadd( aTemp, nBits )
aadd( aTemp, nFrom )
aadd( aTemp, nLength )
aadd( aTemp, nSpace )
return aTemp
| hbvpdf.prg | 2499 |
FUNCTION | pdfAddBuffer( cStr )
function pdfAddBuffer( cStr )
local nLength := len( cStr )
IF aReport[ BUFFERHANDLE ] > 0 //already file buffer open
fwrite( aReport[ BUFFERHANDLE ], cStr )
ELSE
IF len( aReport[ PAGEBUFFER ] ) + nLength > MAXBUFLEN //then open file buffer
aReport[ BUFFERHANDLE ] := FCREATE("temp.buf")
fwrite( aReport[ BUFFERHANDLE ], aReport[ PAGEBUFFER ] )
fwrite( aReport[ BUFFERHANDLE ], cStr )
ELSE
aReport[ PAGEBUFFER ] += cStr
ENDIF
ENDIF
return nil
| hbvpdf.prg | 2535 |
FUNCTION | FilePos( nHandle )
FUNCTION FilePos( nHandle )
RETURN ( FSEEK( nHandle, 0, FS_RELATIVE ) )
| hbvpdf.prg | 2550 |
FUNCTION | pdfFilePrint( cFile )
FUNCTION pdfFilePrint( cFile )
LOCAL cRun := "d:\progra~2\Adobe\Acroba~2.0\Reader\AcroRd32.exe /t " + cFile + " " + chr(34) + "HP LaserJet 5/5M PostScript" + chr(34) + " " + chr(34) + "LPT1" + chr(34)
IF (!SWPRUNCMD( cRun, 0, "", ""))
alert("Error printing to PDF reader.")
break
ENDIF
//"C:\Program Files\Adobe\Acrobat 4.0\Reader\acrord32.exe" /t "%1"
//"HP LJ4 Legal" "HP Laserjet 4 Plus" "LPT3"
RETURN nil
| hbvpdf.prg | 2553 |
FUNCTION | Chr_RGB( cChar )
FUNCTION Chr_RGB( cChar )
RETURN str(asc( cChar ) / 255, 4, 2)
| hbvpdf.prg | 2603 |
FUNCTION | NumToken( cString, cDelimiter )
FUNCTION NumToken( cString, cDelimiter )
RETURN AllToken( cString, cDelimiter )
| hbvpdf.prg | 2606 |
FUNCTION | Token( cString, cDelimiter, nPointer )
FUNCTION Token( cString, cDelimiter, nPointer )
RETURN AllToken( cString, cDelimiter, nPointer, 1 )
| hbvpdf.prg | 2609 |
FUNCTION | AtToken( cString, cDelimiter, nPointer )
FUNCTION AtToken( cString, cDelimiter, nPointer )
RETURN AllToken( cString, cDelimiter, nPointer, 2 )
| hbvpdf.prg | 2612 |
FUNCTION | AllToken( cString, cDelimiter, nPointer, nAction )
FUNCTION AllToken( cString, cDelimiter, nPointer, nAction )
LOCAL nTokens := 0, nPos := 1, nLen := len( cString ), nStart := 0, cToken := "", cRet
DEFAULT cDelimiter to chr(0)+chr(9)+chr(10)+chr(13)+chr(26)+chr(32)+chr(138)+chr(141)
DEFAULT nAction to 0
// nAction == 0 - numtoken
// nAction == 1 - token
// nAction == 2 - attoken
while nPos <= nLen
if .not. substr( cString, nPos, 1 ) $ cDelimiter
nStart := nPos
while nPos <= nLen .and. .not. substr( cString, nPos, 1 ) $ cDelimiter
++nPos
enddo
++nTokens
IF nAction > 0
IF nPointer == nTokens
IF nAction == 1
cRet := substr( cString, nStart, nPos - nStart )
ELSE
cRet := nStart
ENDIF
exit
ENDIF
ENDIF
endif
if substr( cString, nPos, 1 ) $ cDelimiter
while nPos <= nLen .and. substr( cString, nPos, 1 ) $ cDelimiter
++nPos
enddo
endif
cRet := nTokens
ENDDO
RETURN cRet
| hbvpdf.prg | 2615 |
FUNCTION | NumAt( cSearch, cString )
FUNCTION NumAt( cSearch, cString )
LOCAL n := 0, nAt := 0, nPos := 0
WHILE ( nAt := at( cSearch, substr( cString, nPos + 1 ) )) > 0
nPos += nAt
++n
ENDDO
RETURN n
| hbvpdf.prg | 2651 |
FUNCTION | FileSize( nHandle )
FUNCTION FileSize( nHandle )
LOCAL nCurrent
LOCAL nLength
// Get file position
nCurrent := FilePos( nHandle )
// Get file length
nLength := FSEEK( nHandle, 0, FS_END )
// Reset file position
FSEEK( nHandle, nCurrent )
RETURN ( nLength )
| hbvpdf.prg | 2659 |
FUNCTION | Array2File(cFile,aRay,nDepth,hFile)
function Array2File(cFile,aRay,nDepth,hFile)
local nBytes := 0
local i
nDepth := if(ISNUMBER(nDepth),nDepth,0)
if hFile == NIL
if (hFile := fCreate(cFile,FC_NORMAL)) == -1
return(nBytes)
endif
endif
nDepth++
nBytes += WriteData(hFile,aRay)
if ISARRAY(aRay)
for i := 1 to len(aRay)
nBytes += Array2File(cFile,aRay[i],nDepth,hFile)
next
endif
nDepth--
if nDepth == 0
fClose(hFile)
endif
return(nBytes)
| hbvpdf.prg | 2678 |
STATIC FUNCTION | WriteData(hFile,xData)
static function WriteData(hFile,xData)
local cData := valtype(xData)
if ISCHARACTER(xData)
cData += i2bin(len(xData))+xData
elseif ISNUMBER(xData)
cData += i2bin(len(alltrim(str(xData))) )+alltrim(str(xData))
elseif ISDATE(xData)
cData += i2bin(8)+dtos(xData)
elseif ISLOGICAL(xData)
cData += i2bin(1)+if(xData,'T','F')
elseif ISARRAY(xData)
cData += i2bin(len(xData))
else
cData += i2bin(0) // NIL
endif
return( fWrite(hFile,cData,len(cData)) )
| hbvpdf.prg | 2700 |
FUNCTION | File2Array(cFile,nLen,hFile)
function File2Array(cFile,nLen,hFile)
LOCAL cData,cType,nDataLen,nBytes
local nDepth := 0
local aRay := {}
if hFile == NIL
if (hFile:=fOpen(cFile,FO_READ)) == -1
return(aRay)
endif
cData := space(3)
fRead(hFile,@cData,3)
if left(cData,1) != 'A'
return( aRay)
endif
nLen := bin2i(right(cData,2))
endif
do while nDepth < nLen
cData := space(3)
nBytes := fRead(hFile,@cData,3)
if nBytes<3
exit
endif
cType:= padl(cData,1)
nDataLen:= bin2i(right(cData,2))
if cType != 'A'
cData := space(nDataLen)
nBytes:= fRead(hFile,@cData,nDataLen)
if nByteshbvpdf.prg | 2717 | |
FUNCTION | SWPRUNCMD( cCommand, x1, x2, x3 )
Function SWPRUNCMD( cCommand, x1, x2, x3 )
HB_SYMBOL_UNUSED( x1 )
HB_SYMBOL_UNUSED( x2 )
HB_SYMBOL_UNUSED( x3 )
RUN (cCommand)
Return .T.
| hbvpdf.prg | 2770 |
hbvpdft.prg |
Type | Function | Source | Line |
METHOD | Init( cFile, nLen, lOptimize ) CONSTRUCTOR
METHOD Init( cFile, nLen, lOptimize ) CONSTRUCTOR
| hbvpdft.prg | 55 |
METHOD | Init
METHOD Init
| hbvpdft.prg | 57 |
METHOD | AtSay
METHOD AtSay
| hbvpdft.prg | 60 |
METHOD | Normal
METHOD Normal
| hbvpdft.prg | 61 |
METHOD | Bold
METHOD Bold
| hbvpdft.prg | 62 |
METHOD | Italic
METHOD Italic
| hbvpdft.prg | 63 |
METHOD | UnderLine
METHOD UnderLine
| hbvpdft.prg | 64 |
METHOD | BoldItalic
METHOD BoldItalic
| hbvpdft.prg | 65 |
METHOD | BookAdd
METHOD BookAdd
| hbvpdft.prg | 66 |
METHOD | BookClose
METHOD BookClose
| hbvpdft.prg | 67 |
METHOD | BookOpen
METHOD BookOpen
| hbvpdft.prg | 68 |
METHOD | Box
METHOD Box
| hbvpdft.prg | 69 |
METHOD | Box1
METHOD Box1
| hbvpdft.prg | 70 |
METHOD | Center
METHOD Center
| hbvpdft.prg | 71 |
METHOD | Close
METHOD Close
| hbvpdft.prg | 72 |
METHOD | Image
METHOD Image
| hbvpdft.prg | 73 |
METHOD | Length
METHOD Length
| hbvpdft.prg | 74 |
METHOD | NewLine
METHOD NewLine
| hbvpdft.prg | 75 |
METHOD | NewPage
METHOD NewPage
| hbvpdft.prg | 76 |
METHOD | PageSize
METHOD PageSize
| hbvpdft.prg | 77 |
METHOD | PageOrient
METHOD PageOrient
| hbvpdft.prg | 78 |
METHOD | PageNumber
METHOD PageNumber
| hbvpdft.prg | 79 |
METHOD | Reverse
METHOD Reverse
| hbvpdft.prg | 80 |
METHOD | RJust
METHOD RJust
| hbvpdft.prg | 81 |
METHOD | SetFont
METHOD SetFont
| hbvpdft.prg | 82 |
METHOD | SetLPI
METHOD SetLPI
| hbvpdft.prg | 83 |
METHOD | StringB
METHOD StringB
| hbvpdft.prg | 84 |
METHOD | TextCount
METHOD TextCount
| hbvpdft.prg | 85 |
METHOD | Text
METHOD Text
| hbvpdft.prg | 86 |
METHOD | OpenHeader
METHOD OpenHeader
| hbvpdft.prg | 87 |
METHOD | EditOnHeader
METHOD EditOnHeader
| hbvpdft.prg | 88 |
METHOD | EditOffHeader
METHOD EditOffHeader
| hbvpdft.prg | 89 |
METHOD | CloseHeader
METHOD CloseHeader
| hbvpdft.prg | 90 |
METHOD | DeleteHeader
METHOD DeleteHeader
| hbvpdft.prg | 91 |
METHOD | EnableHeader
METHOD EnableHeader
| hbvpdft.prg | 92 |
METHOD | DisableHeader
METHOD DisableHeader
| hbvpdft.prg | 93 |
METHOD | SaveHeader
METHOD SaveHeader
| hbvpdft.prg | 94 |
METHOD | Header
METHOD Header
| hbvpdft.prg | 95 |
METHOD | DrawHeader
METHOD DrawHeader
| hbvpdft.prg | 96 |
METHOD | Margins
METHOD Margins
| hbvpdft.prg | 97 |
METHOD | CreateHeader
METHOD CreateHeader
| hbvpdft.prg | 98 |
METHOD | ImageInfo
METHOD ImageInfo
| hbvpdft.prg | 99 |
METHOD | TIFFInfo
METHOD TIFFInfo
| hbvpdft.prg | 100 |
METHOD | JPEGInfo
METHOD JPEGInfo
| hbvpdft.prg | 101 |
METHOD | FilePrint
METHOD FilePrint
| hbvpdft.prg | 102 |
METHOD | BookCount
METHOD BookCount
| hbvpdft.prg | 103 |
METHOD | BookFirst
METHOD BookFirst
| hbvpdft.prg | 104 |
METHOD | BookLast
METHOD BookLast
| hbvpdft.prg | 105 |
METHOD | BookNext
METHOD BookNext
| hbvpdft.prg | 106 |
METHOD | BookParent
METHOD BookParent
| hbvpdft.prg | 107 |
METHOD | BookPrev
METHOD BookPrev
| hbvpdft.prg | 108 |
METHOD | CheckLine
METHOD CheckLine
| hbvpdft.prg | 109 |
METHOD | ClosePage
METHOD ClosePage
| hbvpdft.prg | 110 |
METHOD | GetFontInfo
METHOD GetFontInfo
| hbvpdft.prg | 111 |
METHOD | M2R
METHOD M2R
| hbvpdft.prg | 112 |
METHOD | M2X
METHOD M2X
| hbvpdft.prg | 113 |
METHOD | M2Y
METHOD M2Y
| hbvpdft.prg | 114 |
METHOD | R2D
METHOD R2D
| hbvpdft.prg | 115 |
METHOD | R2M
METHOD R2M
| hbvpdft.prg | 116 |
METHOD | X2M
METHOD X2M
| hbvpdft.prg | 117 |
METHOD | TextPrint
METHOD TextPrint
| hbvpdft.prg | 118 |
METHOD | TextNextPara
METHOD TextNextPara
| hbvpdft.prg | 119 |
METHOD | Execute
METHOD Execute
ENDCLASS
| hbvpdft.prg | 120 |
METHOD TPDF | Init( cFile, nLen, lOptimize )
METHOD tPdf:Init( cFile, nLen, lOptimize )
| hbvpdft.prg | 127 |
METHOD | Init( cFile, nLen, lOptimize )
METHOD Init( cFile, nLen, lOptimize )
#endif
local cTemp, nI, nJ, n1, n2 := 896, n12
DEFAULT nLen TO 200
DEFAULT lOptimize TO .f.
::aReport := array( PARAMLEN )
::aReport[ FONTNAME ] := 1
::aReport[ FONTSIZE ] := 10
::aReport[ LPI ] := 6
::aReport[ PAGESIZE ] := "LETTER"
::aReport[ PAGEORIENT ] := "P"
::aReport[ PAGEX ] := 8.5 * 72
::aReport[ PAGEY ] := 11.0 * 72
::aReport[ REPORTWIDTH ] := nLen // 200 // should be as parameter
::aReport[ REPORTPAGE ] := 0
::aReport[ REPORTLINE ] := 0 // 5
::aReport[ FONTNAMEPREV ] := 0
::aReport[ FONTSIZEPREV ] := 0
::aReport[ PAGEBUFFER ] := ""
::aReport[ REPORTOBJ ] := 1 //2
::aReport[ DOCLEN ] := 0
::aReport[ TYPE1 ] := { "Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItalic", ;
"Helvetica", "Helvetica-Bold", "Helvetica-Oblique", "Helvetica-BoldOblique", ;
"Courier", "Courier-Bold", "Courier-Oblique", "Courier-BoldOblique" }
::aReport[ MARGINS ] := .t.
::aReport[ HEADEREDIT ] := .f.
::aReport[ NEXTOBJ ] := 0
::aReport[ PDFTOP ] := 1 // top
::aReport[ PDFLEFT ] := 10 // left & right
::aReport[ PDFBOTTOM ] := ::aReport[ PAGEY ] / 72 * ::aReport[ LPI ] - 1 // bottom, default "LETTER", "P", 6
::aReport[ HANDLE ] := fcreate( cFile )
::aReport[ PAGES ] := {}
::aReport[ REFS ] := { 0, 0 }
::aReport[ BOOKMARK ] := {}
::aReport[ HEADER ] := {}
::aReport[ FONTS ] := {}
::aReport[ IMAGES ] := {}
::aReport[ PAGEIMAGES ] := {}
::aReport[ PAGEFONTS ] := {}
cTemp := vpdf_FontsDat()
n1 := len( cTemp ) / ( 2 * n2 )
::aReport[ FONTWIDTH ] := array( n1, n2 )
::aReport[ OPTIMIZE ] := lOptimize
::aReport[ NEXTOBJ ] := ::aReport[ REPORTOBJ ] + 4
n12 := 2 * n2
for nI := 1 to n1
for nJ := 1 to n2
::aReport[ FONTWIDTH ][ nI ][ nJ ] := bin2i( substr( cTemp, ( nI - 1 ) * n12 + ( nJ - 1 ) * 2 + 1, 2 ) )
next
next
::aReport[ DOCLEN ] := 0
cTemp := "%PDF-1.3" + CRLF
::aReport[ DOCLEN ] += len( cTemp )
fwrite( ::aReport[ HANDLE ], cTemp )
RETURN self
| hbvpdft.prg | 129 |
METHOD TPDF | AtSay( cString, nRow, nCol, cUnits, lExact, cId )
METHOD tPdf:AtSay( cString, nRow, nCol, cUnits, lExact, cId )
| hbvpdft.prg | 198 |
METHOD | AtSay( cString, nRow, nCol, cUnits, lExact, cId )
METHOD AtSay( cString, nRow, nCol, cUnits, lExact, cId )
#endif
local _nFont, lReverse, nAt
DEFAULT nRow TO ::aReport[ REPORTLINE ]
DEFAULT cUnits TO "R"
DEFAULT lExact TO .f.
DEFAULT cId TO ""
IF ::aReport[ HEADEREDIT ]
return ::Header( "PDFATSAY", cId, { cString, nRow, nCol, cUnits, lExact } )
ENDIF
IF ( nAt := at( "#pagenumber#", cString ) ) > 0
cString := left( cString, nAt - 1 ) + ltrim(str( ::PageNumber())) + substr( cString, nAt + 12 )
ENDIF
lReverse := .f.
IF cUnits == "M"
nRow := ::M2Y( nRow )
nCol := ::M2X( nCol )
ELSEIF cUnits == "R"
IF .not. lExact
::CheckLine( nRow )
nRow := nRow + ::aReport[ PDFTOP]
ENDIF
nRow := ::R2D( nRow )
nCol := ::M2X( ::aReport[ PDFLEFT ] ) + ;
nCol * 100.00 / ::aReport[ REPORTWIDTH ] * ;
( ::aReport[ PAGEX ] - ::M2X( ::aReport[ PDFLEFT ] ) * 2 - 9.0 ) / 100.00
ENDIF
IF !empty( cString )
cString := ::StringB( cString )
IF right( cString, 1 ) == chr(255) //reverse
cString := left( cString, len( cString ) - 1 )
::Box( ::aReport[ PAGEY ] - nRow - ::aReport[ FONTSIZE ] + 2.0 , nCol, ::aReport[ PAGEY ] - nRow + 2.0, nCol + ::M2X( ::length( cString )) + 1,,100, "D")
::aReport[ PAGEBUFFER ] += " 1 g "
lReverse := .t.
ELSEIF right( cString, 1 ) == chr(254) //underline
cString := left( cString, len( cString ) - 1 )
::Box( ::aReport[ PAGEY ] - nRow + 0.5, nCol, ::aReport[ PAGEY ] - nRow + 1, nCol + ::M2X( ::length( cString )) + 1,,100, "D")
ENDIF
// version 0.01
IF ( nAt := at( chr(253), cString )) > 0 // some color text inside
::aReport[ PAGEBUFFER ] += CRLF + ;
Chr_RGB( substr( cString, nAt + 1, 1 )) + " " + ;
Chr_RGB( substr( cString, nAt + 2, 1 )) + " " + ;
Chr_RGB( substr( cString, nAt + 3, 1 )) + " rg "
cString := stuff( cString, nAt, 4, "")
ENDIF
// version 0.01
_nFont := ascan( ::aReport[ FONTS ], {|arr| arr[1] == ::aReport[ FONTNAME ]} )
IF !( ::aReport[ FONTNAME ] == ::aReport[ FONTNAMEPREV ] )
::aReport[ FONTNAMEPREV ] := ::aReport[ FONTNAME ]
::aReport[ PAGEBUFFER ] += CRLF + "BT /Fo" + ltrim(str( _nFont )) + " " + ltrim(transform( ::aReport[ FONTSIZE ], "999.99")) + " Tf " + ltrim(transform( nCol, "9999.99" )) + " " + ltrim(transform( nRow, "9999.99" )) + " Td (" + cString + ") Tj ET"
ELSEIF ::aReport[ FONTSIZE ] != ::aReport[ FONTSIZEPREV ]
::aReport[ FONTSIZEPREV ] := ::aReport[ FONTSIZE ]
::aReport[ PAGEBUFFER ] += CRLF + "BT /Fo" + ltrim(str( _nFont )) + " " + ltrim(transform( ::aReport[ FONTSIZE ], "999.99")) + " Tf " + ltrim(transform( nCol, "9999.99" )) + " " + ltrim(transform( nRow, "9999.99" )) + " Td (" + cString + ") Tj ET"
ELSE
::aReport[ PAGEBUFFER ] += CRLF + "BT " + ltrim(transform( nCol, "9999.99" )) + " " + ltrim(transform( nRow, "9999.99" )) + " Td (" + cString + ") Tj ET"
ENDIF
IF lReverse
::aReport[ PAGEBUFFER ] += " 0 g "
ENDIF
ENDIF
RETURN self
| hbvpdft.prg | 200 |
METHOD TPDF | Normal()
METHOD tPdf:Normal()
| hbvpdft.prg | 274 |
METHOD | Normal()
METHOD Normal()
#endif
local cName := ::GetFontInfo( "NAME" )
IF cName = "Times"
::aReport[ FONTNAME ] := 1
ELSEIF cName = "Helvetica"
::aReport[ FONTNAME ] := 5
ELSE
::aReport[ FONTNAME ] := 9
ENDIF
aadd( ::aReport[ PAGEFONTS ], ::aReport[ FONTNAME ] )
IF ascan( ::aReport[ FONTS ], { |arr| arr[1] == ::aReport[ FONTNAME ] } ) == 0
aadd( ::aReport[ FONTS ], { ::aReport[ FONTNAME ], ++::aReport[ NEXTOBJ ] } )
ENDIF
RETURN self
| hbvpdft.prg | 276 |
METHOD TPDF | Italic()
METHOD tPdf:Italic()
| hbvpdft.prg | 296 |
METHOD | Italic()
METHOD Italic()
#endif
local cName := ::GetFontInfo( "NAME" )
IF cName = "Times"
::aReport[ FONTNAME ] := 3
ELSEIF cName = "Helvetica"
::aReport[ FONTNAME ] := 7
ELSE
::aReport[ FONTNAME ] := 11
ENDIF
aadd( ::aReport[ PAGEFONTS ], ::aReport[ FONTNAME ] )
IF ascan( ::aReport[ FONTS ], { |arr| arr[1] == ::aReport[ FONTNAME ] } ) == 0
aadd( ::aReport[ FONTS ], { ::aReport[ FONTNAME ], ++::aReport[ NEXTOBJ ] } )
ENDIF
RETURN self
| hbvpdft.prg | 298 |
METHOD TPDF | Bold()
METHOD tPdf:Bold()
| hbvpdft.prg | 318 |
METHOD | Bold()
METHOD Bold()
#endif
local cName := ::GetFontInfo( "NAME" )
IF cName == "Times"
::aReport[ FONTNAME ] := 2
ELSEIF cName == "Helvetica"
::aReport[ FONTNAME ] := 6
ELSEIF cName == 'Courier'
::aReport[ FONTNAME ] := 10 // Courier // 0.04
ENDIF
aadd( ::aReport[ PAGEFONTS ], ::aReport[ FONTNAME ] )
IF ascan( ::aReport[ FONTS ], { |arr| arr[1] == ::aReport[ FONTNAME ] } ) == 0
aadd( ::aReport[ FONTS ], { ::aReport[ FONTNAME ], ++::aReport[ NEXTOBJ ] } )
ENDIF
RETURN self
| hbvpdft.prg | 320 |
METHOD TPDF | BoldItalic()
METHOD tPdf:BoldItalic()
| hbvpdft.prg | 342 |
METHOD | BoldItalic()
METHOD BoldItalic()
#endif
local cName := ::GetFontInfo( "NAME" )
IF cName == "Times"
::aReport[ FONTNAME ] := 4
ELSEIF cName == "Helvetica"
::aReport[ FONTNAME ] := 8
ELSEIF cName == 'Courier'
::aReport[ FONTNAME ] := 12 // 0.04
ENDIF
aadd( ::aReport[ PAGEFONTS ], ::aReport[ FONTNAME ] )
IF ascan( ::aReport[ FONTS ], { |arr| arr[1] == ::aReport[ FONTNAME ] } ) == 0
aadd( ::aReport[ FONTS ], { ::aReport[ FONTNAME ], ++::aReport[ NEXTOBJ ] } )
ENDIF
RETURN self
| hbvpdft.prg | 344 |
METHOD TPDF | BookAdd( cTitle, nLevel, nPage, nLine )
METHOD tPdf:BookAdd( cTitle, nLevel, nPage, nLine )
| hbvpdft.prg | 366 |
METHOD | BookAdd( cTitle, nLevel, nPage, nLine )
METHOD BookAdd( cTitle, nLevel, nPage, nLine )
#endif
aadd( ::aReport[ BOOKMARK ], { nLevel, alltrim( cTitle ), 0, 0, 0, 0, 0, 0, nPage, IIF( nLevel == 1, ::aReport[ PAGEY ], ::aReport[ PAGEY ] - nLine * 72 / ::aReport[ LPI ] ) })
RETURN self
| hbvpdft.prg | 368 |
METHOD TPDF | BookClose( )
METHOD tPdf:BookClose( )
| hbvpdft.prg | 378 |
METHOD | BookClose( )
METHOD BookClose( )
#endif
::aReport[ BOOKMARK ] := nil
RETURN self
| hbvpdft.prg | 380 |
METHOD TPDF | BookOpen( )
METHOD tPdf:BookOpen( )
| hbvpdft.prg | 390 |
METHOD | BookOpen( )
METHOD BookOpen( )
#endif
::aReport[ BOOKMARK ] := {}
RETURN self
| hbvpdft.prg | 392 |
METHOD TPDF | Box( x1, y1, x2, y2, nBorder, nShade, cUnits, cColor, cId )
METHOD tPdf:Box( x1, y1, x2, y2, nBorder, nShade, cUnits, cColor, cId )
| hbvpdft.prg | 402 |
METHOD | Box( x1, y1, x2, y2, nBorder, nShade, cUnits, cColor, cId )
METHOD Box( x1, y1, x2, y2, nBorder, nShade, cUnits, cColor, cId )
#endif
local cBoxColor
DEFAULT nBorder TO 0
DEFAULT nShade TO 0
DEFAULT cUnits TO "M"
DEFAULT cColor TO ""
cBoxColor := ""
IF !empty( cColor )
cBoxColor := " " + Chr_RGB( substr( cColor, 2, 1 )) + " " + ;
Chr_RGB( substr( cColor, 3, 1 )) + " " + ;
Chr_RGB( substr( cColor, 4, 1 )) + " rg "
IF empty( alltrim( cBoxColor ) )
cBoxColor := ""
ENDIF
ENDIF
IF ::aReport[ HEADEREDIT ]
return ::Header( "PDFBOX", cId, { x1, y1, x2, y2, nBorder, nShade, cUnits } )
ENDIF
IF cUnits == "M"
y1 += 0.5
y2 += 0.5
IF nShade > 0
::aReport[ PAGEBUFFER ] += CRLF + transform( 1.00 - nShade / 100.00, "9.99") + " g " + cBoxColor + ltrim(str(::M2X( y1 ))) + " " + ltrim(str(::M2Y( x1 ))) + " " + ltrim(str(::M2X( y2 - y1 ))) + " -" + ltrim(str(::M2X( x2 - x1 ))) + " re f 0 g"
ENDIF
IF nBorder > 0
::aReport[ PAGEBUFFER ] += CRLF + "0 g " + ltrim(str(::M2X( y1 ))) + " " + ltrim(str(::M2Y( x1 ))) + " " + ltrim(str(::M2X( y2 - y1 ))) + " -" + ltrim(str(::M2X( nBorder ))) + " re f"
::aReport[ PAGEBUFFER ] += CRLF + "0 g " + ltrim(str(::M2X( y2 - nBorder ))) + " " + ltrim(str(::M2Y( x1 ))) + " " + ltrim(str(::M2X( nBorder ))) + " -" + ltrim(str(::M2X( x2 - x1 ))) + " re f"
::aReport[ PAGEBUFFER ] += CRLF + "0 g " + ltrim(str(::M2X( y1 ))) + " " + ltrim(str(::M2Y( x2 - nBorder ))) + " " + ltrim(str(::M2X( y2 - y1 ))) + " -" + ltrim(str(::M2X( nBorder ))) + " re f"
::aReport[ PAGEBUFFER ] += CRLF + "0 g " + ltrim(str(::M2X( y1 ))) + " " + ltrim(str(::M2Y( x1 ))) + " " + ltrim(str(::M2X( nBorder ))) + " -" + ltrim(str(::M2X( x2 - x1 ))) + " re f"
ENDIF
ELSEIF cUnits == "D" // "Dots"
IF nShade > 0
::aReport[ PAGEBUFFER ] += CRLF + transform( 1.00 - nShade / 100.00, "9.99") + " g " + cBoxColor + ltrim(str( y1 )) + " " + ltrim(str( ::aReport[ PAGEY ] - x1 )) + " " + ltrim(str( y2 - y1 )) + " -" + ltrim(str( x2 - x1 )) + " re f 0 g"
ENDIF
IF nBorder > 0
/*
1
ÚÄÄÄÄÄ¿
4 ³ ³ 2
ÀÄÄÄÄÄÙ
3
*/
::aReport[ PAGEBUFFER ] += CRLF + "0 g " + ltrim(str( y1 )) + " " + ltrim(str( ::aReport[ PAGEY ] - x1 )) + " " + ltrim(str( y2 - y1 )) + " -" + ltrim(str( nBorder )) + " re f"
::aReport[ PAGEBUFFER ] += CRLF + "0 g " + ltrim(str( y2 - nBorder )) + " " + ltrim(str( ::aReport[ PAGEY ] - x1 )) + " " + ltrim(str( nBorder )) + " -" + ltrim(str( x2 - x1 )) + " re f"
::aReport[ PAGEBUFFER ] += CRLF + "0 g " + ltrim(str( y1 )) + " " + ltrim(str( ::aReport[ PAGEY ] - x2 + nBorder )) + " " + ltrim(str( y2 - y1 )) + " -" + ltrim(str( nBorder )) + " re f"
::aReport[ PAGEBUFFER ] += CRLF + "0 g " + ltrim(str( y1 )) + " " + ltrim(str( ::aReport[ PAGEY ] - x1 )) + " " + ltrim(str( nBorder )) + " -" + ltrim(str( x2 - x1 )) + " re f"
ENDIF
ENDIF
RETURN self
| hbvpdft.prg | 404 |
METHOD TPDF | Box1( nTop, nLeft, nBottom, nRight, nBorderWidth, cBorderColor, cBoxColor )
METHOD tPdf:Box1( nTop, nLeft, nBottom, nRight, nBorderWidth, cBorderColor, cBoxColor )
| hbvpdft.prg | 466 |
METHOD | Box1( nTop, nLeft, nBottom, nRight, nBorderWidth, cBorderColor, cBoxColor )
METHOD Box1( nTop, nLeft, nBottom, nRight, nBorderWidth, cBorderColor, cBoxColor )
#endif
DEFAULT nBorderWidth to 0.5
DEFAULT cBorderColor to chr(0) + chr(0) + chr(0)
DEFAULT cBoxColor to chr(255) + chr(255) + chr(255)
::aReport[ PAGEBUFFER ] += CRLF + ;
Chr_RGB( substr( cBorderColor, 1, 1 )) + " " + ;
Chr_RGB( substr( cBorderColor, 2, 1 )) + " " + ;
Chr_RGB( substr( cBorderColor, 3, 1 )) + ;
" RG" + ;
CRLF + ;
Chr_RGB( substr( cBoxColor, 1, 1 )) + " " + ;
Chr_RGB( substr( cBoxColor, 2, 1 )) + " " + ;
Chr_RGB( substr( cBoxColor, 3, 1 )) + ;
" rg" + ;
CRLF + ltrim(str( nBorderWidth )) + " w" + ;
CRLF + ltrim( str ( nLeft + nBorderWidth / 2 )) + " " + ;
CRLF + ltrim( str ( ::aReport[ PAGEY ] - nBottom + nBorderWidth / 2)) + " " + ;
CRLF + ltrim( str ( nRight - nLeft - nBorderWidth )) + ;
CRLF + ltrim( str ( nBottom - nTop - nBorderWidth )) + " " + ;
" re" + ;
CRLF + "B"
return nil
| hbvpdft.prg | 468 |
METHOD TPDF | Center( cString, nRow, nCol, cUnits, lExact, cId )
METHOD tPdf:Center( cString, nRow, nCol, cUnits, lExact, cId )
| hbvpdft.prg | 497 |
METHOD | Center( cString, nRow, nCol, cUnits, lExact, cId )
METHOD Center( cString, nRow, nCol, cUnits, lExact, cId )
#endif
local nLen, nAt
DEFAULT nRow TO ::aReport[ REPORTLINE ]
DEFAULT cUnits TO "R"
DEFAULT lExact TO .f.
DEFAULT nCol TO IIF( cUnits == "R", ::aReport[ REPORTWIDTH ] / 2, ::aReport[ PAGEX ] / 72 * 25.4 / 2 )
IF ::aReport[ HEADEREDIT ]
return ::Header( "PDFCENTER", cId, { cString, nRow, nCol, cUnits, lExact } )
ENDIF
IF ( nAt := at( "#pagenumber#", cString ) ) > 0
cString := left( cString, nAt - 1 ) + ltrim(str( ::PageNumber())) + substr( cString, nAt + 12 )
ENDIF
nLen := ::length( cString ) / 2
IF cUnits == "R"
IF .not. lExact
::CheckLine( nRow )
nRow := nRow + ::aReport[ PDFTOP]
ENDIF
ENDIF
::AtSay( cString, ::R2M( nRow ), IIF( cUnits == "R", ::aReport[ PDFLEFT ] + ( ::aReport[ PAGEX ] / 72 * 25.4 - 2 * ::aReport[ PDFLEFT ] ) * nCol / ::aReport[ REPORTWIDTH ], nCol ) - nLen, "M", lExact )
RETURN self
| hbvpdft.prg | 499 |
METHOD TPDF | Close()
METHOD tPdf:Close()
| hbvpdft.prg | 529 |
METHOD | Close()
METHOD Close()
#endif
local nI, cTemp, nCurLevel, nObj1, nLast, nCount, nFirst, nRecno, nBooklen
// FIELD FIRST, PREV, NEXT, LAST, COUNT, PARENT, PAGE, COORD, TITLE, LEVEL
::ClosePage()
// kids
::aReport[ REFS ][ 2 ] := ::aReport[ DOCLEN ]
cTemp := ;
"1 0 obj"+CRLF+;
"<<"+CRLF+;
"/Type /Pages /Count " + ltrim(str(::aReport[ REPORTPAGE ])) + CRLF +;
"/Kids ["
for nI := 1 to ::aReport[ REPORTPAGE ]
cTemp += " " + ltrim(str( ::aReport[ PAGES ][ nI ] )) + " 0 R"
next
cTemp += " ]" + CRLF + ;
">>" + CRLF + ;
"endobj" + CRLF
::aReport[ DOCLEN ] += len( cTemp )
fwrite( ::aReport[ HANDLE ], cTemp )
// info
++::aReport[ REPORTOBJ ]
aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] )
cTemp := ltrim(str( ::aReport[ REPORTOBJ ] )) + " 0 obj" + CRLF + ;
"<<" + CRLF + ;
"/Producer ()" + CRLF + ;
"/Title ()" + CRLF + ;
"/Author ()" + CRLF + ;
"/Creator ()" + CRLF + ;
"/Subject ()" + CRLF + ;
"/Keywords ()" + CRLF + ;
"/CreationDate (D:" + str(year(date()), 4) + padl( month(date()), 2, "0") + padl( day(date()), 2, "0") + substr( time(), 1, 2 ) + substr( time(), 4, 2 ) + substr( time(), 7, 2 ) + ")" + CRLF + ;
">>" + CRLF + ;
"endobj" + CRLF
::aReport[ DOCLEN ] += len( cTemp )
fwrite( ::aReport[ HANDLE ], cTemp )
// root
++::aReport[ REPORTOBJ ]
aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] )
cTemp := ltrim(str( ::aReport[ REPORTOBJ ] )) + " 0 obj" + CRLF + ;
"<< /Type /Catalog /Pages 1 0 R /Outlines " + ltrim(str( ::aReport[ REPORTOBJ ] + 1 )) + " 0 R" + IIF( ( nBookLen := len( ::aReport[ BOOKMARK ] )) > 0, " /PageMode /UseOutlines", "") + " >>" + CRLF + "endobj" + CRLF
::aReport[ DOCLEN ] += len( cTemp )
fwrite( ::aReport[ HANDLE ], cTemp )
++::aReport[ REPORTOBJ ]
nObj1 := ::aReport[ REPORTOBJ ]
IF nBookLen > 0
nRecno := 1
nFirst := ::aReport[ REPORTOBJ ] + 1
nLast := 0
nCount := 0
while nRecno <= nBookLen
nCurLevel := ::aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
::aReport[ BOOKMARK ][ nRecno ][ BOOKPARENT ] := ::BookParent( nRecno, nCurLevel, ::aReport[ REPORTOBJ ] )
::aReport[ BOOKMARK ][ nRecno ][ BOOKPREV ] := ::BookPrev( nRecno, nCurLevel, ::aReport[ REPORTOBJ ] )
::aReport[ BOOKMARK ][ nRecno ][ BOOKNEXT ] := ::BookNext( nRecno, nCurLevel, ::aReport[ REPORTOBJ ] )
::aReport[ BOOKMARK ][ nRecno ][ BOOKFIRST ] := ::BookFirst( nRecno, nCurLevel, ::aReport[ REPORTOBJ ] )
::aReport[ BOOKMARK ][ nRecno ][ BOOKLAST ] := ::BookLast( nRecno, nCurLevel, ::aReport[ REPORTOBJ ] )
::aReport[ BOOKMARK ][ nRecno ][ BOOKCOUNT ] := ::BookCount( nRecno, nCurLevel )
IF nCurLevel == 1
nLast := nRecno
++nCount
ENDIF
++nRecno
enddo
nLast += ::aReport[ REPORTOBJ ]
cTemp := ltrim(str( ::aReport[ REPORTOBJ ] )) + " 0 obj" + CRLF + "<< /Type /Outlines /Count " + ltrim(str( nCount )) + " /First " + ltrim(str( nFirst )) + " 0 R /Last " + ltrim(str( nLast )) + " 0 R >>" + CRLF + "endobj" //+ CRLF
aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] )
::aReport[ DOCLEN ] += len( cTemp )
fwrite( ::aReport[ HANDLE ], cTemp )
++::aReport[ REPORTOBJ ]
nRecno := 1
FOR nI := 1 to nBookLen
//cTemp := IIF ( nI > 1, CRLF, "") + ltrim(str( ::aReport[ REPORTOBJ ] + nI - 1)) + " 0 obj" + CRLF + ;
cTemp := CRLF + ltrim(str( ::aReport[ REPORTOBJ ] + nI - 1)) + " 0 obj" + CRLF + ;
"<<" + CRLF + ;
"/Parent " + ltrim(str( ::aReport[ BOOKMARK ][ nRecno ][ BOOKPARENT ])) + " 0 R" + CRLF + ;
"/Dest [" + ltrim(str( ::aReport[ PAGES ][ ::aReport[ BOOKMARK ][ nRecno ][ BOOKPAGE ] ] )) + " 0 R /XYZ 0 " + ltrim( str( ::aReport[ BOOKMARK ][ nRecno ][ BOOKCOORD ])) + " 0]" + CRLF + ;
"/Title (" + alltrim( ::aReport[ BOOKMARK ][ nRecno ][ BOOKTITLE ]) + ")" + CRLF + ;
IIF( ::aReport[ BOOKMARK ][ nRecno ][ BOOKPREV ] > 0, "/Prev " + ltrim(str( ::aReport[ BOOKMARK ][ nRecno ][ BOOKPREV ])) + " 0 R" + CRLF, "") + ;
IIF( ::aReport[ BOOKMARK ][ nRecno ][ BOOKNEXT ] > 0, "/Next " + ltrim(str( ::aReport[ BOOKMARK ][ nRecno ][ BOOKNEXT ])) + " 0 R" + CRLF, "") + ;
IIF( ::aReport[ BOOKMARK ][ nRecno ][ BOOKFIRST ] > 0, "/First " + ltrim(str( ::aReport[ BOOKMARK ][ nRecno ][ BOOKFIRST ])) + " 0 R" + CRLF, "") + ;
IIF( ::aReport[ BOOKMARK ][ nRecno ][ BOOKLAST ] > 0, "/Last " + ltrim(str( ::aReport[ BOOKMARK ][ nRecno ][ BOOKLAST ])) + " 0 R" + CRLF, "") + ;
IIF( ::aReport[ BOOKMARK ][ nRecno ][ BOOKCOUNT ] != 0, "/Count " + ltrim(str( ::aReport[ BOOKMARK ][ nRecno ][ BOOKCOUNT ])) + CRLF, "") + ;
">>" + CRLF + "endobj" + CRLF
// "/Dest [" + ltrim(str( ::aReport[ BOOKMARK ][ nRecno ][ BOOKPAGE ] * 3 )) + " 0 R /XYZ 0 " + ltrim( str( ::aReport[ BOOKMARK ][ nRecno ][ BOOKCOORD ])) + " 0]" + CRLF + ;
// "/Dest [" + ltrim(str( ::aReport[ PAGES ][ nRecno ] )) + " 0 R /XYZ 0 " + ltrim( str( ::aReport[ BOOKMARK ][ nRecno ][ BOOKCOORD ])) + " 0]" + CRLF + ;
aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] + 2 )
::aReport[ DOCLEN ] += len( cTemp )
fwrite( ::aReport[ HANDLE ], cTemp )
++nRecno
NEXT
::BookClose()
::aReport[ REPORTOBJ ] += nBookLen - 1
ELSE
cTemp := ltrim(str( ::aReport[ REPORTOBJ ] )) + " 0 obj" + CRLF + "<< /Type /Outlines /Count 0 >>" + CRLF + "endobj" + CRLF
aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] )
::aReport[ DOCLEN ] += len( cTemp )
fwrite( ::aReport[ HANDLE ], cTemp )
ENDIF
cTemp := CRLF
::aReport[ DOCLEN ] += len( cTemp )
++::aReport[ REPORTOBJ ]
cTemp += "xref" + CRLF + ;
"0 " + ltrim(str( ::aReport[ REPORTOBJ ] )) + CRLF +;
padl( ::aReport[ REFS ][ 1 ], 10, "0") + " 65535 f" + CRLF
for nI := 2 to len( ::aReport[ REFS ] )
cTemp += padl( ::aReport[ REFS ][ nI ], 10, "0") + " 00000 n" + CRLF
next
cTemp += "trailer << /Size " + ltrim(str( ::aReport[ REPORTOBJ ] )) + " /Root " + ltrim(str( nObj1 - 1 )) + " 0 R /Info " + ltrim(str( nObj1 - 2 )) + " 0 R >>" + CRLF + ;
"startxref" + CRLF + ;
ltrim(str( ::aReport[ DOCLEN ] )) + CRLF + ;
"%%EOF" + CRLF
fwrite( ::aReport[ HANDLE ], cTemp )
fclose( ::aReport[ HANDLE ] )
::aReport := nil
RETURN self
| hbvpdft.prg | 531 |
METHOD TPDF | Image( cFile, nRow, nCol, cUnits, nHeight, nWidth, cId )
METHOD tPdf:Image( cFile, nRow, nCol, cUnits, nHeight, nWidth, cId )
| hbvpdft.prg | 675 |
METHOD | Image( cFile, nRow, nCol, cUnits, nHeight, nWidth, cId )
METHOD Image( cFile, nRow, nCol, cUnits, nHeight, nWidth, cId )
#endif
DEFAULT nRow TO ::aReport[ REPORTLINE ]
DEFAULT nCol TO 0
DEFAULT nHeight TO 0
DEFAULT nWidth TO 0
DEFAULT cUnits TO "R"
DEFAULT cId TO ""
IF ::aReport[ HEADEREDIT ]
return ::Header( "PDFIMAGE", cId, { cFile, nRow, nCol, cUnits, nHeight, nWidth } )
ENDIF
IF cUnits == "M"
nRow := ::aReport[ PAGEY ] - ::M2Y( nRow )
nCol := ::M2X( nCol )
nHeight := ::aReport[ PAGEY ] - ::M2Y( nHeight )
nWidth := ::M2X( nWidth )
ELSEIF cUnits == "R"
//IF .not. lExact
// ::CheckLine( nRow )
// nRow := nRow + ::aReportStyle[ PDFTOP]
//ENDIF
nRow := ::aReport[ PAGEY ] - ::R2D( nRow )
nCol := ::M2X( ::aReport[ PDFLEFT ] ) + ;
nCol * 100.00 / ::aReport[ REPORTWIDTH ] * ;
( ::aReport[ PAGEX ] - ::M2X( ::aReport[ PDFLEFT ] ) * 2 - 9.0 ) / 100.00
nHeight := ::aReport[ PAGEY ] - ::R2D( nHeight )
nWidth := ::M2X( ::aReport[ PDFLEFT ] ) + ;
nWidth * 100.00 / ::aReport[ REPORTWIDTH ] * ;
( ::aReport[ PAGEX ] - ::M2X( ::aReport[ PDFLEFT ] ) * 2 - 9.0 ) / 100.00
ELSEIF cUnits == "D"
ENDIF
aadd( ::aReport[ PAGEIMAGES ], { cFile, nRow, nCol, nHeight, nWidth } )
RETURN self
| hbvpdft.prg | 677 |
METHOD TPDF | Length( cString )
METHOD tPdf:Length( cString )
| hbvpdft.prg | 719 |
METHOD | Length( cString )
METHOD Length( cString )
#endif
local nWidth := 0.00, nI, nLen, nArr, nAdd := ( ::aReport[ FONTNAME ] - 1 ) % 4
nLen := len( cString )
IF right( cString, 1 ) == chr( 255 ) .or. right( cString, 1 ) == chr( 254 )
--nLen
ENDIF
IF ::GetFontInfo("NAME") = "Times"
nArr := 1
ELSEIF ::GetFontInfo("NAME") = "Helvetica"
nArr := 2
ELSE
nArr := 3
ENDIF
For nI:= 1 To nLen
nWidth += ::aReport[ FONTWIDTH ][ nArr ][ ( asc( substr( cString, nI, 1 )) - 32 ) * 4 + 1 + nAdd ] * 25.4 * ::aReport[ FONTSIZE ] / 720.00 / 100.00
Next
RETURN nWidth
| hbvpdft.prg | 721 |
METHOD TPDF | NewLine( n )
METHOD tPdf:NewLine( n )
| hbvpdft.prg | 746 |
METHOD | NewLine( n )
METHOD NewLine( n )
#endif
DEFAULT n TO 1
IF ::aReport[ REPORTLINE ] + n + ::aReport[ PDFTOP] > ::aReport[ PDFBOTTOM ]
::NewPage()
::aReport[ REPORTLINE ] += 1
ELSE
::aReport[ REPORTLINE ] += n
ENDIF
RETURN ::aReport[ REPORTLINE ]
| hbvpdft.prg | 748 |
METHOD TPDF | NewPage( _cPageSize, _cPageOrient, _nLpi, _cFontName, _nFontType, _nFontSize )
METHOD tPdf:NewPage( _cPageSize, _cPageOrient, _nLpi, _cFontName, _nFontType, _nFontSize )
| hbvpdft.prg | 764 |
METHOD | NewPage( _cPageSize, _cPageOrient, _nLpi, _cFontName, _nFontType, _nFontSize )
METHOD NewPage( _cPageSize, _cPageOrient, _nLpi, _cFontName, _nFontType, _nFontSize )
#endif
local nAdd := 76.2
DEFAULT _cPageSize TO ::aReport[ PAGESIZE ]
DEFAULT _cPageOrient TO ::aReport[ PAGEORIENT ]
DEFAULT _nLpi TO ::aReport[ LPI ]
DEFAULT _cFontName TO ::GetFontInfo( "NAME" )
DEFAULT _nFontType TO ::GetFontInfo( "TYPE" )
DEFAULT _nFontSize TO ::aReport[ FONTSIZE ]
IF !empty( ::aReport[ PAGEBUFFER ] )
::ClosePage()
ENDIF
::aReport[ PAGEFONTS ] := {}
::aReport[ PAGEIMAGES ] := {}
++::aReport[ REPORTPAGE ]
::PageSize( _cPageSize )
::PageOrient( _cPageOrient )
::SetLPI( _nLpi )
::SetFont( _cFontName, _nFontType, _nFontSize )
::DrawHeader()
::aReport[ REPORTLINE ] := 0
::aReport[ FONTNAMEPREV ] := 0
::aReport[ FONTSIZEPREV ] := 0
RETURN self
| hbvpdft.prg | 766 |
METHOD TPDF | PageSize( _cPageSize )
METHOD tPdf:PageSize( _cPageSize )
| hbvpdft.prg | 804 |
METHOD | PageSize( _cPageSize )
METHOD PageSize( _cPageSize )
#endif
local nSize, aSize := { { "LETTER", 8.50, 11.00 }, ;
{ "LEGAL" , 8.50, 14.00 }, ;
{ "LEDGER", 11.00, 17.00 }, ;
{ "EXECUTIVE", 7.25, 10.50 }, ;
{ "A4", 8.27, 11.69 }, ;
{ "A3", 11.69, 16.54 }, ;
{ "JIS B4", 10.12, 14.33 }, ;
{ "JIS B5", 7.16, 10.12 }, ;
{ "JPOST", 3.94, 5.83 }, ;
{ "JPOSTD", 5.83, 7.87 }, ;
{ "COM10", 4.12, 9.50 }, ;
{ "MONARCH", 3.87, 7.50 }, ;
{ "C5", 6.38, 9.01 }, ;
{ "DL", 4.33, 8.66 }, ;
{ "B5", 6.93, 9.84 } }
DEFAULT _cPageSize TO "LETTER"
nSize := ascan( aSize, { |arr| arr[ 1 ] = _cPageSize } )
IF nSize == 0 .or. nSize > 2
nSize := 1
ENDIF
::aReport[ PAGESIZE ] := aSize[ nSize ][ 1 ]
IF ::aReport[ PAGEORIENT ] = "P"
::aReport[ PAGEX ] := aSize[ nSize ][ 2 ] * 72
::aReport[ PAGEY ] := aSize[ nSize ][ 3 ] * 72
ELSE
::aReport[ PAGEX ] := aSize[ nSize ][ 3 ] * 72
::aReport[ PAGEY ] := aSize[ nSize ][ 2 ] * 72
ENDIF
RETURN self
| hbvpdft.prg | 806 |
METHOD TPDF | PageOrient( _cPageOrient )
METHOD tPdf:PageOrient( _cPageOrient )
| hbvpdft.prg | 848 |
METHOD | PageOrient( _cPageOrient )
METHOD PageOrient( _cPageOrient )
#endif
DEFAULT _cPageOrient TO "P"
::aReport[ PAGEORIENT ] := _cPageOrient
::PageSize( ::aReport[ PAGESIZE ] )
RETURN self
| hbvpdft.prg | 850 |
METHOD TPDF | PageNumber( n )
METHOD tPdf:PageNumber( n )
| hbvpdft.prg | 862 |
METHOD | PageNumber( n )
METHOD PageNumber( n )
#endif
DEFAULT n TO 0
IF n > 0
::aReport[ REPORTPAGE ] := n // NEW !!!
ENDIF
RETURN ::aReport[ REPORTPAGE ]
| hbvpdft.prg | 864 |
METHOD TPDF | Reverse( cString )
METHOD tPdf:Reverse( cString )
| hbvpdft.prg | 876 |
METHOD | Reverse( cString )
METHOD Reverse( cString )
#endif
RETURN cString + chr(255)
| hbvpdft.prg | 878 |
METHOD TPDF | RJust( cString, nRow, nCol, cUnits, lExact, cId )
METHOD tPdf:RJust( cString, nRow, nCol, cUnits, lExact, cId )
| hbvpdft.prg | 886 |
METHOD | RJust( cString, nRow, nCol, cUnits, lExact, cId )
METHOD RJust( cString, nRow, nCol, cUnits, lExact, cId )
#endif
local nLen, nAdj := 1.0, nAt
DEFAULT nRow TO ::aReport[ REPORTLINE ]
DEFAULT cUnits TO "R"
DEFAULT lExact TO .f.
IF ::aReport[ HEADEREDIT ]
return ::Header( "PDFRJUST", cId, { cString, nRow, nCol, cUnits, lExact } )
ENDIF
IF ( nAt := at( "#pagenumber#", cString ) ) > 0
cString := left( cString, nAt - 1 ) + ltrim(str( ::PageNumber())) + substr( cString, nAt + 12 )
ENDIF
nLen := ::length( cString )
IF cUnits == "R"
IF .not. lExact
::CheckLine( nRow )
nRow := nRow + ::aReport[ PDFTOP]
ENDIF
ENDIF
::AtSay( cString, ::R2M( nRow ), IIF( cUnits == "R", ::aReport[ PDFLEFT ] + ( ::aReport[ PAGEX ] / 72 * 25.4 - 2 * ::aReport[ PDFLEFT ] ) * nCol / ::aReport[ REPORTWIDTH ] - nAdj, nCol ) - nLen, "M", lExact )
RETURN self
| hbvpdft.prg | 888 |
METHOD TPDF | SetFont( _cFont, _nType, _nSize, cId )
METHOD tPdf:SetFont( _cFont, _nType, _nSize, cId )
| hbvpdft.prg | 919 |
METHOD | SetFont( _cFont, _nType, _nSize, cId )
METHOD SetFont( _cFont, _nType, _nSize, cId )
#endif
DEFAULT _cFont TO "Times"
DEFAULT _nType TO 0
DEFAULT _nSize TO 10
IF ::aReport[ HEADEREDIT ]
return ::Header( "PDFSETFONT", cId, { _cFont, _nType, _nSize } )
ENDIF
_cFont := upper( _cFont )
::aReport[ FONTSIZE ] := _nSize
IF _cFont == "TIMES"
::aReport[ FONTNAME ] := _nType + 1
ELSEIF _cFont == "HELVETICA"
::aReport[ FONTNAME ] := _nType + 5
ELSE
::aReport[ FONTNAME ] := _nType + 9 // 0.04
ENDIF
aadd( ::aReport[ PAGEFONTS ], ::aReport[ FONTNAME ] )
IF ascan( ::aReport[ FONTS ], { |arr| arr[1] == ::aReport[ FONTNAME ] } ) == 0
aadd( ::aReport[ FONTS ], { ::aReport[ FONTNAME ], ++::aReport[ NEXTOBJ ] } )
ENDIF
RETURN self
| hbvpdft.prg | 921 |
METHOD TPDF | SetLPI(_nLpi)
METHOD tPdf:SetLPI(_nLpi)
| hbvpdft.prg | 953 |
METHOD | SetLPI(_nLpi)
METHOD SetLPI(_nLpi)
#endif
local cLpi := alltrim(str(_nLpi))
DEFAULT _nLpi TO 6
cLpi := iif(cLpi$"1;2;3;4;6;8;12;16;24;48",cLpi,"6")
::aReport[ LPI ] := val( cLpi )
::PageSize( ::aReport[ PAGESIZE ] )
RETURN self
| hbvpdft.prg | 955 |
METHOD TPDF | StringB( cString )
METHOD tPdf:StringB( cString )
| hbvpdft.prg | 970 |
METHOD | StringB( cString )
METHOD StringB( cString )
#endif
cString := strtran( cString, "(", "\(" )
cString := strtran( cString, ")", "\)" )
RETURN cString
| hbvpdft.prg | 972 |
METHOD TPDF | TextCount( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits )
METHOD tPdf:TextCount( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits )
| hbvpdft.prg | 983 |
METHOD | TextCount( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits )
METHOD TextCount( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits )
#endif
RETURN ::Text( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits, .f. )
| hbvpdft.prg | 985 |
METHOD TPDF | Text( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits, cColor, lPrint )
METHOD tPdf:Text( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits, cColor, lPrint )
| hbvpdft.prg | 993 |
METHOD | Text( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits, cColor, lPrint )
METHOD Text( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits, cColor, lPrint )
#endif
local cDelim := chr(0)+chr(9)+chr(10)+chr(13)+chr(26)+chr(32)+chr(138)+chr(141)
local nI, cTemp, cToken, k, nL, nRow, nLines, nLineLen, nStart
local lParagraph, nSpace, nNew, nTokenLen, nCRLF, nTokens, nLen
DEFAULT nTab TO -1
DEFAULT cUnits TO 'R'
DEFAULT nJustify TO 4
DEFAULT lPrint TO .t.
DEFAULT cColor TO ""
IF cUnits == "M"
nTop := ::M2R( nTop )
ELSEIF cUnits == "R"
nLeft := ::X2M( ::M2X( ::aReport[ PDFLEFT ] ) + ;
nLeft * 100.00 / ::aReport[ REPORTWIDTH ] * ;
( ::aReport[ PAGEX ] - ::M2X( ::aReport[ PDFLEFT ] ) * 2 - 9.0 ) / 100.00 )
ENDIF
::aReport[ REPORTLINE ] := nTop - 1
nSpace := ::length( " " )
nLines := 0
nCRLF := 0
nNew := nTab
cString := alltrim( cString )
nTokens := numtoken( cString, cDelim )
nTokenLen := 0.00
nStart := 1
IF nJustify == 1 .or. nJustify == 4
nLeft := nLeft
ELSEIF nJustify == 2
nLeft := nLeft - nLength / 2
ELSEIF nJustify == 3
nLeft := nLeft - nLength
ENDIF
nL := nLeft
nL += nNew * nSpace
nLineLen := nSpace * nNew - nSpace
lParagraph := .t.
nI := 1
while nI <= nTokens
cToken := token( cString, cDelim, nI )
nTokenLen := ::length( cToken )
nLen := len( cToken )
IF nLineLen + nSpace + nTokenLen > nLength
IF nStart == nI // single word > nLength
k := 1
while k <= nLen
cTemp := ""
nLineLen := 0.00
nL := nLeft
IF lParagraph
nLineLen += nSpace * nNew
IF nJustify != 2
nL += nSpace * nNew
ENDIF
lParagraph := .f.
ENDIF
IF nJustify == 2
nL := nLeft + ( nLength - ::length( cTemp ) ) / 2
ELSEIF nJustify == 3
nL := nLeft + nLength - ::length( cTemp )
ENDIF
while k <= nLen .and. ( ( nLineLen += ::length( substr( cToken, k, 1 ))) <= nLength )
nLineLen += ::length( substr( cToken, k, 1 ))
cTemp += substr( cToken, k, 1 )
++k
enddo
IF empty( cTemp ) // single character > nlength
cTemp := substr( cToken, k, 1 )
++k
ENDIF
++nLines
IF lPrint
nRow := ::NewLine( 1 )
::AtSay( cColor + cTemp, ::R2M( nRow + ::aReport[ PDFTOP] ), nL, "M" )
ENDIF
enddo
++nI
nStart := nI
ELSE
::TextPrint( nI - 1, nLeft, @lParagraph, nJustify, nSpace, nNew, nLength, @nLineLen, @nLines, @nStart, cString, cDelim, cColor, lPrint )
ENDIF
ELSEIF ( nI == nTokens ) .or. ( nI < nTokens .and. ( nCRLF := ::TextNextPara( cString, cDelim, nI ) ) > 0 )
IF nI == nTokens
nLineLen += nSpace + nTokenLen
ENDIF
::TextPrint( nI, nLeft, @lParagraph, nJustify, nSpace, nNew, nLength, @nLineLen, @nLines, @nStart, cString, cDelim, cColor, lPrint )
++nI
IF nCRLF > 1
nLines += nCRLF - 1
ENDIF
IF lPrint
nRow := ::NewLine( nCRLF - 1 )
ENDIF
ELSE
nLineLen += nSpace + nTokenLen
++nI
ENDIF
enddo
RETURN nLines
| hbvpdft.prg | 995 |
METHOD TPDF | UnderLine( cString )
METHOD tPdf:UnderLine( cString )
| hbvpdft.prg | 1112 |
METHOD | UnderLine( cString )
METHOD UnderLine( cString )
#endif
RETURN cString + chr(254)
| hbvpdft.prg | 1114 |
METHOD TPDF | OpenHeader( cFile )
METHOD tPdf:OpenHeader( cFile )
| hbvpdft.prg | 1122 |
METHOD | OpenHeader( cFile )
METHOD OpenHeader( cFile )
#endif
local nErrorCode := 0, nAt, cCmd
DEFAULT cFile TO ''
IF !empty( cFile )
cFile := alltrim( cFile )
IF len( cFile ) > 12 .or. ;
at( ' ', cFile ) > 0 .or. ;
( at( ' ', cFile ) == 0 .and. len( cFile ) > 8 ) .or. ;
( ( nAt := at( '.', cFile )) > 0 .and. len( substr( cFile, nAt + 1 )) > 3 )
cCmd := "copy " + cFile + " temp.tmp > nul"
RunExternal( cCmd )
cFile := "temp.tmp"
ENDIF
// ::aReport[ HEADER ] := FT_RestArr( cFile, @nErrorCode )
::aReport[ HEADER ] := File2Array( cFile )
ELSE
::aReport[ HEADER ] := {}
ENDIF
::aReport[ MARGINS ] := .t.
RETURN self
| hbvpdft.prg | 1124 |
METHOD TPDF | EditOnHeader()
METHOD tPdf:EditOnHeader()
| hbvpdft.prg | 1155 |
METHOD | EditOnHeader()
METHOD EditOnHeader()
#endif
::aReport[ HEADEREDIT ] := .t.
::aReport[ MARGINS ] := .t.
RETURN self
| hbvpdft.prg | 1157 |
METHOD TPDF | EditOffHeader()
METHOD tPdf:EditOffHeader()
| hbvpdft.prg | 1168 |
METHOD | EditOffHeader()
METHOD EditOffHeader()
#endif
::aReport[ HEADEREDIT ] := .f.
::aReport[ MARGINS ] := .t.
RETURN self
| hbvpdft.prg | 1170 |
METHOD TPDF | CloseHeader()
METHOD tPdf:CloseHeader()
| hbvpdft.prg | 1181 |
METHOD | CloseHeader()
METHOD CloseHeader()
#endif
::aReport[ HEADER ] := {}
::aReport[ MARGINS ] := .f.
RETURN self
| hbvpdft.prg | 1183 |
METHOD TPDF | DeleteHeader( cId )
METHOD tPdf:DeleteHeader( cId )
| hbvpdft.prg | 1193 |
METHOD | DeleteHeader( cId )
METHOD DeleteHeader( cId )
#endif
local nRet := -1, nId
cId := upper( cId )
nId := ascan( ::aReport[ HEADER ], {| arr | arr[ 3 ] == cId })
IF nId > 0
nRet := len( ::aReport[ HEADER ] ) - 1
aDel( ::aReport[ HEADER ], nId )
aSize( ::aReport[ HEADER ], nRet )
::aReport[ MARGINS ] := .t.
ENDIF
RETURN nRet
| hbvpdft.prg | 1195 |
METHOD TPDF | EnableHeader( cId )
METHOD tPdf:EnableHeader( cId )
| hbvpdft.prg | 1212 |
METHOD | EnableHeader( cId )
METHOD EnableHeader( cId )
#endif
local nId
cId := upper( cId )
nId := ascan( ::aReport[ HEADER ], {| arr | arr[ 3 ] == cId })
IF nId > 0
::aReport[ HEADER ][ nId ][ 1 ] := .t.
::aReport[ MARGINS ] := .t.
ENDIF
RETURN self
| hbvpdft.prg | 1214 |
METHOD TPDF | DisableHeader( cId )
METHOD tPdf:DisableHeader( cId )
| hbvpdft.prg | 1229 |
METHOD | DisableHeader( cId )
METHOD DisableHeader( cId )
#endif
local nId
cId := upper( cId )
nId := ascan( ::aReport[ HEADER ], {| arr | arr[ 3 ] == cId })
IF nId > 0
::aReport[ HEADER ][ nId ][ 1 ] := .f.
::aReport[ MARGINS ] := .t.
ENDIF
RETURN self
| hbvpdft.prg | 1231 |
METHOD TPDF | SaveHeader( cFile )
METHOD tPdf:SaveHeader( cFile )
| hbvpdft.prg | 1246 |
METHOD | SaveHeader( cFile )
METHOD SaveHeader( cFile )
#endif
local nErrorCode := 0, cCmd
Array2File( 'temp.tmp', ::aReport[ HEADER ] )
cCmd := "copy temp.tmp " + cFile + " > nul"
RunExternal( cCmd )
RETURN self
| hbvpdft.prg | 1248 |
METHOD TPDF | Header( cFunction, cId, arr )
METHOD tPdf:Header( cFunction, cId, arr )
| hbvpdft.prg | 1263 |
METHOD | Header( cFunction, cId, arr )
METHOD Header( cFunction, cId, arr )
#endif
local nId, nI, nLen, nIdLen
nId := 0
IF !empty( cId )
cId := upper( cId )
nId := ascan( ::aReport[ HEADER ], {| arr | arr[ 3 ] == cId })
ENDIF
IF nId == 0
nLen := len( ::aReport[ HEADER ] )
IF empty( cId )
cId := cFunction
nIdLen := len( cId )
for nI := 1 to nLen
IF ::aReport[ HEADER ][ nI ][ 2 ] == cId
IF val( substr( ::aReport[ HEADER ][ nI ][ 3 ], nIdLen + 1 ) ) > nId
nId := val( substr( ::aReport[ HEADER ][ nI ][ 3 ], nIdLen + 1 ) )
ENDIF
ENDIF
next
++nId
cId += ltrim(str(nId))
ENDIF
aadd( ::aReport[ HEADER ], { .t., cFunction, cId } )
++nLen
for nI := 1 to len( arr )
aadd( ::aReport[ HEADER ][ nLen ], arr[ nI ] )
next
ELSE
aSize( ::aReport[ HEADER ][ nId ], 3 )
for nI := 1 to len( arr )
aadd( ::aReport[ HEADER ][ nId ], arr[ nI ] )
next
ENDIF
RETURN cId
| hbvpdft.prg | 1265 |
METHOD TPDF | DrawHeader()
METHOD tPdf:DrawHeader()
| hbvpdft.prg | 1305 |
METHOD | DrawHeader()
METHOD DrawHeader()
#endif
local nI, _nFont, _nSize, nLen := len( ::aReport[ HEADER ] )
IF nLen > 0
// save font
_nFont := ::aReport[ FONTNAME ]
_nSize := ::aReport[ FONTSIZE ]
for nI := 1 to nLen
IF ::aReport[ HEADER ][ nI ][ 1 ] // enabled
do case
case ::aReport[ HEADER ][ nI ][ 2 ] == "PDFATSAY"
::AtSay( ::aReport[ HEADER ][ nI ][ 4 ], ::aReport[ HEADER ][ nI ][ 5 ], ::aReport[ HEADER ][ nI ][ 6 ], ::aReport[ HEADER ][ nI ][ 7 ], ::aReport[ HEADER ][ nI ][ 8 ], ::aReport[ HEADER ][ nI ][ 3 ] )
case ::aReport[ HEADER ][ nI ][ 2 ] == "PDFCENTER"
::Center( ::aReport[ HEADER ][ nI ][ 4 ], ::aReport[ HEADER ][ nI ][ 5 ], ::aReport[ HEADER ][ nI ][ 6 ], ::aReport[ HEADER ][ nI ][ 7 ], ::aReport[ HEADER ][ nI ][ 8 ], ::aReport[ HEADER ][ nI ][ 3 ] )
case ::aReport[ HEADER ][ nI ][ 2 ] == "PDFRJUST"
::RJust( ::aReport[ HEADER ][ nI ][ 4 ], ::aReport[ HEADER ][ nI ][ 5 ], ::aReport[ HEADER ][ nI ][ 6 ], ::aReport[ HEADER ][ nI ][ 7 ], ::aReport[ HEADER ][ nI ][ 8 ], ::aReport[ HEADER ][ nI ][ 3 ] )
case ::aReport[ HEADER ][ nI ][ 2 ] == "PDFBOX"
::Box( ::aReport[ HEADER ][ nI ][ 4 ], ::aReport[ HEADER ][ nI ][ 5 ], ::aReport[ HEADER ][ nI ][ 6 ], ::aReport[ HEADER ][ nI ][ 7 ], ::aReport[ HEADER ][ nI ][ 8 ], ::aReport[ HEADER ][ nI ][ 9 ], ::aReport[ HEADER ][ nI ][ 10 ], ::aReport[ HEADER ][ nI ][ 3 ] )
case ::aReport[ HEADER ][ nI ][ 2 ] == "PDFSETFONT"
::SetFont( ::aReport[ HEADER ][ nI ][ 4 ], ::aReport[ HEADER ][ nI ][ 5 ], ::aReport[ HEADER ][ nI ][ 6 ], ::aReport[ HEADER ][ nI ][ 3 ] )
case ::aReport[ HEADER ][ nI ][ 2 ] == "PDFIMAGE"
::Image( ::aReport[ HEADER ][ nI ][ 4 ], ::aReport[ HEADER ][ nI ][ 5 ], ::aReport[ HEADER ][ nI ][ 6 ], ::aReport[ HEADER ][ nI ][ 7 ], ::aReport[ HEADER ][ nI ][ 8 ], ::aReport[ HEADER ][ nI ][ 9 ], ::aReport[ HEADER ][ nI ][ 3 ] )
endcase
ENDIF
next
::aReport[ FONTNAME ] := _nFont
::aReport[ FONTSIZE ] := _nSize
IF ::aReport[ MARGINS ]
::Margins()
ENDIF
ELSE
IF ::aReport[ MARGINS ]
::aReport[ PDFTOP] := 1 // top
::aReport[ PDFLEFT ] := 10 // left & right
::aReport[ PDFBOTTOM ] := ::aReport[ PAGEY ] / 72 * ::aReport[ LPI ] - 1 // bottom, default "LETTER", "P", 6
::aReport[ MARGINS ] := .f.
ENDIF
ENDIF
RETURN self
| hbvpdft.prg | 1307 |
METHOD TPDF | Margins( nTop, nLeft, nBottom )
METHOD tPdf:Margins( nTop, nLeft, nBottom )
| hbvpdft.prg | 1363 |
METHOD | Margins( nTop, nLeft, nBottom )
METHOD Margins( nTop, nLeft, nBottom )
#endif
local nI, nLen := len( ::aReport[ HEADER ] ), nTemp, aTemp, nHeight
for nI := 1 to nLen
IF ::aReport[ HEADER ][ nI ][ 1 ] // enabled
IF ::aReport[ HEADER ][ nI ][ 2 ] == "PDFSETFONT"
ELSEIF ::aReport[ HEADER ][ nI ][ 2 ] == "PDFIMAGE"
IF ::aReport[ HEADER ][ nI ][ 8 ] == 0 // picture in header, first at all, not at any page yet
aTemp := ::ImageInfo( ::aReport[ HEADER ][ nI ][ 4 ] )
nHeight := aTemp[ IMAGE_HEIGHT ] / aTemp[ IMAGE_YRES ] * 25.4
IF ::aReport[ HEADER ][ nI ][ 7 ] == "D"
nHeight := ::M2X( nHeight )
ENDIF
ELSE
nHeight := ::aReport[ HEADER ][ nI ][ 8 ]
ENDIF
IF ::aReport[ HEADER ][ nI ][ 7 ] == "M"
nTemp := ::aReport[ PAGEY ] / 72 * 25.4 / 2
IF ::aReport[ HEADER ][ nI ][ 5 ] < nTemp
nTemp := ( ::aReport[ HEADER ][ nI ][ 5 ] + nHeight ) * ::aReport[ LPI ] / 25.4 // top
IF nTemp > ::aReport[ PDFTOP]
::aReport[ PDFTOP] := nTemp
ENDIF
ELSE
nTemp := ::aReport[ HEADER ][ nI ][ 5 ] * ::aReport[ LPI ] / 25.4 // top
IF nTemp < ::aReport[ PDFBOTTOM ]
::aReport[ PDFBOTTOM ] := nTemp
ENDIF
ENDIF
ELSEIF ::aReport[ HEADER ][ nI ][ 7 ] == "D"
nTemp := ::aReport[ PAGEY ] / 2
IF ::aReport[ HEADER ][ nI ][ 5 ] < nTemp
nTemp := ( ::aReport[ HEADER ][ nI ][ 5 ] + nHeight ) * ::aReport[ LPI ] / 72 // top
IF nTemp > ::aReport[ PDFTOP]
::aReport[ PDFTOP] := nTemp
ENDIF
ELSE
nTemp := ::aReport[ HEADER ][ nI ][ 5 ] * ::aReport[ LPI ] / 72 // top
IF nTemp < ::aReport[ PDFBOTTOM ]
::aReport[ PDFBOTTOM ] := nTemp
ENDIF
ENDIF
ENDIF
ELSEIF ::aReport[ HEADER ][ nI ][ 2 ] == "PDFBOX"
IF ::aReport[ HEADER ][ nI ][ 10 ] == "M"
nTemp := ::aReport[ PAGEY ] / 72 * 25.4 / 2
IF ::aReport[ HEADER ][ nI ][ 4 ] < nTemp .and. ;
::aReport[ HEADER ][ nI ][ 6 ] < nTemp
nTemp := ::aReport[ HEADER ][ nI ][ 6 ] * ::aReport[ LPI ] / 25.4 // top
IF nTemp > ::aReport[ PDFTOP]
::aReport[ PDFTOP] := nTemp
ENDIF
ELSEIF ::aReport[ HEADER ][ nI ][ 4 ] < nTemp .and. ;
::aReport[ HEADER ][ nI ][ 6 ] > nTemp
nTemp := ( ::aReport[ HEADER ][ nI ][ 4 ] + ::aReport[ HEADER ][ nI ][ 8 ] ) * ::aReport[ LPI ] / 25.4 // top
IF nTemp > ::aReport[ PDFTOP]
::aReport[ PDFTOP] := nTemp
ENDIF
nTemp := ( ::aReport[ HEADER ][ nI ][ 6 ] - ::aReport[ HEADER ][ nI ][ 8 ] ) * ::aReport[ LPI ] / 25.4 // top
IF nTemp < ::aReport[ PDFBOTTOM ]
::aReport[ PDFBOTTOM ] := nTemp
ENDIF
ELSEIF ::aReport[ HEADER ][ nI ][ 4 ] > nTemp .and. ;
::aReport[ HEADER ][ nI ][ 6 ] > nTemp
nTemp := ::aReport[ HEADER ][ nI ][ 4 ] * ::aReport[ LPI ] / 25.4 // top
IF nTemp < ::aReport[ PDFBOTTOM ]
::aReport[ PDFBOTTOM ] := nTemp
ENDIF
ENDIF
ELSEIF ::aReport[ HEADER ][ nI ][ 10 ] == "D"
nTemp := ::aReport[ PAGEY ] / 2
IF ::aReport[ HEADER ][ nI ][ 4 ] < nTemp .and. ;
::aReport[ HEADER ][ nI ][ 6 ] < nTemp
nTemp := ::aReport[ HEADER ][ nI ][ 6 ] / ::aReport[ LPI ] // top
IF nTemp > ::aReport[ PDFTOP]
::aReport[ PDFTOP] := nTemp
ENDIF
ELSEIF ::aReport[ HEADER ][ nI ][ 4 ] < nTemp .and. ;
::aReport[ HEADER ][ nI ][ 6 ] > nTemp
nTemp := ( ::aReport[ HEADER ][ nI ][ 4 ] + ::aReport[ HEADER ][ nI ][ 8 ] ) / ::aReport[ LPI ] // top
IF nTemp > ::aReport[ PDFTOP]
::aReport[ PDFTOP] := nTemp
ENDIF
nTemp := ( ::aReport[ HEADER ][ nI ][ 6 ] - ::aReport[ HEADER ][ nI ][ 8 ] ) / ::aReport[ LPI ] // top
IF nTemp < ::aReport[ PDFBOTTOM ]
::aReport[ PDFBOTTOM ] := nTemp
ENDIF
ELSEIF ::aReport[ HEADER ][ nI ][ 4 ] > nTemp .and. ;
::aReport[ HEADER ][ nI ][ 6 ] > nTemp
nTemp := ::aReport[ HEADER ][ nI ][ 4 ] / ::aReport[ LPI ] // top
IF nTemp < ::aReport[ PDFBOTTOM ]
::aReport[ PDFBOTTOM ] := nTemp
ENDIF
ENDIF
ENDIF
ELSE
IF ::aReport[ HEADER ][ nI ][ 7 ] == "R"
nTemp := ::aReport[ HEADER ][ nI ][ 5 ] // top
IF ::aReport[ HEADER ][ nI ][ 5 ] > ::aReport[ PAGEY ] / 72 * ::aReport[ LPI ] / 2
IF nTemp < ::aReport[ PDFBOTTOM ]
::aReport[ PDFBOTTOM ] := nTemp
ENDIF
ELSE
IF nTemp > ::aReport[ PDFTOP]
::aReport[ PDFTOP] := nTemp
ENDIF
ENDIF
ELSEIF ::aReport[ HEADER ][ nI ][ 7 ] == "M"
nTemp := ::aReport[ HEADER ][ nI ][ 5 ] * ::aReport[ LPI ] / 25.4 // top
IF ::aReport[ HEADER ][ nI ][ 5 ] > ::aReport[ PAGEY ] / 72 * 25.4 / 2
IF nTemp < ::aReport[ PDFBOTTOM ]
::aReport[ PDFBOTTOM ] := nTemp
ENDIF
ELSE
IF nTemp > ::aReport[ PDFTOP]
::aReport[ PDFTOP] := nTemp
ENDIF
ENDIF
ELSEIF ::aReport[ HEADER ][ nI ][ 7 ] == "D"
nTemp := ::aReport[ HEADER ][ nI ][ 5 ] / ::aReport[ LPI ] // top
IF ::aReport[ HEADER ][ nI ][ 5 ] > ::aReport[ PAGEY ] / 2
IF nTemp < ::aReport[ PDFBOTTOM ]
::aReport[ PDFBOTTOM ] := nTemp
ENDIF
ELSE
IF nTemp > ::aReport[ PDFTOP]
::aReport[ PDFTOP] := nTemp
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
next
IF nTop != NIL
::aReport[ PDFTOP] := nTop
ENDIF
IF nLeft != NIL
::aReport[ PDFLEFT ] := nLeft
ENDIF
IF nBottom != NIL
::aReport[ PDFBOTTOM ] := nBottom
ENDIF
::aReport[ MARGINS ] := .f.
RETURN self
| hbvpdft.prg | 1365 |
METHOD TPDF | CreateHeader( _file, _size, _orient, _lpi, _width )
METHOD tPdf:CreateHeader( _file, _size, _orient, _lpi, _width )
| hbvpdft.prg | 1541 |
METHOD | CreateHeader( _file, _size, _orient, _lpi, _width )
METHOD CreateHeader( _file, _size, _orient, _lpi, _width )
#endif
local ;
aReportStyle := { ;
{ 1, 2, 3, 4, 5, 6 }, ; //"Default"
{ 2.475, 4.0, 4.9, 6.4, 7.5, 64.0 }, ; //"P6"
{ 3.3 , 5.4, 6.5, 8.6, 10.0, 85.35 }, ; //"P8"
{ 2.475, 4.0, 4.9, 6.4, 7.5, 48.9 }, ; //"L6"
{ 3.3 , 5.4, 6.5, 8.6, 10.0, 65.2 }, ; //"L8"
{ 2.475, 4.0, 4.9, 6.4, 7.5, 82.0 }, ; //"P6"
{ 3.3 , 5.4, 6.5, 8.6, 10.0, 109.35 } ; //"P8"
}
local nStyle := 1, nAdd := 0.00
DEFAULT _size TO ::aReport[ PAGESIZE ]
DEFAULT _orient TO ::aReport[ PAGEORIENT ]
DEFAULT _lpi TO ::aReport[ LPI ]
DEFAULT _width TO 200
IF _size == "LETTER"
IF _orient == "P"
IF _lpi == 6
nStyle := 2
ELSEIF _lpi == 8
nStyle := 3
ENDIF
ELSEIF _orient == "L"
IF _lpi == 6
nStyle := 4
ELSEIF _lpi == 8
nStyle := 5
ENDIF
ENDIF
ELSEIF _size == "LEGAL"
IF _orient == "P"
IF _lpi == 6
nStyle := 6
ELSEIF _lpi == 8
nStyle := 7
ENDIF
ELSEIF _orient == "L"
IF _lpi == 6
nStyle := 4
ELSEIF _lpi == 8
nStyle := 5
ENDIF
ENDIF
ENDIF
::EditOnHeader()
IF _size == "LEGAL"
nAdd := 76.2
ENDIF
IF _orient == "P"
::Box( 5.0, 5.0, 274.0 + nAdd, 210.0, 1.0 )
::Box( 6.5, 6.5, 272.5 + nAdd, 208.5, 0.5 )
::Box( 11.5, 9.5, 22.0 , 205.5, 0.5, 5 )
::Box( 23.0, 9.5, 33.5 , 205.5, 0.5, 5 )
::Box( 34.5, 9.5, 267.5 + nAdd, 205.5, 0.5 )
ELSE
::Box( 5.0, 5.0, 210.0, 274.0 + nAdd, 1.0 )
::Box( 6.5, 6.5, 208.5, 272.5 + nAdd, 0.5 )
::Box( 11.5, 9.5, 22.0, 269.5 + nAdd, 0.5, 5 )
::Box( 23.0, 9.5, 33.5, 269.5 + nAdd, 0.5, 5 )
::Box( 34.5, 9.5, 203.5, 269.5 + nAdd, 0.5 )
ENDIF
::SetFont("Arial", BOLD, 10)
::AtSay( "Test Line 1", aReportStyle[ nStyle ][ 1 ], 1, "R", .t. )
::SetFont("Times", BOLD, 18)
::Center( "Test Line 2", aReportStyle[ nStyle ][ 2 ],,"R", .t. )
::SetFont("Times", BOLD, 12)
::Center( "Test Line 3", aReportStyle[ nStyle ][ 3 ],,"R", .t. )
::SetFont("Arial", BOLD, 10)
::AtSay( "Test Line 4", aReportStyle[ nStyle ][ 4 ], 1, "R", .t. )
::SetFont("Arial", BOLD, 10)
::AtSay( "Test Line 5", aReportStyle[ nStyle ][ 5 ], 1, "R", .t. )
::AtSay( dtoc( date()) + " " + TimeAsAMPM( time() ), aReportStyle[ nStyle ][ 6 ], 1, "R", .t. )
::RJust( "Page: #pagenumber#", aReportStyle[ nStyle ][ 6 ], ::aReport[ REPORTWIDTH ], "R", .t. )
::EditOffHeader()
::SaveHeader( _file )
RETURN self
| hbvpdft.prg | 1543 |
METHOD TPDF | ImageInfo( cFile )
METHOD tPdf:ImageInfo( cFile )
| hbvpdft.prg | 1641 |
METHOD | ImageInfo( cFile )
METHOD ImageInfo( cFile )
#endif
local cTemp := upper(substr( cFile, rat('.', cFile) + 1 )), aTemp := {}
do case
case cTemp == "TIF"
aTemp := ::TIFFInfo( cFile )
case cTemp == "JPG"
aTemp := ::JPEGInfo( cFile )
endcase
RETURN aTemp
| hbvpdft.prg | 1643 |
METHOD TPDF | TIFFInfo( cFile )
METHOD tPdf:TIFFInfo( cFile )
| hbvpdft.prg | 1658 |
METHOD | TIFFInfo( cFile )
METHOD TIFFInfo( cFile )
#endif
local c40 := chr(0)+chr(0)+chr(0)+chr(0)
local aType := {"BYTE","ASCII","SHORT","LONG","RATIONAL","SBYTE","UNDEFINED","SSHORT","SLONG","SRATIONAL","FLOAT","DOUBLE"}
local aCount := { 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8 }
local nTemp, nHandle, cValues, c2, nFieldType, nCount, nPos, nTag, nValues
local nOffset, cTemp, cIFDNext, nIFD, nFields, cTag, nPages, nn
local nWidth := 0, nHeight := 0, nBits := 0, nFrom := 0, nLength := 0, xRes := 0, yRes := 0, aTemp := {}
nHandle := fopen( cFile )
c2 := ' '
fread( nHandle, @c2, 2 )
fread( nHandle, @c2, 2 )
cIFDNext := ' '
fread( nHandle, @cIFDNext, 4 )
cTemp := space(12)
nPages := 0
while !( cIFDNext == c40 ) //read IFD's
nIFD := bin2l( cIFDNext )
fseek( nHandle, nIFD )
fread( nHandle, @c2, 2 )
nFields := bin2i( c2 )
for nn := 1 to nFields
fread( nHandle, @cTemp, 12 )
nTag := bin2w( substr( cTemp, 1, 2 ) )
nFieldType := bin2w( substr( cTemp, 3, 2 ) )
nCount := bin2l( substr( cTemp, 5, 4 ) )
nOffset := bin2l( substr( cTemp, 9, 4 ) )
IF nCount > 1 .or. nFieldType == RATIONAL .or. nFieldType == SRATIONAL
nPos := filepos( nHandle )
fseek( nHandle, nOffset)
nValues := nCount * aCount[ nFieldType ]
cValues := space( nValues )
fread( nHandle, @cValues, nValues )
fseek( nHandle, nPos )
ELSE
cValues := substr( cTemp, 9, 4 )
ENDIF
IF nFieldType == ASCII
--nCount
ENDIF
cTag := ''
do case
case nTag == 256
cTag := 'ImageWidth'
IF nFieldType == SHORT
nWidth := bin2w( substr( cValues, 1, 2 ))
ELSEIF nFieldType == LONG
nWidth := bin2l( substr( cValues, 1, 4 ))
ENDIF
case nTag == 257
cTag := 'ImageLength'
IF nFieldType == SHORT
nHeight := bin2w(substr( cValues, 1, 2 ))
ELSEIF nFieldType == LONG
nHeight := bin2l(substr( cValues, 1, 4 ))
ENDIF
case nTag == 258
cTag := 'BitsPerSample'
nTemp := 0
IF nFieldType == SHORT
nTemp := bin2w( cValues )
ENDIF
nBits := nTemp
case nTag == 259
cTag := 'Compression'
nTemp := 0
IF nFieldType == SHORT
nTemp := bin2w( cValues )
ENDIF
case nTag == 262
cTag := 'PhotometricInterpretation'
nTemp := -1
IF nFieldType == SHORT
nTemp := bin2w( cValues )
ENDIF
case nTag == 264
cTag := 'CellWidth'
case nTag == 265
cTag := 'CellLength'
case nTag == 266
cTag := 'FillOrder'
case nTag == 273
cTag := 'StripOffsets'
IF nFieldType == SHORT
nFrom := bin2w(substr( cValues, 1, 2 ))
ELSEIF nFieldType == LONG
nFrom := bin2l(substr( cValues, 1, 4 ))
ENDIF
case nTag == 277
cTag := 'SamplesPerPixel'
case nTag == 278
cTag := 'RowsPerStrip'
case nTag == 279
cTag := 'StripByteCounts'
IF nFieldType == SHORT
nLength := bin2w(substr( cValues, 1, 2 ))
ELSEIF nFieldType == LONG
nLength := bin2l(substr( cValues, 1, 4 ))
ENDIF
nLength *= nCount // Count all strips !!!
case nTag == 282
cTag := 'XResolution'
xRes := bin2l(substr( cValues, 1, 4 ))
case nTag == 283
cTag := 'YResolution'
yRes := bin2l(substr( cValues, 1, 4 ))
case nTag == 284
cTag := 'PlanarConfiguration'
case nTag == 288
cTag := 'FreeOffsets'
case nTag == 289
cTag := 'FreeByteCounts'
case nTag == 296
cTag := 'ResolutionUnit'
nTemp := 0
IF nFieldType == SHORT
nTemp := bin2w( cValues )
ENDIF
case nTag == 305
cTag := 'Software'
case nTag == 306
cTag := 'DateTime'
case nTag == 315
cTag := 'Artist'
case nTag == 320
cTag := 'ColorMap'
case nTag == 338
cTag := 'ExtraSamples'
case nTag == 33432
cTag := 'Copyright'
otherwise
cTag := 'Unknown'
endcase
next
fread( nHandle, @cIFDNext, 4 )
enddo
fclose( nHandle )
aadd( aTemp, nWidth )
aadd( aTemp, nHeight )
aadd( aTemp, xRes )
aadd( aTemp, yRes )
aadd( aTemp, nBits )
aadd( aTemp, nFrom )
aadd( aTemp, nLength )
return aTemp
| hbvpdft.prg | 1660 |
METHOD TPDF | JPEGInfo( cFile )
METHOD tPdf:JPEGInfo( cFile )
| hbvpdft.prg | 1833 |
METHOD | JPEGInfo( cFile )
METHOD JPEGInfo( cFile )
#endif
local c255, nAt, nHandle
local nWidth := 0, nHeight := 0, nBits := 8, nFrom := 0
local nLength := 0, xRes := 0, yRes := 0, aTemp := {}
nHandle := fopen( cFile )
c255 := space(1024)
fread( nHandle, @c255, 1024 )
xRes := asc(substr( c255, 15, 1 )) * 256 + asc(substr( c255, 16, 1 ))
yRes := asc( substr( c255, 17, 1 )) * 256 + asc(substr( c255, 18, 1 ))
nAt := at( chr(255) + chr(192), c255 ) + 5
nHeight := asc(substr( c255, nAt, 1 )) * 256 + asc(substr( c255, nAt + 1, 1 ))
nWidth := asc( substr( c255, nAt + 2, 1 )) * 256 + asc(substr( c255, nAt + 3, 1 ))
fclose( nHandle )
nLength := filesize( cFile )
aadd( aTemp, nWidth )
aadd( aTemp, nHeight )
aadd( aTemp, xRes )
aadd( aTemp, yRes )
aadd( aTemp, nBits )
aadd( aTemp, nFrom )
aadd( aTemp, nLength )
return aTemp
| hbvpdft.prg | 1835 |
METHOD TPDF | BookCount( nRecno, nCurLevel )
METHOD tPdf:BookCount( nRecno, nCurLevel )
| hbvpdft.prg | 1871 |
METHOD | BookCount( nRecno, nCurLevel )
METHOD BookCount( nRecno, nCurLevel )
#endif
local nTempLevel := 0, nCount := 0, nLen := len( ::aReport[ BOOKMARK ] )
++nRecno
while nRecno <= nLen
nTempLevel := ::aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
IF nTempLevel <= nCurLevel
exit
ELSE
IF nCurLevel + 1 == nTempLevel
++nCount
ENDIF
ENDIF
++nRecno
enddo
return -1 * nCount
| hbvpdft.prg | 1873 |
METHOD TPDF | BookFirst( nRecno, nCurLevel, nObj )
METHOD tPdf:BookFirst( nRecno, nCurLevel, nObj )
| hbvpdft.prg | 1894 |
METHOD | BookFirst( nRecno, nCurLevel, nObj )
METHOD BookFirst( nRecno, nCurLevel, nObj )
#endif
local nFirst := 0, nLen := len( ::aReport[ BOOKMARK ] )
++nRecno
IF nRecno <= nLen
IF nCurLevel + 1 == ::aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
nFirst := nRecno
ENDIF
ENDIF
return IIF( nFirst == 0, nFirst, nObj + nFirst )
| hbvpdft.prg | 1896 |
METHOD TPDF | BookLast( nRecno, nCurLevel, nObj )
METHOD tPdf:BookLast( nRecno, nCurLevel, nObj )
| hbvpdft.prg | 1911 |
METHOD | BookLast( nRecno, nCurLevel, nObj )
METHOD BookLast( nRecno, nCurLevel, nObj )
#endif
local nLast := 0, nLen := len( ::aReport[ BOOKMARK ] )
++nRecno
IF nRecno <= nLen
IF nCurLevel + 1 == ::aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
while nRecno <= nLen .and. nCurLevel + 1 <= ::aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
IF nCurLevel + 1 == ::aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
nLast := nRecno
ENDIF
++nRecno
enddo
ENDIF
ENDIF
return IIF( nLast == 0, nLast, nObj + nLast )
| hbvpdft.prg | 1913 |
METHOD TPDF | BookNext( nRecno, nCurLevel, nObj )
METHOD tPdf:BookNext( nRecno, nCurLevel, nObj )
| hbvpdft.prg | 1933 |
METHOD | BookNext( nRecno, nCurLevel, nObj )
METHOD BookNext( nRecno, nCurLevel, nObj )
#endif
local nTempLevel := 0, nNext := 0, nLen := len( ::aReport[ BOOKMARK ] )
++nRecno
while nRecno <= nLen
nTempLevel := ::aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
IF nCurLevel > nTempLevel
exit
ELSEIF nCurLevel == nTempLevel
nNext := nRecno
exit
ELSE
// keep going
ENDIF
++nRecno
enddo
return IIF( nNext == 0, nNext, nObj + nNext )
| hbvpdft.prg | 1935 |
METHOD TPDF | BookParent( nRecno, nCurLevel, nObj )
METHOD tPdf:BookParent( nRecno, nCurLevel, nObj )
| hbvpdft.prg | 1957 |
METHOD | BookParent( nRecno, nCurLevel, nObj )
METHOD BookParent( nRecno, nCurLevel, nObj )
#endif
local nTempLevel := 0
local nParent := 0
--nRecno
while nRecno > 0
nTempLevel := ::aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
IF nTempLevel < nCurLevel
nParent := nRecno
exit
ENDIF
--nRecno
enddo
return IIF( nParent == 0, nObj - 1, nObj + nParent )
| hbvpdft.prg | 1959 |
METHOD TPDF | BookPrev( nRecno, nCurLevel, nObj )
METHOD tPdf:BookPrev( nRecno, nCurLevel, nObj )
| hbvpdft.prg | 1978 |
METHOD | BookPrev( nRecno, nCurLevel, nObj )
METHOD BookPrev( nRecno, nCurLevel, nObj )
#endif
local nTempLevel := 0
local nPrev := 0
--nRecno
while nRecno > 0
nTempLevel := ::aReport[ BOOKMARK ][ nRecno ][ BOOKLEVEL ]
IF nCurLevel > nTempLevel
exit
ELSEIF nCurLevel == nTempLevel
nPrev := nRecno
exit
ELSE
// keep going
ENDIF
--nRecno
enddo
return IIF( nPrev == 0, nPrev, nObj + nPrev )
| hbvpdft.prg | 1980 |
METHOD TPDF | CheckLine( nRow )
METHOD tPdf:CheckLine( nRow )
| hbvpdft.prg | 2003 |
METHOD | CheckLine( nRow )
METHOD CheckLine( nRow )
#endif
IF nRow + ::aReport[ PDFTOP] > ::aReport[ PDFBOTTOM ]
::NewPage()
nRow := ::aReport[ REPORTLINE ]
ENDIF
::aReport[ REPORTLINE ] := nRow
RETURN self
| hbvpdft.prg | 2005 |
METHOD TPDF | GetFontInfo( cParam )
METHOD tPdf:GetFontInfo( cParam )
| hbvpdft.prg | 2018 |
METHOD | GetFontInfo( cParam )
METHOD GetFontInfo( cParam )
#endif
local cRet
IF cParam == "NAME"
IF left( ::aReport[ TYPE1 ][ ::aReport[ FONTNAME ] ], 5 ) == "Times"
cRet := "Times"
ELSEIF left( ::aReport[ TYPE1 ][ ::aReport[ FONTNAME ] ], 9 ) == "Helvetica"
cRet := "Helvetica"
ELSE
cRet := "Courier" // 0.04
ENDIF
ELSE // size
cRet := int(( ::aReport[ FONTNAME ] - 1 ) % 4)
ENDIF
return cRet
| hbvpdft.prg | 2020 |
METHOD TPDF | M2R( mm )
METHOD tPdf:M2R( mm )
| hbvpdft.prg | 2041 |
METHOD | M2R( mm )
METHOD M2R( mm )
#endif
return int( ::aReport[ LPI ] * mm / 25.4 )
| hbvpdft.prg | 2043 |
METHOD TPDF | M2X( n )
METHOD tPdf:M2X( n )
| hbvpdft.prg | 2051 |
METHOD | M2X( n )
METHOD M2X( n )
#endif
return n * 72 / 25.4
| hbvpdft.prg | 2053 |
METHOD TPDF | M2Y( n )
METHOD tPdf:M2Y( n )
| hbvpdft.prg | 2061 |
METHOD | M2Y( n )
METHOD M2Y( n )
#endif
return ::aReport[ PAGEY ] - n * 72 / 25.4
| hbvpdft.prg | 2063 |
METHOD TPDF | R2D( nRow )
METHOD tPdf:R2D( nRow )
| hbvpdft.prg | 2071 |
METHOD | R2D( nRow )
METHOD R2D( nRow )
#endif
return ::aReport[ PAGEY ] - nRow * 72 / ::aReport[ LPI ]
| hbvpdft.prg | 2073 |
METHOD TPDF | R2M( nRow )
METHOD tPdf:R2M( nRow )
| hbvpdft.prg | 2081 |
METHOD | R2M( nRow )
METHOD R2M( nRow )
#endif
return 25.4 * nRow / ::aReport[ LPI ]
| hbvpdft.prg | 2083 |
METHOD TPDF | X2M( n )
METHOD tPdf:X2M( n )
| hbvpdft.prg | 2091 |
METHOD | X2M( n )
METHOD X2M( n )
#endif
return n * 25.4 / 72
| hbvpdft.prg | 2093 |
METHOD TPDF | TextPrint( nI, nLeft, lParagraph, nJustify, nSpace, nNew, nLength, nLineLen, nLines, nStart, cString, cDelim, cColor, lPrint )
METHOD tPdf:TextPrint( nI, nLeft, lParagraph, nJustify, nSpace, nNew, nLength, nLineLen, nLines, nStart, cString, cDelim, cColor, lPrint )
| hbvpdft.prg | 2101 |
METHOD | TextPrint( nI, nLeft, lParagraph, nJustify, nSpace, nNew, nLength, nLineLen, nLines, nStart, cString, cDelim, cColor, lPrint )
METHOD TextPrint( nI, nLeft, lParagraph, nJustify, nSpace, nNew, nLength, nLineLen, nLines, nStart, cString, cDelim, cColor, lPrint )
#endif
local nFinish, nL, nB, nJ, cToken, nRow
nFinish := nI
nL := nLeft
IF lParagraph
IF nJustify != 2
nL += nSpace * nNew
ENDIF
ENDIF
IF nJustify == 3 // right
nL += nLength - nLineLen
ELSEIF nJustify == 2 // center
nL += ( nLength - nLineLen ) / 2
ENDIF
++nLines
IF lPrint
nRow := ::NewLine( 1 )
ENDIF
nB := nSpace
IF nJustify == 4
nB := ( nLength - nLineLen + ( nFinish - nStart ) * nSpace ) / ( nFinish - nStart )
ENDIF
for nJ := nStart to nFinish
cToken := token( cString, cDelim, nJ )
IF lPrint
// version 0.02
::AtSay( cColor + cToken, ::R2M( nRow + ::aReport[ PDFTOP ] ), nL, "M" )
ENDIF
nL += ::Length( cToken ) + nB
next
nStart := nFinish + 1
lParagraph := .f.
nLineLen := 0.00
nLineLen += nSpace * nNew
RETURN self
| hbvpdft.prg | 2103 |
METHOD TPDF | TextNextPara( cString, cDelim, nI )
METHOD tPdf:TextNextPara( cString, cDelim, nI )
| hbvpdft.prg | 2152 |
METHOD | TextNextPara( cString, cDelim, nI )
METHOD TextNextPara( cString, cDelim, nI )
#endif
local nAt, cAt, nCRLF, nNew, nRat, nRet := 0
// check if next spaces paragraph(s)
nAt := attoken( cString, cDelim, nI ) + len( token( cString, cDelim, nI ) )
cAt := substr( cString, nAt, attoken( cString, cDelim, nI + 1 ) - nAt )
nCRLF := numat( chr(13) + chr(10), cAt )
nRat := rat( chr(13) + chr(10), cAt )
nNew := len( cAt ) - nRat - IIF( nRat > 0, 1, 0 )
IF nCRLF > 1 .or. ( nCRLF == 1 .and. nNew > 0 )
nRet := nCRLF
ENDIF
return nRet
| hbvpdft.prg | 2154 |
METHOD TPDF | ClosePage()
METHOD tPdf:ClosePage()
| hbvpdft.prg | 2172 |
METHOD | ClosePage()
METHOD ClosePage()
#endif
local cTemp, cBuffer, nBuffer, nRead, nI, k, nImage, nFont, nImageHandle
aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] )
aadd( ::aReport[ PAGES ], ::aReport[ REPORTOBJ ] + 1 )
cTemp := ;
ltrim(str( ++::aReport[ REPORTOBJ ] )) + " 0 obj" + CRLF + ;
"<<" + CRLF + ;
"/Type /Page /Parent 1 0 R" + CRLF + ;
"/Resources " + ltrim(str( ++::aReport[ REPORTOBJ ] )) + " 0 R" + CRLF + ;
"/MediaBox [ 0 0 " + ltrim(transform( ::aReport[ PAGEX ], "9999.99")) + " " + ;
ltrim(transform(::aReport[ PAGEY ], "9999.99")) + " ]" + CRLF + ;
"/Contents " + ltrim(str( ++::aReport[ REPORTOBJ ] )) + " 0 R" + CRLF + ;
">>" + CRLF + ;
"endobj" + CRLF
::aReport[ DOCLEN ] += len( cTemp )
fwrite( ::aReport[ HANDLE ], cTemp )
aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] )
cTemp := ;
ltrim(str(::aReport[ REPORTOBJ ] - 1)) + " 0 obj" + CRLF + ;
"<<"+CRLF+;
"/ColorSpace << /DeviceRGB /DeviceGray >>" + CRLF + ; //version 0.01
"/ProcSet [ /PDF /Text /ImageB /ImageC ]"
IF len( ::aReport[ PAGEFONTS ] ) > 0
cTemp += CRLF + ;
"/Font" + CRLF + ;
"<<"
for nI := 1 to len( ::aReport[ PAGEFONTS ] )
nFont := ascan( ::aReport[ FONTS ], { |arr| arr[1] == ::aReport[ PAGEFONTS ][ nI ] } )
cTemp += CRLF + "/Fo" + ltrim(str( nFont )) + " " + ltrim(str( ::aReport[ FONTS ][ nFont ][ 2 ])) + " 0 R"
next
cTemp += CRLF + ">>"
ENDIF
IF len( ::aReport[ PAGEIMAGES ] ) > 0
cTemp += CRLF + "/XObject" + CRLF + "<<"
for nI := 1 to len( ::aReport[ PAGEIMAGES ] )
nImage := ascan( ::aReport[ IMAGES ], { |arr| arr[1] == ::aReport[ PAGEIMAGES ][ nI ][ 1 ] } )
IF nImage == 0
aadd( ::aReport[ IMAGES ], { ::aReport[ PAGEIMAGES ][ nI ][ 1 ], ++::aReport[ NEXTOBJ ], ::ImageInfo( ::aReport[ PAGEIMAGES ][ nI ][ 1 ] ) } )
nImage := len( ::aReport[ IMAGES ] )
ENDIF
cTemp += CRLF + "/Image" + ltrim(str( nImage )) + " " + ltrim(str( ::aReport[ IMAGES ][ nImage ][ 2 ])) + " 0 R"
next
cTemp += CRLF + ">>"
ENDIF
cTemp += CRLF + ">>" + CRLF + "endobj" + CRLF
::aReport[ DOCLEN ] += len( cTemp )
fwrite( ::aReport[ HANDLE ], cTemp )
aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] )
cTemp := ltrim(str( ::aReport[ REPORTOBJ ] )) + " 0 obj << /Length " + ;
ltrim(str( ::aReport[ REPORTOBJ ] + 1 )) + " 0 R >>" + CRLF +;
"stream"
::aReport[ DOCLEN ] += len( cTemp )
fwrite( ::aReport[ HANDLE ], cTemp )
IF len( ::aReport[ PAGEIMAGES ] ) > 0
cTemp := ""
for nI := 1 to len( ::aReport[ PAGEIMAGES ] )
cTemp += CRLF + "q"
nImage := ascan( ::aReport[ IMAGES ], { |arr| arr[1] == ::aReport[ PAGEIMAGES ][ nI ][ 1 ] } )
cTemp += CRLF + ltrim(str( IIF( ::aReport[ PAGEIMAGES ][ nI ][ 5 ] == 0, ::M2X( ::aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_WIDTH ] / ::aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_XRES ] * 25.4 ), ::aReport[ PAGEIMAGES ][ nI ][ 5 ]))) + ;
" 0 0 " + ;
ltrim(str( IIF( ::aReport[ PAGEIMAGES ][ nI ][ 4 ] == 0, ::M2X( ::aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_HEIGHT ] / ::aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_YRES ] * 25.4 ), ::aReport[ PAGEIMAGES ][ nI ][ 4 ]))) + ;
" " + ltrim(str( ::aReport[ PAGEIMAGES ][ nI ][ 3 ] )) + ;
" " + ltrim(str( ::aReport[ PAGEY ] - ::aReport[ PAGEIMAGES ][ nI ][ 2 ] - ;
IIF( ::aReport[ PAGEIMAGES ][ nI ][ 4 ] == 0, ::M2X( ::aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_HEIGHT ] / ::aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_YRES ] * 25.4 ), ::aReport[ PAGEIMAGES ][ nI ][ 4 ]))) + " cm"
cTemp += CRLF + "/Image" + ltrim(str( nImage )) + " Do"
cTemp += CRLF + "Q"
next
::aReport[ PAGEBUFFER ] := cTemp + ::aReport[ PAGEBUFFER ]
ENDIF
cTemp := ::aReport[ PAGEBUFFER ]
cTemp += CRLF + "endstream" + CRLF + ;
"endobj" + CRLF
::aReport[ DOCLEN ] += len( cTemp )
fwrite( ::aReport[ HANDLE ], cTemp )
aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] )
cTemp := ltrim(str( ++::aReport[ REPORTOBJ ] )) + " 0 obj" + CRLF + ;
ltrim(str(len( ::aReport[ PAGEBUFFER ] ))) + CRLF + ;
"endobj" + CRLF
::aReport[ DOCLEN ] += len( cTemp )
fwrite( ::aReport[ HANDLE ], cTemp )
for nI := 1 to len( ::aReport[ FONTS ] )
IF ::aReport[ FONTS ][ nI ][ 2 ] > ::aReport[ REPORTOBJ ]
aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] )
cTemp := ;
ltrim(str( ::aReport[ FONTS ][ nI ][ 2 ] )) + " 0 obj" + CRLF + ;
"<<" + CRLF + ;
"/Type /Font" + CRLF + ;
"/Subtype /Type1" + CRLF + ;
"/Name /Fo" + ltrim(str( nI )) + CRLF + ;
"/BaseFont /" + ::aReport[ TYPE1 ][ ::aReport[ FONTS ][ nI ][ 1 ] ] + CRLF + ;
"/Encoding /WinAnsiEncoding" + CRLF + ;
">>" + CRLF + ;
"endobj" + CRLF
::aReport[ DOCLEN ] += len( cTemp )
fwrite( ::aReport[ HANDLE ], cTemp )
ENDIF
next
for nI := 1 to len( ::aReport[ IMAGES ] )
IF ::aReport[ IMAGES ][ nI ][ 2 ] > ::aReport[ REPORTOBJ ]
aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] )
cTemp := ;
ltrim(str( ::aReport[ IMAGES ][ nI ][ 2 ] )) + " 0 obj" + CRLF + ;
"<<" + CRLF + ;
"/Type /XObject" + CRLF + ;
"/Subtype /Image" + CRLF + ;
"/Name /Image" + ltrim(str(nI)) + CRLF + ;
"/Filter [" + IIF( at( ".JPG", upper( ::aReport[ IMAGES ][ nI ][ 1 ]) ) > 0, " /DCTDecode", "" ) + " ]" + CRLF + ;
"/Width " + ltrim(str( ::aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_WIDTH ] )) + CRLF + ;
"/Height " + ltrim(str( ::aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_HEIGHT ] )) + CRLF + ;
"/BitsPerComponent " + ltrim(str( ::aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_BITS ] )) + CRLF + ;
"/ColorSpace /" + IIF( ::aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_BITS ] == 1, "DeviceGray", "DeviceRGB") + CRLF + ;
"/Length " + ltrim(str( ::aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_LENGTH ])) + CRLF + ;
">>" + CRLF + ;
"stream" + CRLF
::aReport[ DOCLEN ] += len( cTemp )
fwrite( ::aReport[ HANDLE ], cTemp )
nImageHandle := fopen( ::aReport[ IMAGES ][ nI ][ 1 ] )
fseek( nImageHandle, ::aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_FROM ] )
nBuffer := 8192
cBuffer := space( nBuffer )
k := 0
while k < ::aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_LENGTH ]
IF k + nBuffer <= ::aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_LENGTH ]
nRead := nBuffer
ELSE
nRead := ::aReport[ IMAGES ][ nI ][ 3 ][ IMAGE_LENGTH ] - k
ENDIF
fread( nImageHandle, @cBuffer, nRead )
::aReport[ DOCLEN ] += nRead
fwrite( ::aReport[ HANDLE ], cBuffer, nRead )
k += nRead
enddo
cTemp := CRLF + "endstream" + CRLF + "endobj" + CRLF
::aReport[ DOCLEN ] += len( cTemp )
fwrite( ::aReport[ HANDLE ], cTemp )
fClose( nImageHandle )
ENDIF
next
::aReport[ REPORTOBJ ] := ::aReport[ NEXTOBJ ]
::aReport[ NEXTOBJ ] := ::aReport[ REPORTOBJ ] + 4
::aReport[ PAGEBUFFER ] := ""
RETURN self
| hbvpdft.prg | 2174 |
METHOD TPDF | FilePrint( cFile )
METHOD tPdf:FilePrint( cFile )
| hbvpdft.prg | 2361 |
METHOD | FilePrint( cFile )
METHOD FilePrint( cFile )
#endif
local cPathAcro := "c:\progra~1\Adobe\Acroba~1.0\Reader"
local cRun := cPathAcro + "\AcroRd32.exe /t " + cFile + " " + ;
chr(34) + "HP LaserJet 5/5M PostScript" + chr(34) + " " + ;
chr(34) + "LPT1" + chr(34)
IF ( ! RunExternal( cRun, 'print' ) )
alert( "Error printing to PDF reader." )
break
ENDIF
RETURN self
| hbvpdft.prg | 2363 |
METHOD TPDF | Execute( cFile )
METHOD tPdf:Execute( cFile )
| hbvpdft.prg | 2380 |
METHOD | Execute( cFile )
METHOD Execute( cFile )
#endif
// Replace cPathAcro with the path at your system
local cPathAcro := "c:\progra~1\Adobe\Acroba~1.0\Reader"
local cRun := cPathAcro + "\AcroRd32.exe /t " + cFile + " " + chr(34) + "HP LaserJet 5/5M PostScript" + chr(34) + " " + chr(34) + "LPT1" + chr(34)
IF (! RunExternal( cRun, 'open', cFile ) )
alert("Error printing to PDF reader.")
break
ENDIF
RETURN self
| hbvpdft.prg | 2382 |
STATIC FUNCTION | FilePos( nHandle )
static function FilePos( nHandle )
return ( FSEEK( nHandle, 0, FS_RELATIVE ) )
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ\\
| hbvpdft.prg | 2399 |
STATIC FUNCTION | Chr_RGB( cChar )
static function Chr_RGB( cChar )
return str(asc( cChar ) / 255, 4, 2)
| hbvpdft.prg | 2409 |
STATIC FUNCTION | TimeAsAMPM( cTime )
static function TimeAsAMPM( cTime )
IF VAL(cTime) < 12
cTime += " am"
ELSEIF VAL(cTime) == 12
cTime += " pm"
ELSE
cTime := STR(VAL(cTime) - 12, 2) + SUBSTR(cTime, 3) + " pm"
ENDIF
cTime := left( cTime, 5 ) + substr( cTime, 10 )
return cTime
| hbvpdft.prg | 2414 |
STATIC FUNCTION | FileSize( cFile )
static function FileSize( cFile )
LOCAL nLength
LOCAL nHandle
nHandle := fOpen( cFile )
nLength := fSeek( nHandle, 0, FS_END )
fClose( nHandle )
return ( nLength )
| hbvpdft.prg | 2427 |
STATIC FUNCTION | NumToken( cString, cDelimiter )
static FUNCTION NumToken( cString, cDelimiter )
RETURN AllToken( cString, cDelimiter )
| hbvpdft.prg | 2440 |
STATIC FUNCTION | Token( cString, cDelimiter, nPointer )
static FUNCTION Token( cString, cDelimiter, nPointer )
RETURN AllToken( cString, cDelimiter, nPointer, 1 )
| hbvpdft.prg | 2445 |
STATIC FUNCTION | AtToken( cString, cDelimiter, nPointer )
static function AtToken( cString, cDelimiter, nPointer )
return AllToken( cString, cDelimiter, nPointer, 2 )
| hbvpdft.prg | 2450 |
STATIC FUNCTION | AllToken( cString, cDelimiter, nPointer, nAction )
static function AllToken( cString, cDelimiter, nPointer, nAction )
local nTokens := 0
local nPos := 1
local nLen := len( cString )
local nStart := 0
local cToken := ""
local cRet := 0
DEFAULT cDelimiter TO chr(0)+chr(9)+chr(10)+chr(13)+chr(26)+chr(32)+chr(138)+chr(141)
DEFAULT nAction to 0
// nAction == 0 - numtoken
// nAction == 1 - token
// nAction == 2 - attoken
while nPos <= nLen
if .not. substr( cString, nPos, 1 ) $ cDelimiter
nStart := nPos
while nPos <= nLen .and. .not. substr( cString, nPos, 1 ) $ cDelimiter
++nPos
enddo
++nTokens
IF nAction > 0
IF nPointer == nTokens
IF nAction == 1
cRet := substr( cString, nStart, nPos - nStart )
ELSE
cRet := nStart
ENDIF
exit
ENDIF
ENDIF
endif
if substr( cString, nPos, 1 ) $ cDelimiter
while nPos <= nLen .and. substr( cString, nPos, 1 ) $ cDelimiter
++nPos
enddo
endif
cRet := nTokens
ENDDO
RETURN cRet
| hbvpdft.prg | 2455 |
STATIC FUNCTION | Array2File( cFile, aRay, nDepth, hFile )
static function Array2File( cFile, aRay, nDepth, hFile )
local nBytes := 0
local i
local lOpen := ( hFile != nil )
nDepth := if( ISNUMBER( nDepth ), nDepth, 0 )
//if hFile == NIL
if !lOpen
if ( hFile := fCreate( cFile,FC_NORMAL ) ) == -1
return ( nBytes )
endif
endif
nDepth++
nBytes += WriteData( hFile,aRay )
if ISARRAY( aRay )
for i := 1 to len( aRay )
nBytes += Array2File( cFile,aRay[i],nDepth,hFile )
next
endif
nDepth--
// if nDepth == 0
if !lOpen
fClose(hFile)
endif
return( nBytes )
| hbvpdft.prg | 2504 |
STATIC FUNCTION | WriteData(hFile,xData)
static function WriteData(hFile,xData)
local cData := valtype(xData)
if ISCHARACTER(xData)
cData += i2bin( len( xData ) ) + xData
elseif ISNUMBER(xData)
cData += i2bin( len( alltrim( str( xData ) ) ) ) + alltrim( str( xData ) )
elseif ISDATE( xData )
cData += i2bin( 8 )+dtos(xData)
elseif ISLOGICAL(xData)
cData += i2bin( 1 )+if( xData,'T','F' )
elseif ISARRAY( xData )
cData += i2bin( len( xData ) )
else
cData += i2bin( 0 ) // NIL
endif
return( fWrite( hFile, cData, len( cData ) ) )
| hbvpdft.prg | 2533 |
STATIC FUNCTION | File2Array( cFile, nLen, hFile )
static function File2Array( cFile, nLen, hFile )
LOCAL cData,cType,nDataLen,nBytes
local nDepth := 0
local aRay := {}
local lOpen := ( hFile != nil )
if hFile == NIL // First Timer
if ( hFile := fOpen( cFile,FO_READ ) ) == -1
return( aRay )
endif
cData := space( 3 )
fRead( hFile, @cData, 3 )
if left( cData,1 ) != 'A' // If format of file != array
fClose( hFile ) //////////
return( aRay )
endif
nLen := bin2i( right( cData,2 ) )
endif
do while nDepth < nLen
cData := space( 3 )
nBytes := fRead( hFile, @cData, 3 )
if nBytes < 3
exit
endif
cType := padl( cData,1 )
nDataLen := bin2i( right( cData,2 ) )
if cType != 'A'
cData := space( nDataLen )
nBytes:= fRead( hFile, @cData, nDataLen )
if nBytes < nDataLen
exit
endif
endif
nDepth++
aadd( aRay,NIL )
if cType=='C'
aRay[ nDepth ] := cData
elseif cType=='N'
aRay[ nDepth ] := val(cData)
elseif cType=='D'
aRay[ nDepth ] := ctod( left( cData, 4 ) + "/" + substr( cData, 5, 2 ) + "/" + substr( cData, 7, 2 )) //stod(cData)
elseif cType=='L'
aRay[ nDepth ] := ( cData=='T' )
elseif cType=='A'
aRay[ nDepth ] := File2Array( , nDataLen, hFile )
endif
enddo
if !lOpen
fClose( hFile )
endif
return ( aRay )
| hbvpdft.prg | 2554 |
STATIC FUNCTION | NumAt( cSearch, cString )
static FUNCTION NumAt( cSearch, cString )
LOCAL n := 0, nAt := 0, nPos := 0
WHILE ( nAt := at( cSearch, substr( cString, nPos + 1 ) )) > 0
nPos += nAt
++n
ENDDO
RETURN n
| hbvpdft.prg | 2611 |
STATIC FUNCTION | RunExternal( cCmd, cVerb, cFile )
static function RunExternal( cCmd, cVerb, cFile )
local lRet := .t.
#ifdef __CLP__
lRet := SwpRunCmd( cCmd, 0, '', '' )
#endif
#ifdef __HARBOUR__
if cVerb != nil
// TOFIX: This requires hbwhat32, which in turns requires xhb.
// This has to solved differently.
// ShellExecute( GetDeskTopWindow(), cVerb, cFile, , , 1 )
HB_SYMBOL_UNUSED( cFile )
else
__Run( cCmd )
endif
#endif
#ifdef __XPP__
RunShell( cCmd, , .t., .t. )
#endif
return lRet
| hbvpdft.prg | 2623 |
hbvpsup.prg |
Type | Function | Source | Line |
FUNCTION | vpdf_FontsDat()
FUNCTION vpdf_FontsDat()
RETURN StrB64Decode( ;
"+gD6APoA+gBNAU0BTQGFAZgBKwKkASsC9AH0AfQB9AH0AfQB9AH0AUED6ANBA0EDCgNBAwoDCgNN" +;
"AU0BTQFNAU0BTQFNAU0BTQFNAU0BTQH0AfQB9AH0ATQCOgKjAjoC+gD6APoA+gBNAU0BTQFNAfoA" +;
"+gD6APoAFgEWARYBFgH0AfQB9AH0AfQB9AH0AfQB9AH0AfQB9AH0AfQB9AH0AfQB9AH0AfQB9AH0" +;
"AfQB9AH0AfQB9AH0AfQB9AH0AfQB9AH0AfQB9AH0AfQB9AH0ARYBTQFNAU0BFgFNAU0BTQE0AjoC" +;
"owI6AjQCOgKjAjoCNAI6AqMCOgK8AfQB9AH0AZkDogOYA0AD0gLSAmMCmwKbApsCYwKbApsC0gKb" +;
"ApsC0gLSAtIC0gJjApsCYwKbAiwCYwJjApsC0gIKA9IC0gLSAgoD0gIKA00BhQFNAYUBhQH0AbwB" +;
"9AHSAgoDmwKbAmMCmwIsAmMCeQOwA0EDeQPSAtICmwLSAtICCgPSAtICLAJjAmMCYwLSAgoD0gLS" +;
"ApsC0gJjApsCLAIsAvQBLAJjApsCLAJjAtIC0gLSAtIC0gLSAmMCmwKwA+gDQQN5A9IC0gJjApsC" +;
"0gLSAiwCYwJjApsCLAJjAk0BTQGFAU0BFgEWARYBFgFNAU0BhQFNAdUBRQKmAToC9AH0AfQB9AFN" +;
"AU0BTQFNAbwB9AH0AfQB9AEsAvQB9AG8AbwBvAG8AfQBLAL0AfQBvAG8AbwBvAFNAU0BFgFNAfQB" +;
"9AH0AfQB9AEsAvQBLAIWARYBFgEWARYBTQEWARYB9AEsArwB9AEWARYBFgEWAQoDQQPSAgoD9AEs" +;
"AvQBLAL0AfQB9AH0AfQBLAL0AfQB9AEsAvQB9AFNAbwBhQGFAYUBhQGFAYUBFgFNARYBFgH0ASwC" +;
"9AEsAvQB9AG8AbwB0gLSApsCmwL0AfQBvAH0AfQB9AG8AbwBvAG8AYUBhQHgAYoBkAFcAcgA3AAT" +;
"AdwA4AGKAZABXAEdAggCHQI6AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +;
"AAAAAAAATQFNAYUBhQH0AfQB9AH0AfQB9AH0AfQBpwCnAKcApwD0AfQB9AH0AfQB9AH0AfQB9AH0" +;
"AfQB9AH0AfQB9AH0AbQAFgHWABYBvAH0ASwC9AH0AfQB9AH0AU0BTQFNAU0BTQFNAU0BTQEsAiwC" +;
"9AEsAiwCLAL0ASwCAAAAAAAAAAD0AfQB9AH0AfQB9AH0AfQB9AH0AfQB9AH6APoA+gD6AAAAAAAA" +;
"AAAAxQEcAgsC9AFeAV4BXgFeAU0BTQFNAU0BvAH0ASwC9AG8AfQBLAL0AfQB9AH0AfQB6APoA3kD" +;
"6APoA+gD6APoAwAAAAAAAAAAvAH0AfQB9AEAAAAAAAAAAE0BTQFNAU0BTQFNAU0BTQFNAU0BTQFN" +;
"AU0BTQFNAU0BTQFNAU0BTQFNAU0BTQFNAU0BTQFNAU0BTQFNAU0BTQEAAAAAAAAAAE0BTQFNAU0B" +;
"TQFNAU0BTQEAAAAAAAAAAE0BTQFNAU0BTQFNAU0BTQFNAU0BTQFNAegD6AN5A+gDAAAAAAAAAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +;
"AAAAAAB5A+gDeQOwAwAAAAAAAAAAFAEsARQBCgEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +;
"AAAAAGMCmwIsAmMC0gIKA9IC0gJ5A+gDsAOwAzYBSgE2ASwBAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAAJsC0gKbAtICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFgEWARYB" +;
"FgEAAAAAAAAAAAAAAAAAAAAAFgEWARYBFgH0AfQB9AH0AdIC0gKbAtIC9AEsAvQB9AEAAAAAAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABYBFgEWARYBFgFNARYBTQFjAdoBYwHaASwCLAIsAiwC" +;
"LAIsAiwCLAJ5A3kDeQN5A5sC0gKbAtIC3gAWAd4AFgFNAU0BTQFNAU0BTQFNAU0BhQGFAYUBhQFI" +;
"AkgCSAJIAhYBFgEWARYBTQFNAU0BTQEWARYBFgEWARYBFgEWARYBLAIsAiwCLAIsAiwCLAIsAiwC" +;
"LAIsAiwCLAIsAiwCLAIsAiwCLAIsAiwCLAIsAiwCLAIsAiwCLAIsAiwCLAIsAiwCLAIsAiwCLAIs" +;
"AiwCLAIWAU0BFgFNARYBTQEWAU0BSAJIAkgCSAJIAkgCSAJIAkgCSAJIAkgCLAJjAiwCYwL3A88D" +;
"9wPPA5sC0gKbAtICmwLSApsC0gLSAtIC0gLSAtIC0gLSAtICmwKbApsCmwJjAmMCYwJjAgoDCgMK" +;
"AwoD0gLSAtIC0gIWARYBFgEWAfQBLAL0ASwCmwLSApsC0gIsAmMCLAJjAkEDQQNBA0ED0gLSAtIC" +;
"0gIKAwoDCgMKA5sCmwKbApsCCgMKAwoDCgPSAtIC0gLSApsCmwKbApsCYwJjAmMCYwLSAtIC0gLS" +;
"ApsCmwKbApsCsAOwA7ADsAObApsCmwKbApsCmwKbApsCYwJjAmMCYwIWAU0BFgFNARYBFgEWARYB" +;
"FgFNARYBTQHVAUgC1QFIAiwCLAIsAiwC3gAWAd4AFgEsAiwCLAIsAiwCYwIsAmMC9AEsAvQBLAIs" +;
"AmMCLAJjAiwCLAIsAiwCFgFNARYBTQEsAmMCLAJjAiwCYwIsAmMC3gAWAd4AFgHeABYB3gAWAfQB" +;
"LAL0ASwC3gAWAd4AFgFBA3kDQQN5AywCYwIsAmMCLAJjAiwCYwIsAmMCLAJjAiwCYwIsAmMCTQGF" +;
"AU0BhQH0ASwC9AEsAhYBTQEWAU0BLAJjAiwCYwL0ASwC9AEsAtICCgPSAgoD9AEsAvQBLAL0ASwC" +;
"9AEsAvQB9AH0AfQBTgGFAU4BhQEEARgBBAEYAU4BhQFOAYUBSAJIAkgCSAIAAAAAAAAAAAAAAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE0BTQFNAU0BLAIsAiwCLAIsAiwCLAIsAqcA" +;
"pwCnAKcALAIsAiwCLAIsAiwCLAIsAiwCLAIsAiwCLAIsAiwCLAK/AO4AvwDuAE0B9AFNAfQBLAIs" +;
"AiwCLAJNAU0BTQFNAU0BTQFNAU0B9AFjAvQBYwL0AWMC9AFjAgAAAAAAAAAALAIsAiwCLAIsAiwC" +;
"LAIsAiwCLAIsAiwCFgEWARYBFgEAAAAAAAAAABkCLAIZAiwCXgFeAV4BXgHeABYB3gAWAU0B9AFN" +;
"AfQBTQH0AU0B9AEsAiwCLAIsAugD6APoA+gD6APoA+gD6AMAAAAAAAAAAGMCYwJjAmMCAAAAAAAA" +;
"AABNAU0BTQFNAU0BTQFNAU0BTQFNAU0BTQFNAU0BTQFNAU0BTQFNAU0BTQFNAU0BTQFNAU0BTQFN" +;
"AU0BTQFNAU0BAAAAAAAAAABNAU0BTQFNAU0BTQFNAU0BAAAAAAAAAABNAU0BTQFNAU0BTQFNAU0B" +;
"TQFNAU0BTQHoA+gD6APoAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA6APoA+gD6AMAAAAAAAAAAHIBcgFyAXIBAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAmMCLAJjAgoDCgMKAwoD6APoA+gD6ANtAW0B" +;
"bQFtAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB5A3kDeQN5AwAAAAAA" +;
"AAAAAAAAAAAAAAAAAAAAAAAAABYBFgEWARYBAAAAAAAAAAAAAAAAAAAAAN4AFgHeABYBYwJjAmMC" +;
"YwKwA7ADsAOwA2MCYwJjAmMCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABYAlgCWAJY" +;
"AlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgC" +;
"WAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJY" +;
"AlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgC" +;
"WAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJY" +;
"AlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgC" +;
"WAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJY" +;
"AlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgC" +;
"WAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJY" +;
"AlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgC" +;
"WAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJY" +;
"AlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgC" +;
"WAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJY" +;
"AlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgC" +;
"WAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJY" +;
"AlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgC" +;
"WAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJY" +;
"AlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgC" +;
"WAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJY" +;
"AlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgC" +;
"WAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJY" +;
"AlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgC" +;
"WAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJY" +;
"AlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgC" +;
"WAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJY" +;
"AlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgC" +;
"WAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJY" +;
"AlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgC" +;
"WAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJY" +;
"AlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgC" +;
"WAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJY" +;
"AlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgCWAJYAlgC" +;
"WAJYAlgCWAJYAlgCWAJYAlgC" )
| hbvpsup.prg | 5 |
STATIC FUNCTION | StrB64Decode( cString )
STATIC FUNCTION StrB64Decode( cString )
LOCAL cResult
LOCAL nLen
LOCAL nGroupPos
LOCAL nGroup
LOCAL nCharPos
LOCAL nDataLen
LOCAL nData
// ; remove white spaces, If any
cString := StrTran( cString, Chr( 10 ), "" )
cString := StrTran( cString, Chr( 13 ), "" )
cString := StrTran( cString, Chr( 9 ), "" )
cString := StrTran( cString, " ", "" )
// ; The source must consists from groups with Len of 4 chars
IF ( nLen := Len( cString ) ) % 4 != 0
RETURN "" // ; Bad Base64 string.
ENDIF
/*
IF nLen > Int( MAXSTRINGLENGTH / 1.34 ) // ; Base64 is 1/3rd larger than source text.
RETURN "" // ; Not enough memory to decode.
ENDIF
*/
cResult := ""
// ; Now decode each group:
FOR nGroupPos := 1 TO nLen STEP 4
// ; Each data group encodes up To 3 actual bytes.
nDataLen := 3
nGroup := 0
FOR nCharPos := 0 TO 3
// ; Convert each character into 6 bits of data, And add it To
// ; an integer For temporary storage. If a character is a '=', there
// ; is one fewer data byte. (There can only be a maximum of 2 '=' In
// ; the whole string.)
nData := At( SubStr( cString, nGroupPos + nCharPos, 1 ), "=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" ) - 2
DO CASE
CASE nData >= 0
// ; Do nothing (for speed)
CASE nData == -1
nData := 0
nDataLen--
CASE nData == -2
RETURN "" // ; Bad character In Base64 string.
ENDCASE
nGroup := 64 * nGroup + nData
NEXT
// ; Convert the 24 bits to 3 characters
// ; and add nDataLen characters To out string
cResult += Left( Chr( nGroup / 65536 ) +; // ; bitwise AND 255, which is done by Chr() automatically
Chr( nGroup / 256 ) +; // ; bitwise AND 255, which is done by Chr() automatically
Chr( nGroup ), nDataLen ) // ; bitwise AND 255, which is done by Chr() automatically
NEXT
RETURN cResult
| hbvpsup.prg | 107 |
|