2008-05-30 19:32 UTC+0100 Viktor Szakats (harbour.01 syenar hu)

* source/rtl/accept.c
     * Minor format.

   * contrib/hbfbird/readme.txt
     + Added SVN header.

   * contrib/hbvpdf/hbvpdf.prg
   * contrib/hbvpdf/hbvpdf.ch
   * contrib/hbvpdf/tests/pdf_demo.prg
   + contrib/hbvpdf/readme.txt
     + Updated to latest 0.8 version.
     + Added readme.txt (including revision log) 
       from original package.
This commit is contained in:
Viktor Szakats
2008-05-30 17:34:53 +00:00
parent 5bd52e37c3
commit f4f78041a2
7 changed files with 252 additions and 39 deletions

View File

@@ -8,6 +8,21 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-05-30 19:32 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* source/rtl/accept.c
* Minor format.
* contrib/hbfbird/readme.txt
+ Added SVN header.
* contrib/hbvpdf/hbvpdf.prg
* contrib/hbvpdf/hbvpdf.ch
* contrib/hbvpdf/tests/pdf_demo.prg
+ contrib/hbvpdf/readme.txt
+ Updated to latest 0.8 version.
+ Added readme.txt (including revision log)
from original package.
2008-05-30 18:10 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* include/hbsetup.h
* include/hbinit.h

View File

@@ -1,3 +1,6 @@
/*
* $Id$
*/
README 23/12/2003 - Harbour Low Level api for Firebird and Interbase RDBMS

View File

@@ -5,6 +5,7 @@
#include "fileio.ch"
#include "common.ch"
#define MAXBUFLEN 30000
#define CRLF chr(13)+chr(10)
#define NORMAL 0
@@ -56,7 +57,8 @@
#define PAGEFONTS 31 // array of current page fonts
#define FONTWIDTH 32 // array of fonts width's
#define OPTIMIZE 33 // optimized ?
#define PARAMLEN 33 // number of report elements
#define BUFFERHANDLE 34 // if file buffer used
#define PARAMLEN 34 // number of report elements
#define ALIGN_LEFT 1
#define ALIGN_CENTER 2
@@ -70,6 +72,7 @@
#define IMAGE_BITS 5
#define IMAGE_FROM 6
#define IMAGE_LENGTH 7
#define IMAGE_SPACE 8
#define BYTE 1
#define ASCII 2

View File

@@ -44,7 +44,8 @@ DEFAULT cId to ""
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 "
//aReport[ PAGEBUFFER ] += " 1 g "
pdfAddBuffer( " 1 g " )
lReverse = .t.
ELSEIF right( cString, 1 ) == chr(254) //underline
cString := left( cString, len( cString ) - 1 )
@@ -54,10 +55,16 @@ DEFAULT cId to ""
// 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
@@ -65,15 +72,19 @@ DEFAULT cId to ""
_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"
//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"
//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"
//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 "
//aReport[ PAGEBUFFER ] += " 0 g "
pdfAddBuffer( " 0 g " )
ENDIF
ENDIF
return nil
@@ -261,20 +272,28 @@ DEFAULT cColor to ""
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"
//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"
//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
@@ -285,10 +304,16 @@ DEFAULT cColor to ""
ÀÄÄÄÄÄÙ
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
@@ -301,6 +326,7 @@ 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 )) + " " + ;
@@ -318,6 +344,24 @@ DEFAULT cBoxColor to chr(255) + chr(255) + chr(255)
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
/*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
@@ -506,6 +550,7 @@ return nil
static function pdfClosePage() /*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
local cTemp, cBuffer, nBuffer, nRead, nI, k, nImage, nFont, nImageHandle
local cImage, nTemp1, nLength
aadd( aReport[ REFS ], aReport[ DOCLEN ] )
@@ -574,7 +619,7 @@ local cTemp, cBuffer, nBuffer, nRead, nI, k, nImage, nFont, nImageHandle
aReport[ DOCLEN ] += len( cTemp )
fwrite( aReport[ HANDLE ], cTemp )
/*
IF len( aReport[ PAGEIMAGES ] ) > 0
cTemp := ""
for nI := 1 to len( aReport[ PAGEIMAGES ] )
@@ -601,6 +646,7 @@ local cTemp, cBuffer, nBuffer, nRead, nI, k, nImage, nFont, nImageHandle
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
@@ -608,6 +654,76 @@ local cTemp, cBuffer, nBuffer, nRead, nI, k, nImage, nFont, nImageHandle
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 ]
@@ -646,10 +762,11 @@ local cTemp, cBuffer, nBuffer, nRead, nI, k, nImage, nFont, nImageHandle
"/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 + ;
"/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 )
@@ -673,6 +790,8 @@ local cTemp, cBuffer, nBuffer, nRead, nI, k, nImage, nFont, nImageHandle
k += nRead
enddo
fclose( nImageHandle )
cTemp := CRLF + "endstream" + CRLF + ;
"endobj" + CRLF
@@ -842,6 +961,9 @@ DEFAULT _nFontSize to aReport[ FONTSIZE ]
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
/*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
@@ -907,6 +1029,8 @@ DEFAULT lOptimize to .f.
aReport[ OPTIMIZE ] := lOptimize
aReport[ BUFFERHANDLE ] := 0
aReport[ NEXTOBJ ] := aReport[ REPORTOBJ ] + 4
n12 := 2 * n2 // 0.04
@@ -972,6 +1096,9 @@ DEFAULT _cPageSize to "LETTER"
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
/*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */
@@ -1527,6 +1654,17 @@ return nil
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
@@ -1681,16 +1819,6 @@ local nI, nLen := len( aReport[ HEADER ] ), nTemp, aTemp, nHeight
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 nil
@@ -1816,7 +1944,7 @@ 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 := {}
local nWidth := 0, nHeight := 0, nBits := 0, nFrom := 0, nLength := 0, xRes := 0, yRes := 0, aTemp := {}, nSpace
nHandle := fopen( cFile )
@@ -2364,27 +2492,34 @@ endif
aadd( aTemp, nFrom )
aadd( aTemp, nLength )
nSpace := 0
aadd( aTemp, nSpace )
return aTemp
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(1024)
fread( nHandle, @c255, 1024 )
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 := 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 ))
fclose( nHandle )
nSpace := asc( substr( c255, nAt + 4, 1 ))
nLength := filesize( cFile )
nLength := filesize( nHandle )
fclose( nHandle )
aadd( aTemp, nWidth )
aadd( aTemp, nHeight )
@@ -2393,9 +2528,25 @@ local nWidth := 0, nHeight := 0, nBits := 8, nFrom := 0, nLength := 0, xRes := 0
aadd( aTemp, nBits )
aadd( aTemp, nFrom )
aadd( aTemp, nLength )
aadd( aTemp, nSpace )
return aTemp
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
FUNCTION FilePos( nHandle )
RETURN ( FSEEK( nHandle, 0, FS_RELATIVE ) )
@@ -2505,14 +2656,19 @@ FUNCTION NumAt( cSearch, cString )
ENDDO
RETURN n
FUNCTION FileSize( cFile )
FUNCTION FileSize( nHandle )
LOCAL nCurrent
LOCAL nLength
LOCAL nHandle
nHandle := fopen( cFile )
// Get file position
nCurrent := FilePos( nHandle )
// Get file length
nLength := FSEEK( nHandle, 0, FS_END )
fclose( nHandle )
// Reset file position
FSEEK( nHandle, nCurrent )
RETURN ( nLength )

View File

@@ -0,0 +1,40 @@
/*
* $Id$
*/
Welcome to _pure_ Clipper Pdf Library!
Changes in Release 0.08
1. Fixed page buffer string overflow.
*********************************************************************
Changes in Release 0.07a
1. Fixed minor errors with JPEG function to work properly with GRAY & RGB
*********************************************************************
Changes in Release 0.07.
1. Fixed minor errors
Changes in Release 0.06.
1. Added new function pdfBox1 for colorful boxes
2. Added new page to demo program
*********************************************************************
Changes in Release 0.05.
All changes commented as // 0.04.
1. Added #ifdef - #endif for Harbour support (see end of file pdf.prd)
2. Fixed minor error for allow different page sizes (A4, ...)
*********************************************************************
Changes in Release 0.04.
All changes commented as // 0.04.
1. Added Courier font.
2. TOP, LEFT, BOTTOM changed to PDFTOP, PDFLEFT, PDFBOTTOM to avoid conflicts.
All changes commented as // 0.04.
**** Please note 3 most popular fonts now available: Times, Helvetica
, Courier. When you calling pdfSetFont, please use only above names.
*********************************************************************
Changes in Release 0.03.
Replaced function from Clipper Tools and Nanfor for Clipper Source.
*********************************************************************
This is first public release 0.02.
*********************************************************************
Please send your comments on
andvit@sympatico.ca
Thank you

View File

@@ -147,8 +147,8 @@ procedure main()
for nJ := 1 to 4
if aFonts[ nI ][ nJ + 1 ]
pdfSetFont( aFonts[ nI ][ 1 ], nJ - 1, aReport[ FONTSIZE ] )
pdfRJust("This is a test for " + aFonts[ nI ][ 1 ] + " " + ;
aStyle[ nJ ], nK++, aReport[ REPORTWIDTH ], "R")
pdfRJust("0123456789 This is a test for " + aFonts[ nI ][ 1 ] + " " + ;
aStyle[ nJ ], nK++, aReport[ REPORTWIDTH ], "R")
endif
next
pdfRJust(pdfUnderline("Underline"), nK++, aReport[ REPORTWIDTH ], "R")

View File

@@ -84,16 +84,13 @@ HB_FUNC( __ACCEPTSTR )
HB_FUNC( __ACCEPT )
{
char szAcceptResult[ ACCEPT_BUFFER_LEN ];
ULONG ulLen;
int input;
ULONG ulLen = 0;
int input = 0;
/* cPrompt(s) passed ? */
if( hb_pcount() >= 1 )
HB_FUNC_EXEC( QOUT );
ulLen = 0;
input = 0;
szAcceptResult[ 0 ] = '\0';
while( input != K_ENTER && hb_vmRequestQuery() == 0 )
@@ -116,7 +113,7 @@ HB_FUNC( __ACCEPT )
{
szAcceptResult[ ulLen ] = input; /* Accept the input */
hb_conOutAlt( &szAcceptResult[ ulLen ], sizeof( char ) ); /* Then display it */
ulLen++; /* Then adjust the input count */
ulLen++; /* Then adjust the input count */
}
}
}
@@ -129,4 +126,3 @@ HB_FUNC( __ACCEPT )
hb_retc( szAcceptResult );
}