#include-once #include #include #include ; #INDEX# ======================================================================================================================= ; Title .........: MPDF ; AutoIt Version : 3.3.6.1 ; Description ...: Generate pdf files without any external files (ActiveX, Dll etc) using just AutoIt functions. ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ; _BeginPage ; _ClosePDFFile ; _DrawArc ; _DrawCircle ; _DrawCurve ; _DrawLine ; _DrawText ; _Draw_Rectangle ; _EndObject ; _EndPage ; _GetMargin ; _GetPageHeight ; _GetPageWidth ; _GetTextLength ; _GetUnit ; _InitPDF ; _InsertDCube ; _InsertDPie ; _InsertImage ; _InsertRenderedText ; _LineTo ; _LoadFontStandard ; _LoadFontTT ; _LoadResImage ; _MoveTo ; _OpenAfter ; _Pages ; _Paragraph ; _Path ; _Rectangle ; _SetCharSpacing ; _SetColourFill ; _SetColourStroke ; _SetDash ; _SetKeywords ; _SetLayoutMode ; _SetLineCap ; _SetLineJoin ; _SetLineWidth ; _SetMargin ; _SetMiterLimit ; _SetOrientation ; _SetPageHeight ; _SetPageWidth ; _SetPaperSize ; _SetSubject ; _SetTextHorizontalScaling ; _SetTextRenderingMode ; _SetTextRiseMode ; _SetTitle ; _SetUnit ; _SetWordSpacing ; _SetZoomMode ; _StartObject ; =============================================================================================================================== #region CONSTANTS Global $PDF_VERSION = "%PDF-1.4" & @CRLF & "%" & ChrW(199) & ChrW(200) & ChrW(201) & ChrW(202) Global $PDF_AUTHOR = "Mihai Iancu" Global $PDF_CREATOR = "MIPDF" Global $PDF_COPYRIGHT = "© 1973-" & @YEAR & " Mihai Iancu" Global $PDF_TITLE = "" Global $PDF_SUBJECT = "" Global $PDF_KEYWORDS = "" Global $PDF_NAME = "" Global Const $PDF_STYLE_NONE = 0x0 Global Const $PDF_STYLE_STROKED = 0x1 Global Const $PDF_STYLE_CLOSED = 0x2 Global Const $PDF_STYLE_FILLED = 0x4 Global Const $PDF_FONT_NORMAL = 0 Global Const $PDF_FONT_BOLD = 1 Global Const $PDF_FONT_ITALIC = 2 Global Const $PDF_FONT_BOLDITALIC = 4 Global $PDF_FONT_STD_HELVETICA = "Helvetica" Global $PDF_FONT_STD_COURIER = "Courier" Global $PDF_FONT_STD_SYMBOL = "Symbol" Global $PDF_FONT_STD_ZAPFDINGBATS = "ZapfDingbats" Global $PDF_FONT_STD_ARIAL = "Helvetica";looks the same Global $PDF_FONT_STD_TIMES = "Times Roman" Global $PDF_FONT_COURIER = $PDF_FONT_STD_COURIER & " New" Global $PDF_FONT_ARIAL = $PDF_FONT_STD_ARIAL Global $PDF_FONT_TIMES = "Times New Roman" Global $PDF_FONT_SYMBOL = $PDF_FONT_STD_SYMBOL Global Const $PDF_ALIGN_LEFT = 1 Global Const $PDF_ALIGN_RIGHT = 2 Global Const $PDF_ALIGN_CENTER = 3 Global Const $PDF_PAGE_A4 = 0 Global Const $PDF_PAGE_A3 = 1 Global Const $PDF_PAGE_LETTER = 2 Global Const $PDF_PAGE_LEGAL = 4 Global Const $PDF_PAGE_CUSTOM = 8 Global Const $PDF_UNIT_PT = 1 Global Const $PDF_UNIT_INCH = 2 Global Const $PDF_UNIT_MM = 4 Global Const $PDF_UNIT_CM = 8 Global Const $PDF_ZOOM_FULLPAGE = 0 Global Const $PDF_ZOOM_FULLWIDTH = 1 Global Const $PDF_ZOOM_REAL = 2 Global Const $PDF_ZOOM_DEFAULT = 4 Global Const $PDF_ZOOM_CUSTOM = 8 Global Const $PDF_LAYOUT_SINGLE = 0 Global Const $PDF_LAYOUT_CONTINOUS = 1 Global Const $PDF_LAYOUT_TWO = 2 Global Const $PDF_LAYOUT_DEFAULT = 4 Global Const $PDF_ORIENTATION_PORTRAIT = 0 Global Const $PDF_ORIENTATION_LANDSCAPE = 1 Global $PDF_OBJECT_NAME = "" Global $PDF_OBJECT_OPTIONS = "" Global Const $PDF_OBJECT_NONE = 0 Global Const $PDF_OBJECT_FIRSTPAGE = 0x1 Global Const $PDF_OBJECT_EVENPAGES = 0x2 Global Const $PDF_OBJECT_ODDPAGES = 0x4 Global Const $PDF_OBJECT_NOTFIRSTPAGE = 0x8 Global Const $PDF_OBJECT_ALLPAGES = BitAND($PDF_OBJECT_EVENPAGES, $PDF_OBJECT_ODDPAGES, $PDF_OBJECT_FIRSTPAGE) Global $BaseFont Global $FirstChar Global $LastChar Global $Param Global $MissingWidth Global $Widths[256] Global $__SetUnit Global $_PaperSize = $PDF_PAGE_A4 Global $_Orientation = $PDF_ORIENTATION_PORTRAIT Global $__SetMargin = 0 Global $_Pages = 0 Global $_CharSpacing Global $_WordSpacing Global $_TextScaling Global $_PageWidth Global $_PageHeight Global $_FileName Global $_Offset = 0 Global $_Font = 0 Global $_ZoomMode Global $_LayoutMode Global $_sPage Global $_sFONT Global $_sFONTNAME Global $_Image Global $_sObject Global $_sObjectForPage Global $_iResource Global $_iPages Global $_iObject = 0 Global $_iMaxObject Global $_iTmpOffset Global $_iImageW Global $_iImageH Global $_Buffer = "" Global $_bOpen = False Global $aXREF[1000] Global $aOBJECTS[2] = [$PDF_OBJECT_NAME, $PDF_OBJECT_OPTIONS] #endregion CONSTANTS #region FUNCTIONS ; #FUNCTION# ==================================================================================================================== ; Name ..........: _BeginPage ; Description ...: Begin a new page ; Syntax ........: _BeginPage( ) ; Parameters ....: ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: _EndPage() ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _BeginPage() Local $intPage $_Pages = $_Pages + 1 $intPage = __InitObj() __ToBuffer("<>") __EndObj() $_sPage = $_sPage & $intPage & " 0 R " __InitObj($intPage + 1) __ToBuffer("<< /Length " & $intPage + 2 & " 0 R >>" & @CRLF & "stream") $_iTmpOffset = $_Offset __InsertObjectOnPage() $_CharSpacing = 0 $_WordSpacing = 0 $_TextScaling = 100 Return $_Pages EndFunc ;==>_BeginPage ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ClosePDFFile ; Description ...: Write the buffer to the pdf ; Syntax ........: _ClosePDFFile( ) ; Parameters ....: ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: _InitPDF() ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _ClosePDFFile() $_iResource = __InitObj(4) __ToBuffer("<<" & @CRLF & _ _Iif($_sFONT <> "", "/Font <<" & $_sFONT & ">>" & @CRLF, "") & _ "/ProcSet [/PDF /Text" & _Iif($_Image <> "", " /ImageB /ImageC /ImageI", "") & " ]" & @CRLF & _ _Iif(($_Image <> "") Or ($_sObject <> ""), "/XObject <<" & $_Image & @CRLF & $_sObject & ">>" & @CRLF, "") & _ ">>") __EndObj() $_iPages = __InitObj(3) __ToBuffer("<>") __EndObj() __ToBuffer("xref") __ToBuffer("0 " & $_iMaxObject + 1) __ToBuffer("0000000000 65535 f") For $i = 1 To $_iMaxObject __ToBuffer($aXREF[$i]) Next __ToBuffer("trailer" & @CRLF & _ "<< /Size " & $_iMaxObject & "/Info 1 0 R" & "/Root 2 0 R" & ">>") __ToBuffer("startxref" & @CRLF & StringLen("startxref" & @CRLF & $_Buffer & "%%EOF" & @CRLF) + 6) $_FileName = FileOpen($PDF_NAME,18) FileWrite($_FileName, $_Buffer & "%%EOF" & @CRLF) FileClose($_FileName) If $_bOpen Then ShellExecute($PDF_NAME) Exit EndFunc ;==>_ClosePDFFile ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Draw_Rectangle ; Description ...: Draw _Rectangle ; Syntax ........: _Draw_Rectangle( $iX , $iY , $iW , $iH [, $sStyle [, $iRadius [, $lFillColour [, ; $iBorderWidth ]]]] ) ; Parameters ....: $iX - integer value. ; $iY - integer value. ; $iW - integer value. ; $iH - integer value. ; $sStyle - [optional] string value. ; $iRadius - [optional] integer value. ; $iFillColour - [optional] RGB value. ; $iBorderWidth - [optional] integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Draw_Rectangle($iX, $iY, $iW, $iH, $sStyle = $PDF_STYLE_STROKED, $iRadius = 0, $iFillColour = 0, $iBorderWidth = 0.05) _SetLineWidth($iBorderWidth) _SetColourFill($iFillColour) _Rectangle($iX, $iY, $iW, $iH, $sStyle, $iRadius) _SetColourFill(0) _SetLineWidth(0) EndFunc ;==>_Draw_Rectangle ; #FUNCTION# ==================================================================================================================== ; Name ..........: _DrawCircle ; Description ...: Draw circle ; Syntax ........: _DrawCircle( $x , $y , $iRadius [, $sStyle = $PDF_STYLE_STROKED ] ) ; Parameters ....: $x - unknown value. ; $y - unknown value. ; $iRadius - unknown value. ; $sStyle - [optional] string value. ; $PDF_STYLE_STROKED - unknown value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _DrawCircle($x, $y, $iRadius, $sStyle = $PDF_STYLE_STROKED) _MoveTo($x, $y - $iRadius) __Curve($x + 0.55 * $iRadius, $y - $iRadius, $x + $iRadius, $y - 0.55 * $iRadius, $x + $iRadius, $y, $PDF_STYLE_NONE) __Curve($x + $iRadius, $y + 0.55 * $iRadius, $x + 0.55 * $iRadius, $y + $iRadius, $x, $y + $iRadius, $PDF_STYLE_NONE) __Curve($x - 0.55 * $iRadius, $y + $iRadius, $x - $iRadius, $y + 0.55 * $iRadius, $x - $iRadius, $y, $PDF_STYLE_NONE) __Curve($x - $iRadius, $y - 0.55 * $iRadius, $x - 0.55 * $iRadius, $y - $iRadius, $x, $y - $iRadius, $PDF_STYLE_NONE) _Path($sStyle) EndFunc ;==>_DrawCircle ; #FUNCTION# ==================================================================================================================== ; Name ..........: _DrawCurve ; Description ...: Draw a curved line ; Syntax ........: _DrawCurve( $iX , $iY , $iX1 , $iY1 , $iX2 , $iY2 , $iX3 , $iY3 [, $lStyle , $PDF_STYLE_STROKED [, $iDash1 [, ; $iDash2 ]]] ) ; Parameters ....: $iX1 - X value of the first point. ; $iY1 - Y value of the first point. ; $iX2 - X value of the second point. ; $iY2 - Y value of the second point. ; $iX3 - X value of the third point. ; $iY3 - Y value of the third point. ; $iX4 - X value of the fourth point. ; $iY4 - Y value of the fourth point. ; $lStyle - [optional] style of the line (default = STROKED) ; $iDash1 - [optional] integer value. ; $iDash2 - [optional] integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _DrawCurve($iX1, $iY1, $iX2, $iY2, $iX3, $iY3, $iX4, $iY4, $lStyle = $PDF_STYLE_STROKED, $iDash1 = 0, $iDash2 = 0) If $iDash1 = 0 And $iDash2 = 0 Then _SetDash(0) Else _SetDash($iDash1, $iDash2) EndIf _MoveTo($iX1, $iY1) __Curve($iX2, $iY2, $iX3, $iY3, $iX4, $iY4, $lStyle) _SetDash(0) EndFunc ;==>_DrawCurve ; #FUNCTION# ==================================================================================================================== ; Name ..........: _DrawLine ; Description ...: Draw a line ; Syntax ........: _DrawLine( $iXStart , $iYStart , $iXEnd , $iYEnd [, $sStyle , $PDF_STYLE_STROKED [, $iLineCap [, ; $iLineWidth [, $lColourStroke [, $iDash1 [, $iDash2 ]]]]]] ) ; Parameters ....: $iXStart - integer value. ; $iYStart - integer value. ; $iXEnd - integer value. ; $iYEnd - integer value. ; $sStyle - [optional] string value (default = STROKED). ; $iLineCap - [optional] integer value. ; $iLineWidth - [optional] integer value. ; $lColourStroke - [optional] unknown value. ; $iDash1 - [optional] integer value. ; $iDash2 - [optional] integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _DrawLine($iXStart, $iYStart, $iXEnd, $iYEnd, $sStyle = $PDF_STYLE_STROKED, $iLineCap = 1, $iLineWidth = 0.05, $lColourStroke = 0x000000, $iDash1 = 0, $iDash2 = 0) If $iDash1 = 0 And $iDash2 = 0 Then _SetDash(0) Else _SetDash($iDash1, $iDash2) EndIf _SetLineCap($iLineCap) _SetLineWidth($iLineWidth) _SetColourStroke($lColourStroke) _MoveTo($iXStart, $iYStart) _LineTo($iXEnd, $iYEnd, $sStyle) _SetLineCap(0) _SetLineWidth(0) _SetColourStroke(0) _SetDash(0) EndFunc ;==>_DrawLine ; #FUNCTION# ==================================================================================================================== ; Name ..........: _DrawText ; Description ...: Write text ; Syntax ........: _DrawText( $iX , $iY , $sText , $sFontAlias , $iFontSize [, $iAlign , $PDF_ALIGN_LEFT [, $iRotate ]] ) ; Parameters ....: $iX - integer value. ; $iY - integer value. ; $sText - string value. ; $sFontAlias - string value. ; $iFontSize - integer value. ; $iAlign - [optional] integer value. ; $PDF_ALIGN_LEFT - unknown value. ; $iRotate - [optional] integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _DrawText($iX, $iY, $sText, $sFontAlias, $iFontSize, $iAlign = $PDF_ALIGN_LEFT, $iRotate = 0) Local $PI Local $sTeta Local $cTeta Local $C Local $l Switch $iAlign Case $PDF_ALIGN_LEFT Case $PDF_ALIGN_RIGHT $l = _GetTextLength($sText, $sFontAlias, $iFontSize) $iX -= $l Case $PDF_ALIGN_CENTER $l = _GetTextLength($sText, $sFontAlias, $iFontSize) $iX -= $l / 2 EndSwitch __ToBuffer("BT") __ToBuffer("/" & $sFontAlias & " " & __ToStr($iFontSize) & " Tf") If $iRotate <> 0 Then $PI = 3.141592 $C = $PI / 180 $sTeta = Sin($C * $iRotate) $cTeta = Cos($C * $iRotate) __ToBuffer(__ToStr($cTeta) & " " & __ToStr($sTeta) & " " & __ToStr(-$sTeta) & " " & __ToStr($cTeta) & " " & __ToStr(__ToSpace($iX)) & " " & __ToStr(__ToSpace($iY)) & " Tm") Else __ToBuffer(__ToStr(__ToSpace($iX)) & " " & __ToStr(__ToSpace($iY)) & " Td") EndIf __ToBuffer("(" & __ToPdfStr($sText) & ") Tj") __ToBuffer("ET") EndFunc ;==>_DrawText ; #FUNCTION# ==================================================================================================================== ; Name ..........: _EndObject ; Description ...: End editing the current object ; Syntax ........: _EndObject( ) ; Parameters ....: ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: _StartObject() ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _EndObject() $_iTmpOffset = $_Offset - $_iTmpOffset __ToBuffer("endstream") __EndObj() __InitObj() __ToBuffer($_iTmpOffset) __EndObj() EndFunc ;==>_EndObject ; #FUNCTION# ==================================================================================================================== ; Name ..........: _EndPage ; Description ...: End the currend page ; Syntax ........: _EndPage( ) ; Parameters ....: ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: _BeginPage() ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _EndPage() $_iTmpOffset = $_Offset - $_iTmpOffset __ToBuffer("endstream") __EndObj() ; Scrie dimensiunea __InitObj() __ToBuffer($_iTmpOffset) __EndObj() EndFunc ;==>_EndPage ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GetMargin ; Description ...: Get the working area's margin ; Syntax ........: _GetMargin( ) ; Parameters ....: ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _GetMargin() Return $__SetMargin EndFunc ;==>_GetMargin ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GetPageHeight ; Description ...: Get the height of the page ; Syntax ........: _GetPageHeight( ) ; Parameters ....: ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _GetPageHeight() Return $_PageHeight EndFunc ;==>_GetPageHeight ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GetPageWidth ; Description ...: Get the width of the page ; Syntax ........: _GetPageWidth( ) ; Parameters ....: ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _GetPageWidth() Return $_PageWidth EndFunc ;==>_GetPageWidth ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GetTextLength ; Description ...: Get the length of a string ; Syntax ........: _GetTextLength( $sText , $sFontAlias , $iFontSize ) ; Parameters ....: $sText - string value. ; $sFontAlias - string value. ; $iFontSize - integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _GetTextLength($sText, $sFontAlias, $iFontSize) Local $k = StringInStr($_sFONTNAME, "<" & $sFontAlias & ">") Local $C Local $l = StringLen($sText) Local $j = 0 If $k > 0 Then $k += StringLen($sFontAlias) + 2 For $i = 1 To $l $C = Asc(StringMid($sText, $i, 1)) $k += _Iif(($C >= $FirstChar) And ($C <= $LastChar), $Widths[$C], $MissingWidth) If $C = 32 Then $j += 1 Next EndIf Return __ToUser((($k * $iFontSize / 1000) + ($j * $_WordSpacing) + ($l * $_CharSpacing)) * ($_TextScaling / 100)) EndFunc ;==>_GetTextLength ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GetUnit ; Description ...: Get the unit used ; Syntax ........: _GetUnit( ) ; Parameters ....: ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _GetUnit() Local $lRet Switch $__SetUnit Case $PDF_UNIT_PT $lRet = 1 Case $PDF_UNIT_INCH $lRet = 72 Case $PDF_UNIT_CM $lRet = 72 / 2.54 Case $PDF_UNIT_MM $lRet = 72 / 25.4 EndSwitch Return $lRet EndFunc ;==>_GetUnit ; #FUNCTION# ==================================================================================================================== ; Name ..........: _InitPDF ; Description ...: Initialize the pdf ; Syntax ........: _InitPDF( [$sFileName] ) ; Parameters ....: $sFileName - [optional] string value. ; $PDF_NAME - unknown value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _InitPDF($sFileName = "") ;If $sFileName = "" Then $sFileName = @ScriptDir & "\Demo.pdf" ;cleanup first ;$_FileName = FileOpen($sFileName, 18) __ToBuffer($PDF_VERSION) $_iMaxObject = 0 __InitObj(1) __ToBuffer("<>") __EndObj() __InitObj(2) __ToBuffer("<>") __EndObj() $_iMaxObject = 4 $PDF_NAME = $sFileName EndFunc ;==>_InitPDF ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Insert3DCube ; Description ...: Insert a 3D shape ; Syntax ........: _Insert3DCube( $iX , $iY , $iW , $iH [, $iEndColour [, $fDepth [, $iRadius [, $iBorderWidth ]]]] ) ; Parameters ....: $iX - integer value. ; $iY - integer value. ; $iW - integer value. ; $iH - integer value. ; $iEndColour - [optional] integer value. ; $fDepth - [optional] boolean value. ; $iRadius - [optional] integer value. ; $iBorderWidth - [optional] integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Insert3DCube($iX, $iY, $iW, $iH, $iEndColour = 0x0000ff, $fDepth = 0.5, $iRadius = 0.1, $iBorderWidth = 0.02) Local $Ri, $Rf, $Rs, $Gi, $Gf, $Gs, $Bi, $Bf, $Bs, $m = $fDepth Local $lFillColour = 0x000000 $Bi = Mod($lFillColour, 256) $Gi = BitAND($lFillColour / 256, 255) $Ri = BitAND($lFillColour / 65536, 255) $Bf = Mod($iEndColour, 256) $Gf = BitAND($iEndColour / 256, 255) $Rf = BitAND($iEndColour / 65536, 255) $Bs = Abs($Ri - $Rf) / $m $Gs = Abs($Gi - $Gf) / $m $Rs = Abs($Bi - $Bf) / $m If $Rf < $Ri Then $Rs = -$Rs If $Gf < $Gi Then $Gs = -$Gs If $Bf < $Bi Then $Bs = -$Bs For $i = 0 To $fDepth Step 0.02 $Rf = $Ri + $Rs * $i $Gf = $Gi + $Gs * $i $Bf = $Bi + $Bs * $i Local $lFillColour2 = Dec(Hex($Bf, 2) & Hex($Gf, 2) & Hex($Rf, 2)) _SetColourStroke($lFillColour2) _SetColourFill($lFillColour2) _SetLineWidth($iBorderWidth) _Rectangle($iX + $fDepth - $i, $iY + $fDepth - $i, $iW, $iH, $PDF_STYLE_FILLED, $iRadius) _SetColourFill(0) _SetColourStroke(0) _SetLineWidth(0) Next EndFunc ;==>_Insert3DCube ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Insert3DPie ; Description ...: Draw a pie ; Syntax ........: _Insert3DPie( $iX , $iY [, $iRadius [, $iStartAngle [, $iEndAngle [, $iEndColour [, $fDepth [, $iRatio [, ; $bPie [, $iRotate [, $iQuality [, $sStyle , $PDF_STYLE_FILLED [, $iBorderWidth ]]]]]]]]]]] ) ; Parameters ....: $iX - integer value. ; $iY - integer value. ; $iRadius - [optional] integer value. ; $iStartAngle - [optional] integer value. ; $iEndAngle - [optional] integer value. ; $iEndColour - [optional] integer value. ; $fDepth - [optional] boolean value. ; $iRatio - [optional] integer value. ; $bPie - [optional] binary value. ; $iRotate - [optional] integer value. ; $iQuality - [optional] integer value. ; $sStyle - [optional] string value. ; $iBorderWidth - [optional] integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Insert3DPie($iX, $iY, $iRadius = 2.5, $iStartAngle = 0, $iEndAngle = 360, $iEndColour = 0x888888, $fDepth = 0.2, $iRatio = 1, $bPie = True, $iRotate = 0, $iQuality = 1, $sStyle = $PDF_STYLE_FILLED, $iBorderWidth = 0.02) Local $Ri, $Rf, $Rs, $Gi, $Gf, $Gs, $Bi, $Bf, $Bs, $m = $fDepth Local $lFillColour = 0x000000 $Bi = Mod($lFillColour, 256) $Gi = BitAND($lFillColour / 256, 255) $Ri = BitAND($lFillColour / 65536, 255) $Bf = Mod($iEndColour, 256) $Gf = BitAND($iEndColour / 256, 255) $Rf = BitAND($iEndColour / 65536, 255) $Bs = Abs($Ri - $Rf) / $m $Gs = Abs($Gi - $Gf) / $m $Rs = Abs($Bi - $Bf) / $m If $Rf < $Ri Then $Rs = -$Rs If $Gf < $Gi Then $Gs = -$Gs If $Bf < $Bi Then $Bs = -$Bs _SetLineWidth($iBorderWidth) Local $lFillColour2 For $i = 0 To $fDepth Step 0.02 $Rf = $Ri + $Rs * $i $Gf = $Gi + $Gs * $i $Bf = $Bi + $Bs * $i $lFillColour2 = Dec(Hex($Bf, 2) & Hex($Gf, 2) & Hex($Rf, 2)) _SetColourStroke($lFillColour2) _SetColourFill($lFillColour2) _SetLineWidth($iBorderWidth) _DrawArc($iX - $i, $iY - $i, $iRadius, $iStartAngle, $iEndAngle, $iRatio, $bPie, $iRotate, $iQuality, $sStyle) Next _SetColourStroke(0) _SetColourFill(0) _SetLineWidth(0) EndFunc ;==>_Insert3DPie ; #FUNCTION# ==================================================================================================================== ; Name ..........: _InsertImage ; Description ...: Insert a image in the pdf ; Syntax ........: _InsertImage( $sAlias , $iX , $iY [, $iW [, $iH ]] ) ; Parameters ....: $sAlias - string value. ; $iX - integer value. ; $iY - integer value. ; $iW - [optional] integer value. ; $iH - [optional] integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _InsertImage($sAlias, $iX, $iY, $iW = 0, $iH = 0) If $iW = 0 And $iH = 0 Then $iW = $_iImageW $iH = $_iImageH EndIf __ToBuffer("q" & @CRLF & __ToStr(__ToSpace($iW)) & " " & " 0 0 " & __ToStr(__ToSpace($iH)) & " " & __ToStr(__ToSpace($iX)) & " " & __ToStr(__ToSpace($iY)) & " cm" & "/" & $sAlias & " Do" & @CRLF & "Q") EndFunc ;==>_InsertImage ; #FUNCTION# ==================================================================================================================== ; Name ..........: _InsertRenderedText ; Description ...: Insert rendered text ; Syntax ........: _InsertRenderedText( $iX , $iY , $sText , $sAlias [, $_FontSize [, $iScale [, $sAlign = $PDF_ALIGN_LEFT [, ; $iFillColour [, $iOutlineColour ]]]]] ) ; Parameters ....: $iX - integer value. ; $iY - integer value. ; $sText - string value. ; $sAlias - string value. ; $_FontSize - [optional] unknown value. ; $iScale - [optional] integer value. ; $sAlign - [optional] string value. ; $iFillColour - [optional] RGB value. ; $iOutlineColour - [optional] RGB value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _InsertRenderedText($iX, $iY, $sText, $sAlias, $_FontSize = 64, $iScale = 100, $sAlign = $PDF_ALIGN_LEFT, $iFillColour = 0x996600, $iOutlineColour = 0x111111) _SetColourFill($iFillColour) _SetColourStroke($iOutlineColour) _SetTextRenderingMode(2) _SetTextHorizontalScaling($iScale) _DrawText($iX, $iY, $sText, $sAlias, $_FontSize, $sAlign) _SetTextRenderingMode(0) _SetTextHorizontalScaling(100) _SetColourFill(0) _SetColourStroke(0) EndFunc ;==>_InsertRenderedText ; #FUNCTION# ==================================================================================================================== ; Name ..........: _LineTo ; Description ...: Append straight line segment to path ; Syntax ........: _LineTo( $iX , $iY [, $sStyle = $PDF_STYLE_STROKED ] ) ; Parameters ....: $iX - integer value. ; $iY - integer value. ; $sStyle - [optional] string value. ; |$PDF_STYLE_STROKED ; $PDF_STYLE_FILLED ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _LineTo($iX, $iY, $sStyle = $PDF_STYLE_STROKED) __ToBuffer(__ToStr(__ToSpace($iX)) & " " & __ToStr(__ToSpace($iY)) & " l") _Path($sStyle) EndFunc ;==>_LineTo ; #FUNCTION# ==================================================================================================================== ; Name ..........: _LoadFontStandard ; Description ...: Load standard font (Type 1) ; Courier Helvetica Times-Roman Symbol ; Courier-Bold Helvetica-Bold Times-Bold ZapfDingbats ; Courier-Oblique Helvetica-Oblique Times-Italic ; Courier-BoldOblique Helvetica-BoldOblique Times-BoldItalic ; Syntax ........: _LoadFontStandard( $sAlias , $BaseFont [, $sOptions , $PDF_FONT_NORMAL ] ) ; Parameters ....: $sAlias - an alias for the font, to use in the script. ; $BaseFont - one of the following ; |$PDF_FONT_STD_HELVETICA ; |$PDF_FONT_STD_COURIER ; |$PDF_FONT_STD_SYMBOL ; |$PDF_FONT_STD_ZAPFDINGBATS ; |$PDF_FONT_STD_ARIAL ; |$PDF_FONT_STD_TIMES ; $sOptions - [optional] style value. ; |$PDF_FONT_NORMAL = 0 ; |$PDF_FONT_BOLD = 1 ; |$PDF_FONT_ITALIC = 2 ; |$PDF_FONT_BOLDITALIC = 4 ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _LoadFontStandard($sAlias, $BaseFont, $sOptions = $PDF_FONT_NORMAL) Local $sTemp $BaseFont = StringReplace($BaseFont, " ", "") Switch $sOptions Case $PDF_FONT_BOLD $sTemp = ",Bold" Case $PDF_FONT_BOLDITALIC $sTemp = ",BoldItalic" Case $PDF_FONT_ITALIC $sTemp = ",Italic" EndSwitch Local $i = __InitObj() __ToBuffer("<< /Type /Font /Subtype /Type1 /Name /" & $sAlias & " /BaseFont /" & $BaseFont & $sTemp & " /Encoding /WinAnsiEncoding >>") __EndObj() $_sFONT = $_sFONT & "/" & $sAlias & " " & $i & " 0 R " & @CRLF EndFunc ;==>_LoadFontStandard ; #FUNCTION# ==================================================================================================================== ; Name ..........: _LoadFontTT ; Description ...: Load one of the True Type Fonts included ; Syntax ........: _LoadFontTT( $sAlias , $BaseFont [, $sOptions = $PDF_FONT_NORMAL ] ) ; Parameters ....: $sAlias - string value. ; $BaseFont - one of the following: ; |$PDF_FONT_COURIER ; |$PDF_FONT_ARIAL ; |$PDF_FONT_TIMES ; |$PDF_FONT_SYMBOL ; $sOptions - [optional] font style (normal, bold, bold-italic). ; |$PDF_FONT_NORMAL = 0 ; |$PDF_FONT_BOLD = 1 ; |$PDF_FONT_ITALIC = 2 ; |$PDF_FONT_BOLDITALIC = 4 ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _LoadFontTT($sAlias, $BaseFont, $sOptions = $PDF_FONT_NORMAL) Local $sTemp = "" $_Font = $_Font + 1 $BaseFont = StringUpper(StringReplace($BaseFont, " ", "")) Switch $BaseFont Case "TIMESNEWROMAN" __FontTimes($sOptions) Case "COURIERNEW" __FontCourier($sOptions) Case "SYMBOL" __FontSymbol($sOptions) Case Else __FontArial($sOptions) EndSwitch Local $i = __InitObj() __ToBuffer("<< /Type /Font /Subtype /TrueType /Name /" & $sAlias & " /BaseFont /" & $BaseFont & " /FirstChar " & $FirstChar & " /LastChar " & $LastChar & " /FontDescriptor " & $i + 1 & " 0 R /Encoding /WinAnsiEncoding /Widths [") For $j = $FirstChar To $LastChar If $Widths[$j - $FirstChar] <> 0 Then $sTemp &= __ToStr($Widths[$j - $FirstChar]) & " " If Mod($j - $FirstChar + 1, 16) = 0 Or $j = $LastChar Then __ToBuffer($sTemp) $sTemp = "" EndIf EndIf Next __ToBuffer("] >>") __EndObj() $_sFONT = $_sFONT & "/" & $sAlias & " " & $i & " 0 R " & @CRLF $_sFONTNAME = $_sFONTNAME & "<" & $sAlias & ">" & StringRight("0000" & $_Font, 4) & ";" $i = __InitObj() __ToBuffer("<< /Type /FontDescriptor /FontName /" & $BaseFont & $Param & ">>") __EndObj() EndFunc ;==>_LoadFontTT ; #FUNCTION# ==================================================================================================================== ; Name ..........: _LoadResImage ; Description ...: Load a image in the pdf (if you use it multiple times it decreases the size of the pdf) ; Syntax ........: _LoadResImage( $sImgAlias , $sImage ) ; Parameters ....: $sImgAlias - an alias to identify the image in the pdf (e.g. "Cheese"). ; $sImage - image path. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: Image types accepted: BMP, GIF, TIF, TIFF, PNG, JPG, JPEG (those are tested) ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _LoadResImage($sImgAlias, $sImage) Local $iW, $iH, $sColor, $iObj, $ImgBuf, $sExt, $hImage, $hImageExt, $newImg, $hTmpImage, $aRet, $aTmp, $ImgBPP, $sColorSp, $hClone, $hBrush, $hGraphics If $sImgAlias = "" Then __Error("You don't have an alias for the image") If $sImage = "" Or FileExists($sImage) = 0 Then __Error("You don't have any images to insert or the path is invalid") Else $sExt = StringRegExp($sImage, "(^.*)\\(.*)\.(.*)$", 3) $hImageExt = StringUpper($sExt[2]) $newImg = _TempFile(@TempDir, "~", ".jpg") Switch $hImageExt Case "BMP", "GIF", "TIF", "TIFF", "PNG", "JPG", "JPEG" _GDIPlus_Startup() $hTmpImage = _GDIPlus_ImageLoadFromFile($sImage) ; Create 24 bit bitmap clone $iW = _GDIPlus_ImageGetWidth($hTmpImage) $iH = _GDIPlus_ImageGetHeight($hTmpImage) $hClone = _GDIPlus_BitmapCloneArea($hTmpImage, 0, 0, $iW, $iH, $GDIP_PXF24RGB) ; creez o pensula $hBrush = _GDIPlus_BrushCreateSolid() ; determin culoarea initiala (negru) ; si o setez la alb _GDIPlus_BrushSetSolidColor($hBrush, 0xFFFFFFFF) ; apoi determin DC al zonei clonate $hGraphics = _GDIPlus_ImageGetGraphicsContext($hClone) ; o "umplu" cu alb _GDIPlus_GraphicsFillRect($hGraphics, 0, 0, $iW, $iH, $hBrush) ; si apoi suprapun imaginea initiala _GDIPlus_GraphicsDrawImage($hGraphics, $hTmpImage, 0, 0) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2) ; si o salvez _GDIPlus_ImageSaveToFile($hClone, $newImg) ; si eliberez resursele _GDIPlus_BrushDispose($hBrush) _GDIPlus_BitmapDispose($hClone) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_ImageDispose($hTmpImage) $hImage = _GDIPlus_ImageLoadFromFile($newImg) ; get pixel format $aRet = _GDIPlus_ImageGetPixelFormat($hImage) $aTmp = StringSplit($aRet[1], " ", 3) $ImgBPP = $aTmp[0] $sColorSp = $aTmp[2] _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Case Else __Error("The image is invalid") Exit EndSwitch EndIf $ImgBuf = __ToBinary($newImg) $_iImageW = $iW $_iImageH = $iH $iObj = __InitObj() __ToBuffer("<>" & @CRLF & _ "stream" & @CRLF & _ $ImgBuf & @CRLF & _ "endstream") __EndObj() $_Image &= "/" & $sImgAlias & " " & $iObj & " 0 R " & @CRLF __InitObj() __ToBuffer(StringLen($ImgBuf)) __EndObj() If $ImgBPP <= 8 Then __InitObj() $sColor = BinaryToString($sColorSp) __ToBuffer("<< /Length " & StringLen($sColor) & " >>" & @CRLF & _ "stream" & @CRLF & _ $sColor & @CRLF & _ "endstream") __EndObj() EndIf FileDelete($newImg) EndFunc ;==>_LoadResImage ; #FUNCTION# ==================================================================================================================== ; Name ..........: _OpenAfter ; Description ...: Choose to open or not the pdf after generating ; Syntax ........: _OpenAfter( [ $bO ] ) ; Parameters ....: $bO - [optional] True/False. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _OpenAfter($bO = True) $_bOpen = $bO EndFunc ;==>_OpenAfter ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Paragraph ; Description ...: Insert paragraph on page ; Syntax ........: _Paragraph( $sText , $iX , $iY [, $iWidth [, $sFontAlias [, $iFontSize [, $iRotate ]]]] ) ; Parameters ....: $sText - text string. ; $iX - left value. ; $iY - top value. ; $iWidth - [optional] width. ; $sFontAlias - [optional] font alias. ; $iFontSize - [optional] font size. ; $iRotate - [optional] angle. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Paragraph($sText, $iX, $iY, $iWidth = 0, $sFontAlias = "", $iFontSize = 12, $iRotate = 0) _SetColourFill(0) _SetColourStroke(0) _SetTextRenderingMode(0) Local $iUnit = Round(_GetUnit()) Local $iPagina = Round(_GetPageWidth() / $iUnit) If $iWidth = 0 Then $iWidth = Round($iPagina - 1.75 * $iX, 2) Local $lScale = 100 Local $sRand = "" Local $r = 0 Local $iCuvinte = StringSplit($sText, " ", 3) For $i = 0 To UBound($iCuvinte) - 1 $sRand &= $iCuvinte[$i] & " " Local $ssr = Round(_GetTextLength($sRand, $sFontAlias, $iFontSize) * $iUnit) Switch $ssr Case 1 To Round($iWidth * $iUnit, 2) If $i = UBound($iCuvinte) - 1 Then _DrawText($iX, $iY - Round($r * (($iFontSize * 1.2) / $iUnit), 2), $sRand, $sFontAlias, $iFontSize, $PDF_ALIGN_LEFT, $iRotate) EndIf ContinueLoop Case Else $lScale = Round($iWidth * 100 * $iUnit / $ssr, 1) _SetTextHorizontalScaling($lScale) _DrawText($iX, $iY - Round($r * ($iFontSize * 1.2) / $iUnit, 2), $sRand, $sFontAlias, $iFontSize, $PDF_ALIGN_LEFT, $iRotate) _SetTextHorizontalScaling(100) EndSwitch $sRand = "" $r += 1 Next EndFunc ;==>_Paragraph ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Rectangle ; Description ...: Draw a _Rectangle ; Syntax ........: _Rectangle( $iX , $iY , $iW , $iH [, $sStyle , $PDF_STYLE_STROKED [, $iRadius ]] ) ; Parameters ....: $iX - Left value. ; $iY - Top value. ; $iW - Width. ; $iH - Height. ; $sStyle - [optional] string value. ; |$PDF_STYLE_STROKED ; |$PDF_STYLE_FILLED ; $iRadius - [optional] integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Rectangle($iX, $iY, $iW, $iH, $sStyle = $PDF_STYLE_STROKED, $iRadius = 0) Local $iR __ToBuffer("n") If $iRadius > 0 Then If $iRadius > ($iW / 2) Then $iRadius = $iW / 2 If $iRadius > ($iH / 2) Then $iRadius = $iH / 2 $iR = 0.55 * $iRadius _MoveTo($iX + $iRadius, $iY) _LineTo($iX + $iW - $iRadius, $iY, $PDF_STYLE_NONE) __Curve(($iX + $iW - $iRadius + $iR), $iY, $iX + $iW, $iY + $iRadius - $iR, $iX + $iW, $iY + $iRadius, $PDF_STYLE_NONE) _LineTo($iX + $iW, $iY + $iH - $iRadius, $PDF_STYLE_NONE) __Curve($iX + $iW, $iY + $iH - $iRadius + $iR, $iX + $iW - $iRadius + $iR, $iY + $iH, $iX + $iW - $iRadius, $iY + $iH, $PDF_STYLE_NONE) _LineTo($iX + $iRadius, $iY + $iH, $PDF_STYLE_NONE) __Curve($iX + $iRadius - $iR, $iY + $iH, $iX, $iY + $iH - $iRadius + $iR, $iX, $iY + $iH - $iRadius, $PDF_STYLE_NONE) _LineTo($iX, $iY + $iRadius, $PDF_STYLE_NONE) __Curve($iX, $iY + $iRadius - $iR, $iX + $iRadius - $iR, $iY, $iX + $iRadius, $iY, $PDF_STYLE_NONE) Else __ToBuffer(__ToStr(__ToSpace($iX)) & " " & __ToStr(__ToSpace($iY)) & " " & __ToStr(__ToSpace($iW)) & " " & __ToStr(__ToSpace($iH)) & " re") EndIf _Path($sStyle) EndFunc ;==>_Rectangle ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetCharSpacing ; Description ...: Set the space between characters ; Syntax ........: _SetCharSpacing( $iW ) ; Parameters ....: $iW - integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetCharSpacing($iW) $_CharSpacing = $iW __ToBuffer(__ToStr($_CharSpacing) & " Tc") EndFunc ;==>_SetCharSpacing ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetColourFill ; Description ...: Set the fill colour ; Syntax ........: _SetColourFill( $rgb ) ; Parameters ....: $rgb - RGB value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetColourFill($rgb) Local $r, $G, $B If ($rgb <= 0) And ($rgb >= -255) Then __ToBuffer(__ToStr(-$rgb / 255) & " g") Else $B = Mod($rgb, 256) $G = Mod(($rgb / 256), 256) $r = Mod(($rgb / 65536), 256) __ToBuffer(__ToStr($r / 255) & " " & __ToStr($G / 255) & " " & __ToStr($B / 255) & " rg") EndIf EndFunc ;==>_SetColourFill ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetColourStroke ; Description ...: Set the stroke colour ; Syntax ........: _SetColourStroke( $rgb ) ; Parameters ....: $rgb - RGB value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetColourStroke($rgb) Local $r, $G, $B If ($rgb <= 0) And ($rgb >= -255) Then __ToBuffer(__ToStr(-$rgb / 255) & " G") Else $B = Mod($rgb, 256) $G = Mod(($rgb / 256), 256) $r = Mod(($rgb / 65536), 256) __ToBuffer(__ToStr($r / 255) & " " & __ToStr($G / 255) & " " & __ToStr($B / 255) & " RG") EndIf EndFunc ;==>_SetColourStroke ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetDash ; Description ...: The line dash pattern controls the pattern of dashes and gaps used to stroke paths. ; Syntax ........: _SetDash( $dash_on [, $dash_off ] ) ; Parameters ....: $dash_on - unknown value. ; $dash_off - [optional] unknown value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetDash($dash_on, $dash_off = 0) If ($dash_on = 0) And ($dash_off = 0) Then __ToBuffer("[ ] 0 d") Else __ToBuffer("[" & __ToStr(__ToSpace($dash_on)) & " " & __ToStr(__ToSpace($dash_off)) & "] 0 d") EndIf EndFunc ;==>_SetDash ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetKeywords ; Description ...: Sets the keywords property of the pdf ; Syntax ........: _SetKeywords( [ $sKeywords ] ) ; Parameters ....: $sKeywords - [optional] string value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetKeywords($sKeywords = "") $PDF_KEYWORDS = $sKeywords EndFunc ;==>_SetKeywords ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetLayoutMode ; Description ...: Sets the layout mode when pdf is displayed ; Syntax ........: _SetLayoutMode( $sL ) ; Parameters ....: $sL - string value. ; |$PDF_LAYOUT_SINGLE = 0 ; |$PDF_LAYOUT_CONTINOUS = 1 ; |$PDF_LAYOUT_TWO = 2 ; |$PDF_LAYOUT_DEFAULT = 4 ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetLayoutMode($sL) Switch $sL Case $PDF_LAYOUT_SINGLE, $PDF_LAYOUT_CONTINOUS, $PDF_LAYOUT_TWO, $PDF_LAYOUT_DEFAULT $_LayoutMode = $sL Case Else $_LayoutMode = $PDF_LAYOUT_SINGLE EndSwitch EndFunc ;==>_SetLayoutMode ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetLineCap ; Description ...: The line cap style specifies the shape to be used at the ends of open subpaths (and dashes, if any) when they are stroked. ; Syntax ........: _SetLineCap( $iW ) ; Parameters ....: $iW - integer value. ; |0 = Butt cap. ; |1 = Round cap. ; |2 = Projecting square cap. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetLineCap($iW) If ($iW >= 0) And ($iW <= 2) Then __ToBuffer(__ToStr($iW) & " J") EndFunc ;==>_SetLineCap ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetLineJoin ; Description ...: The line join style specifies the shape to be used at the corners of paths that are stroked. ; Syntax ........: _SetLineJoin( $iW ) ; Parameters ....: $iW - integer value. ; |0 = Miter join. ; |1 = Round join. ; |2 = Bevel join. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetLineJoin($iW) If ($iW >= 0) And ($iW <= 2) Then __ToBuffer(__ToStr($iW) & " j") EndFunc ;==>_SetLineJoin ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetMargin ; Description ...: Set the interior margin of the working area. ; Syntax ........: _SetMargin( $iValue ) ; Parameters ....: $iValue - integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetMargin($iValue) $__SetMargin = __ToSpace($iValue) EndFunc ;==>_SetMargin ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetMiterLimit ; Description ...: When two line segments meet at a sharp angle and mitered joins have been specified as the line join style, ; it is possible for the miter to extend far beyond the thickness of the line stroking the path. ; The miter limit imposes a maximum on the ratio of the miter length to the line width. ; Syntax ........: _SetMiterLimit($iW) ; Parameters ....: $iW - integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetMiterLimit($iW) If ($iW >= 1) Then __ToBuffer(__ToStr($iW) & " M") EndFunc ;==>_SetMiterLimit ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetOrientation ; Description ...: Set the orientation of the pages in pdf ; Syntax ........: _SetOrientation( [ $iOrientation = $PDF_ORIENTATION_PORTRAIT ] ) ; Parameters ....: $iOrientation - [optional] integer value. ; |$PDF_ORIENTATION_PORTRAIT ; |$PDF_ORIENTATION_LANDSCAPE ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetOrientation($iOrientation = $PDF_ORIENTATION_PORTRAIT) $_Orientation = $iOrientation EndFunc ;==>_SetOrientation ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetPageHeight ; Description ...: Set the height of the page ; Syntax ........: _SetPageHeight( $iH ) ; Parameters ....: $iH - integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetPageHeight($iH) If $_PaperSize <> $PDF_PAGE_CUSTOM Then $_PaperSize = $PDF_PAGE_CUSTOM $_PageHeight = __ToSpace($iH) EndFunc ;==>_SetPageHeight ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetPageWidth ; Description ...: Set the width of the page ; Syntax ........: _SetPageWidth( $iW ) ; Parameters ....: $iW - integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetPageWidth($iW) If $_PaperSize <> $PDF_PAGE_CUSTOM Then $_PaperSize = $PDF_PAGE_CUSTOM $_PageWidth = __ToSpace($iW) EndFunc ;==>_SetPageWidth ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetPaperSize ; Description ...: Sets the paper size of the pdf ; Syntax ........: _SetPaperSize( $_sFormatPage [, $iWidth [, $iHeight ]] ) ; Parameters ....: $_sFormatPage - integer value. ; |$PDF_PAGE_A4 = 0 ; |$PDF_PAGE_A3 = 1 ; |$PDF_PAGE_LETTER = 2 ; |$PDF_PAGE_LEGAL = 4 ; |$PDF_PAGE_CUSTOM = 8 (in this case set the width an height) ; $iWidth - [optional] integer value. ; $iHeight - [optional] integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetPaperSize($_sFormatPage, $iWidth = -1, $iHeight = -1) $_PaperSize = $_sFormatPage Switch $_sFormatPage Case $PDF_PAGE_LEGAL $_PageWidth = 612 $_PageHeight = 1008 Case $PDF_PAGE_LETTER $_PageWidth = 612 $_PageHeight = 792 Case $PDF_PAGE_A3 $_PageWidth = 842 $_PageHeight = 1190.5 Case $PDF_PAGE_A4 ;default $_PageWidth = 595.2 $_PageHeight = 842 Case $PDF_PAGE_CUSTOM If $iWidth = -1 Or $iHeight = -1 Then $_PageWidth = 595.2 $_PageHeight = 842 Else $_PageWidth = $iWidth $_PageHeight = $iHeight EndIf Case Else $_PageWidth = 595.2 $_PageHeight = 842 EndSwitch EndFunc ;==>_SetPaperSize ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetSubject ; Description ...: Set the subject of the pdf ; Syntax ........: _SetSubject( [ $sSubject ] ) ; Parameters ....: $sSubject - [optional] string value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: See the properties of the pdf ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetSubject($sSubject = "") $PDF_SUBJECT = $sSubject EndFunc ;==>_SetSubject ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetTextHorizontalScaling ; Description ...: The horizontal scaling parameter adjusts the width of glyphs by stretching or ; shrinking them in the horizontal direction. Its value is specified as a percentage of ; the normal width of the glyphs, with 100 being the normal width. The scaling ; always applies to the x coordinate in text space, independently of the writing mode. ; Syntax ........: _SetTextHorizontalScaling($iW) ; Parameters ....: $iW - integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetTextHorizontalScaling($iW) $_TextScaling = $iW __ToBuffer(__ToStr($_TextScaling) & " Tz") Return $_TextScaling EndFunc ;==>_SetTextHorizontalScaling ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetTextRenderingMode ; Description ...: The text rendering mode determines whether showing text causes glyph ; outlines to be stroked, filled, used as a clipping path, or some combination of ; these operations. ; Syntax ........: _SetTextRenderingMode( [ $iW ] ) ; Parameters ....: $iW - [optional] integer value. ; |0 - Fill text. ; |1 - Stroke text. ; |2 - Fill, then stroke, text. ; |3 - Neither fill nor stroke text (invisible). ; |4 - Fill text and add to path for clipping (see above). ; |5 - Stroke text and add to path for clipping. ; |6 - Fill, then stroke, text and add to path for clipping. ; |7 - Add text to path for clipping. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetTextRenderingMode($iW = 0) If ($iW >= 0) And ($iW <= 7) Then __ToBuffer(__ToStr($iW) & " Tr") EndFunc ;==>_SetTextRenderingMode ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetTextRiseMode ; Description ...: Specifies the distance, in unscaled text space units, to move the ; baseline up or down from its default location. Positive values of text rise move the ; baseline up. Adjustments to the baseline are useful for drawing superscripts or ; subscripts. The default location of the baseline can be restored by setting the text ; rise to 0. Text rise always applies to the y coordinate in text space, regardless of the writing mode. ; Syntax ........: _SetTextRiseMode($iW) ; Parameters ....: $iW - integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetTextRiseMode($iW) __ToBuffer(__ToStr($iW) & " Ts") EndFunc ;==>_SetTextRiseMode ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetTitle ; Description ...: Set the title property of the pdf ; Syntax ........: _SetTitle( [ $sTitle ] ) ; Parameters ....: $sTitle - [optional] string value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetTitle($sTitle = "") $PDF_TITLE = $sTitle EndFunc ;==>_SetTitle ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetUnit ; Description ...: Set the unit used in pdf ; Syntax ........: _SetUnit( [ $sUnit = $PDF_UNIT_CM ] ) ; Parameters ....: $sUnit ; |$PDF_UNIT_PT or 1 ; |$PDF_UNIT_INCH or 2 ; |$PDF_UNIT_MM or 4 ; |$PDF_UNIT_CM or 8 ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetUnit($sUnit = $PDF_UNIT_CM) $__SetUnit = $sUnit EndFunc ;==>_SetUnit ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetWordSpacing ; Description ...: Set the space between words ; Syntax ........: _SetWordSpacing($iW) ; Parameters ....: $iW - integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetWordSpacing($iW) $_WordSpacing = $iW __ToBuffer(__ToStr($_WordSpacing) & " Tw") EndFunc ;==>_SetWordSpacing ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetZoomMode ; Description ...: Set the zoom when the pdf is opened ; Syntax ........: _SetZoomMode( $sZmd [, $iZoom ] ) ; Parameters ....: $sZmd - zoom mode ; |$PDF_ZOOM_FULLPAGE ; |$PDF_ZOOM_FULLWIDTH ; |$PDF_ZOOM_REAL ; |$PDF_ZOOM_DEFAULT ; |$PDF_ZOOM_CUSTOM - in that case put the percentage on $iZoom ; $iZoom - [optional] integer value. ; Return values .: $_ZoomMode ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetZoomMode($sZmd, $iZoom = 100) Switch $sZmd Case $PDF_ZOOM_FULLPAGE, $PDF_ZOOM_FULLWIDTH, $PDF_ZOOM_REAL, $PDF_ZOOM_DEFAULT $_ZoomMode = $sZmd Case $PDF_ZOOM_CUSTOM $_ZoomMode = $iZoom Case Else $_ZoomMode = $PDF_ZOOM_FULLPAGE EndSwitch EndFunc ;==>_SetZoomMode ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StartObject ; Description ...: Initialize an object (e.g. image, header, text...) to be inserted on the pdf. ; Syntax ........: _StartObject( $sAlias [, $Opt ] ) ; Parameters ....: $sName - string value. ; $Opt - [optional] . ; |$PDF_OBJECT_FIRSTPAGE ; |$PDF_OBJECT_ALLPAGES ; |$PDF_OBJECT_EVENPAGES ; |$PDF_OBJECT_ODDPAGES ; |$PDF_OBJECT_NOTFIRSTPAGE ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: Always close it with _EndObject() ; Related .......: _EndObject() ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _StartObject($sAlias, $Opt = $PDF_OBJECT_NONE) Local $i = __InitObj() __ToBuffer("<< /Type /XObject /Subtype /Form /FormType 1 /Name /" & $sAlias & " /BBox [" & __ToStr($__SetMargin) & " " & __ToStr($__SetMargin) & " " & __ToStr($_PageWidth - $__SetMargin) & " " & __ToStr($_PageHeight - $__SetMargin) & "] /Matrix [1 0 0 1 0 0] /Length " & $i + 1 & " 0 R >>" & @CRLF & _ "stream") $_iTmpOffset = $_Offset $_sObject = $_sObject & "/" & $sAlias & " " & $i & " 0 R " & @CRLF $_iObject = $_iObject + 1 ReDim $aOBJECTS[$_iObject] For $_iObject In $aOBJECTS $PDF_OBJECT_NAME = $sAlias $PDF_OBJECT_OPTIONS = $Opt Next EndFunc ;==>_StartObject ; #FUNCTION# ==================================================================================================================== ; Name ..........: _DrawArc ; Description ...: Draw arc ; Syntax ........: _DrawArc( $iX , $iY , $iRadius [, $iStartAngle [, $iEndAngle [, $iRatio [, $bPie [, $iRotate [, $iQuality [, ; $sOptions = $PDF_STYLE_STROKED ]]]]]]] ) ; Parameters ....: $iX - integer value. ; $iY - integer value. ; $iRadius - integer value. ; $iStartAngle - [optional] integer value. ; $iEndAngle - [optional] integer value. ; $iRatio - [optional] integer value. ; $bPie - [optional] bool value. ; $iRotate - [optional] integer value. ; $iQuality - [optional] integer value. ; $sOptions - [optional] string value. ; $PDF_STYLE_STROKED - unknown value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _DrawArc($iX, $iY, $iRadius, $iStartAngle = 0, $iEndAngle = 360, $iRatio = 1, $bPie = False, $iRotate = 0, $iQuality = 1, $sOptions = $PDF_STYLE_STROKED) Local $i Local $rad Local $PI Local $sTeta Local $cTeta Local $C Local $iX1, $iX2 Local $iY1, $iY2 __ToBuffer("n") _MoveTo($iX, $iY) If ($sOptions And $PDF_STYLE_FILLED) <> 0 Then $bPie = True $PI = 3.141592 $C = $PI / 180 $sTeta = Sin(-$C * $iRotate) $cTeta = Cos(-$C * $iRotate) For $i = $iStartAngle To $iEndAngle Step $iQuality $rad = $C * $i $iX2 = $iRadius * Cos($rad) $iY2 = ($iRadius * $iRatio) * Sin($rad) $iX1 = $iX2 * $cTeta + $iY2 * $sTeta $iY1 = -$iX2 * $sTeta + $iY2 * $cTeta If ($i = $iStartAngle) And (Not $bPie) Then _MoveTo($iX + $iX1, $iY + $iY1) _LineTo($iX + $iX1, $iY + $iY1, $PDF_STYLE_NONE) Next If $bPie Then _LineTo($iX, $iY, $PDF_STYLE_NONE) _Path($sOptions) EndFunc ;==>_DrawArc ; =============================================================================================================================== ; =============================================================================================================================== ; =============================================================================================================================== Func __Curve($iX1, $iY1, $iX2, $iY2, $iX3, $iY3, $sOptions = $PDF_STYLE_STROKED) __ToBuffer(__ToStr(__ToSpace($iX1)) & " " & __ToStr(__ToSpace($iY1)) & " " & __ToStr(__ToSpace($iX2)) & " " & __ToStr(__ToSpace($iY2)) & " " & __ToStr(__ToSpace($iX3)) & " " & __ToStr(__ToSpace($iY3)) & " c") _Path($sOptions) EndFunc ;==>__Curve ; #FUNCTION# ==================================================================================================================== ; Name ..........: _MoveTo ; Description ...: Begin new subpath ; Syntax ........: _MoveTo( $x , $y ) ; Parameters ....: $x - unknown value. ; $y - unknown value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _MoveTo($x, $y) __ToBuffer(__ToStr(__ToSpace($x)) & " " & __ToStr(__ToSpace($y)) & " m") EndFunc ;==>_MoveTo ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Pages ; Description ...: Return number of pages ; Syntax ........: _Pages( ) ; Parameters ....: None ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Pages() Return $_Pages EndFunc ;==>_Pages ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Path ; Description ...: Paths define shapes, trajectories, and regions of all sorts. They are used to draw ; lines, define the shapes of filled areas, and specify boundaries for clipping other ; graphics. ; Syntax ........: _Path( [ $sStyle = $PDF_STYLE_NONE ] ) ; Parameters ....: $sStyle - [optional] string value. ; |See the $PDF_STYLE_~ constants ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Path($sStyle = $PDF_STYLE_NONE) If ($sStyle And ($PDF_STYLE_FILLED Or $PDF_STYLE_STROKED Or $PDF_STYLE_CLOSED)) = ($PDF_STYLE_FILLED Or $PDF_STYLE_STROKED Or $PDF_STYLE_CLOSED) Then __ToBuffer("b") ElseIf ($sStyle And ($PDF_STYLE_FILLED Or $PDF_STYLE_STROKED)) = ($PDF_STYLE_FILLED Or $PDF_STYLE_STROKED) Then __ToBuffer("B") ElseIf ($sStyle And $PDF_STYLE_FILLED) = $PDF_STYLE_FILLED Then __ToBuffer("f") Else If ($sStyle And $PDF_STYLE_CLOSED) <> 0 Then __ToBuffer("h") If ($sStyle And $PDF_STYLE_STROKED) <> 0 Then __ToBuffer("S") EndIf EndFunc ;==>_Path ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SetLineWidth ; Description ...: Set the line width ; Syntax ........: _SetLineWidth( $iW ) ; Parameters ....: $iW - integer value. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SetLineWidth($iW) __ToBuffer(__ToStr(__ToSpace($iW)) & " w") EndFunc ;==>_SetLineWidth #region FUNCTIONS #region #INTERNAL_USE_ONLY# Func __DrawObject($sName) __ToBuffer("/" & $sName & " Do") EndFunc ;==>__DrawObject Func __EndObj() $_Buffer &= "endobj" & @CRLF EndFunc ;==>__EndObj Func __Error($sErr) MsgBox(16, "PDF Error", "You have an error on line " & @ScriptLineNumber & "." & @CRLF & "Reason: " & $sErr & @CRLF & "Press OK to exit.") Exit EndFunc ;==>__Error Func __FontArial($Style = $PDF_FONT_NORMAL) $BaseFont = "Arial" $FirstChar = 32 $LastChar = 255 $MissingWidth = 272 Local $aTemp[$LastChar - $FirstChar + 1] Switch $Style Case $PDF_FONT_NORMAL $aTemp = StringSplit("278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 750, 556, 750, 222, 556, 333, 1000, 556, 556, 333, 1000, 667, 333, 1000, 750, 611, 750, 750, 222, 222, 333, 333, 350, 556, 1000, 333, 1000, 500, 333, 944, 750, 500, 667, 278, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 333, 737, 552, 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500", ", ", 3) $Param = "/Flags 32 /FontBBox [-250 -221 1190 1000] " & _ "/MissingWidth 272 /StemV 80 " & _ "/StemH 80 /ItalicAngle 0 /CapHeight 905 /XHeight 453 " & _ "/Ascent 905 /Descent -212 /Leading 150 " & _ "/MaxWidth 992 /AvgWidth 441" Case $PDF_FONT_BOLD $BaseFont = $BaseFont & ",Bold" $aTemp = StringSplit("278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 750, 556, 750, 278, 556, 500, 1000, 556, 556, 333, 1000, 667, 333, 1000, 750, 611, 750, 750, 278, 278, 500, 500, 350, 556, 1000, 333, 1000, 556, 333, 944, 750, 500, 667, 278, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 333, 737, 552, 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556", ", ", 3) $Param = "/Flags 16416 /FontBBox [-250 -212 1120 1000] " & _ "/MissingWidth 311 /StemV 153 " & _ "/StemH 153 /ItalicAngle 0 /CapHeight 905 /XHeight 453 " & _ "/Ascent 905 /Descent -212 /Leading 150 " & _ "/MaxWidth 933 /AvgWidth 479" $MissingWidth = 311 Case $PDF_FONT_ITALIC $BaseFont = $BaseFont & ",Italic" $aTemp = StringSplit("278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 750, 556, 750, 222, 556, 333, 1000, 556, 556, 333, 1000, 667, 333, 1000, 750, 611, 750, 750, 222, 222, 333, 333, 350, 556, 1000, 333, 1000, 500, 333, 944, 750, 500, 667, 278, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 333, 737, 552, 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500", ", ", 3) $Param = "/Flags 96 /FontBBox [-250 -212 1134 1000] " & _ "/MissingWidth 259 /StemV 80 " & _ "/StemH 80 /ItalicAngle -11 /CapHeight 905 /XHeight 453 " & _ "/Ascent 905 /Descent -212 /Leading 150 " & _ "/MaxWidth 945 /AvgWidth 441" $MissingWidth = 259 Case $PDF_FONT_BOLDITALIC $BaseFont = $BaseFont & ",BoldItalic" $aTemp = StringSplit("278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 750, 556, 750, 278, 556, 500, 1000, 556, 556, 333, 1000, 667, 333, 1000, 750, 611, 750, 750, 278, 278, 500, 500, 350, 556, 1000, 333, 1000, 556, 333, 944, 750, 500, 667, 278, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 333, 737, 552, 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556", ", ", 3) $Param = "/Flags 16480 /FontBBox [-250 -212 1120 1000] " & _ "/MissingWidth 311 /StemV 153 " & _ "/StemH 153 /ItalicAngle -11 /CapHeight 905 /XHeight 453 " & _ "/Ascent 905 /Descent -212 /Leading 150 " & _ "/MaxWidth 933 /AvgWidth 479" $MissingWidth = 311 EndSwitch For $i = $FirstChar To $LastChar $Widths[$i] = $aTemp[$i - $FirstChar] Next Local $aRetTmp[6] = [$BaseFont, $FirstChar, $LastChar, $Param, $Widths, $MissingWidth] Return $aRetTmp EndFunc ;==>__FontArial Func __FontCourier($Style = $PDF_FONT_NORMAL) $BaseFont = "CourierNew" $FirstChar = 32 $LastChar = 255 $MissingWidth = 600 Local $aTemp[$LastChar - $FirstChar + 1] Switch $Style Case $PDF_FONT_NORMAL $aTemp = StringSplit("600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600", ", ", 3) $Param = "/Flags 34 /FontBBox [-250 -300 720 1000] " & _ "/MissingWidth 600 /StemV 109 " & _ "/StemH 109 /ItalicAngle 0 /CapHeight 833 /XHeight 417 " & _ "/Ascent 833 /Descent -300 /Leading 133 " & _ "/MaxWidth 600 /AvgWidth 600" Case $PDF_FONT_BOLD $BaseFont = $BaseFont & ",Bold" $aTemp = StringSplit("600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600", ", ", 3) $Param = "/Flags 16418 /FontBBox [-250 -300 720 1000] " & _ "/MissingWidth 600 /StemV 191 " & _ "/StemH 191 /ItalicAngle 0 /CapHeight 833 /XHeight 417 " & _ "/Ascent 833 /Descent -300 /Leading 133 " & _ "/MaxWidth 600 /AvgWidth 600" Case $PDF_FONT_ITALIC $BaseFont = $BaseFont & ",Italic" $aTemp = StringSplit("600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600", ", ", 3) $Param = "/Flags 98 /FontBBox [-250 -300 720 1000] " & _ "/MissingWidth 600 /StemV 109 " & _ "/StemH 109 /ItalicAngle -11 /CapHeight 833 /XHeight 417 " & _ "/Ascent 833 /Descent -300 /Leading 133 " & _ "/MaxWidth 600 /AvgWidth 600" Case $PDF_FONT_BOLDITALIC $BaseFont = $BaseFont & ",BoldItalic" $aTemp = StringSplit("600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600", ", ", 3) $Param = "/Flags 16482 /FontBBox [-250 -300 720 1000] " & _ "/MissingWidth 600 /StemV 191 " & _ "/StemH 191 /ItalicAngle -11 /CapHeight 833 /XHeight 417 " & _ "/Ascent 833 /Descent -300 /Leading 133 " & _ "/MaxWidth 600 /AvgWidth 600" EndSwitch For $i = $FirstChar To $LastChar $Widths[$i] = $aTemp[$i - $FirstChar] Next Local $aRetTmp[6] = [$BaseFont, $FirstChar, $LastChar, $Param, $Widths, $MissingWidth] Return $aRetTmp EndFunc ;==>__FontCourier Func __FontSymbol($Style = $PDF_FONT_NORMAL) $BaseFont = "Symbol" $FirstChar = 30 $LastChar = 255 $MissingWidth = 332 Local $aTemp[$LastChar - $FirstChar + 1] Switch $Style Case $PDF_FONT_NORMAL $aTemp = StringSplit("600, 600, 250, 333, 713, 500, 549, 833, 778, 439, 333, 333, 500, 549, 250, 549, 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 278, 278, 549, 549, 549, 444, 549, 722, 667, 722, 612, 611, 763, 603, 722, 333, 631, 722, 686, 889, 722, 722, 768, 741, 556, 592, 611, 690, 439, 768, 645, 795, 611, 333, 863, 333, 658, 500, 500, 631, 549, 549, 494, 439, 521, 411, 603, 329, 603, 549, 549, 576, 521, 549, 549, 521, 549, 603, 439, 576, 713, 686, 493, 686, 494, 480, 200, 480, 549, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 620, 247, 549, 167, 713, 500, 753, 753, 753, 753, 1042, 987, 603, 987, 603, 400, 549, 411, 549, 549, 713, 494, 460, 549, 549, 549, 549, 1000, 603, 1000, 658, 823, 686, 795, 987, 768, 768, 823, 768, 768, 713, 713, 713, 713, 713, 713, 713, 768, 713, 790, 790, 890, 823, 549, 250, 713, 603, 603, 1042, 987, 603, 987, 603, 494, 329, 790, 790, 786, 713, 384, 384, 384, 384, 384, 384, 494, 494, 494, 494, 600, 329, 274, 686, 686, 686, 384, 384, 384, 384, 384, 384, 494, 494, 494, 600", ", ", 3) $Param = "/Flags 6 /FontBBox [-250 -220 1246 1005] " & _ "/MissingWidth 332 /StemV 109 " & _ "/StemH 109 /ItalicAngle 0 /CapHeight 1005 /XHeight 503 " & _ "/Ascent 1005 /Descent -220 /Leading 225 " & _ "/MaxWidth 1038 /AvgWidth 601" Case $PDF_FONT_BOLD $BaseFont = $BaseFont & ",Bold" $aTemp = StringSplit("600, 600, 250, 333, 713, 500, 549, 833, 778, 439, 333, 333, 500, 549, 250, 549, 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 278, 278, 549, 549, 549, 444, 549, 722, 667, 722, 612, 611, 763, 603, 722, 333, 631, 722, 686, 889, 722, 722, 768, 741, 556, 592, 611, 690, 439, 768, 645, 795, 611, 333, 863, 333, 658, 500, 500, 631, 549, 549, 494, 439, 521, 411, 603, 329, 603, 549, 549, 576, 521, 549, 549, 521, 549, 603, 439, 576, 713, 686, 493, 686, 494, 480, 200, 480, 549, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 620, 247, 549, 167, 713, 500, 753, 753, 753, 753, 1042, 987, 603, 987, 603, 400, 549, 411, 549, 549, 713, 494, 460, 549, 549, 549, 549, 1000, 603, 1000, 658, 823, 686, 795, 987, 768, 768, 823, 768, 768, 713, 713, 713, 713, 713, 713, 713, 768, 713, 790, 790, 890, 823, 549, 250, 713, 603, 603, 1042, 987, 603, 987, 603, 494, 329, 790, 790, 786, 713, 384, 384, 384, 384, 384, 384, 494, 494, 494, 494, 600, 329, 274, 686, 686, 686, 384, 384, 384, 384, 384, 384, 494, 494, 494, 600", ", ", 3) $Param = "/Flags 16390 /FontBBox [-250 -220 1246 1005] " & _ "/MissingWidth 332 /StemV 191 " & _ "/StemH 191 /ItalicAngle 0 /CapHeight 1005 /XHeight 503 " & _ "/Ascent 1005 /Descent -220 /Leading 225 " & _ "/MaxWidth 1038 /AvgWidth 600" Case $PDF_FONT_ITALIC $BaseFont = $BaseFont & ",Italic" $aTemp = StringSplit("600, 600, 250, 333, 713, 500, 549, 833, 778, 439, 333, 333, 500, 549, 250, 549, 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 278, 278, 549, 549, 549, 444, 549, 722, 667, 722, 612, 611, 763, 603, 722, 333, 631, 722, 686, 889, 722, 722, 768, 741, 556, 592, 611, 690, 439, 768, 645, 795, 611, 333, 863, 333, 658, 500, 500, 631, 549, 549, 494, 439, 521, 411, 603, 329, 603, 549, 549, 576, 521, 549, 549, 521, 549, 603, 439, 576, 713, 686, 493, 686, 494, 480, 200, 480, 549, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 620, 247, 549, 167, 713, 500, 753, 753, 753, 753, 1042, 987, 603, 987, 603, 400, 549, 411, 549, 549, 713, 494, 460, 549, 549, 549, 549, 1000, 603, 1000, 658, 823, 686, 795, 987, 768, 768, 823, 768, 768, 713, 713, 713, 713, 713, 713, 713, 768, 713, 790, 790, 890, 823, 549, 250, 713, 603, 603, 1042, 987, 603, 987, 603, 494, 329, 790, 790, 786, 713, 384, 384, 384, 384, 384, 384, 494, 494, 494, 494, 600, 329, 274, 686, 686, 686, 384, 384, 384, 384, 384, 384, 494, 494, 494, 600", ", ", 3) $Param = "/Flags 70 /FontBBox [-250 -220 1246 1005] " & _ "/MissingWidth 332 /StemV 109 " & _ "/StemH 109 /ItalicAngle -11 /CapHeight 1005 /XHeight 503 " & _ "/Ascent 1005 /Descent -220 /Leading 225 " & _ "/MaxWidth 1038 /AvgWidth 600" Case $PDF_FONT_BOLDITALIC $BaseFont = $BaseFont & ",BoldItalic" $aTemp = StringSplit("600, 600, 250, 333, 713, 500, 549, 833, 778, 439, 333, 333, 500, 549, 250, 549, 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 278, 278, 549, 549, 549, 444, 549, 722, 667, 722, 612, 611, 763, 603, 722, 333, 631, 722, 686, 889, 722, 722, 768, 741, 556, 592, 611, 690, 439, 768, 645, 795, 611, 333, 863, 333, 658, 500, 500, 631, 549, 549, 494, 439, 521, 411, 603, 329, 603, 549, 549, 576, 521, 549, 549, 521, 549, 603, 439, 576, 713, 686, 493, 686, 494, 480, 200, 480, 549, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 620, 247, 549, 167, 713, 500, 753, 753, 753, 753, 1042, 987, 603, 987, 603, 400, 549, 411, 549, 549, 713, 494, 460, 549, 549, 549, 549, 1000, 603, 1000, 658, 823, 686, 795, 987, 768, 768, 823, 768, 768, 713, 713, 713, 713, 713, 713, 713, 768, 713, 790, 790, 890, 823, 549, 250, 713, 603, 603, 1042, 987, 603, 987, 603, 494, 329, 790, 790, 786, 713, 384, 384, 384, 384, 384, 384, 494, 494, 494, 494, 600, 329, 274, 686, 686, 686, 384, 384, 384, 384, 384, 384, 494, 494, 494, 600", ", ", 3) $Param = "/Flags 16454 /FontBBox [-250 -220 1246 1005] " & _ "/MissingWidth 332 /StemV 191 " & _ "/StemH 191 /ItalicAngle -11 /CapHeight 1005 /XHeight 503 " & _ "/Ascent 1005 /Descent -220 /Leading 225 " & _ "/MaxWidth 1038 /AvgWidth 600" EndSwitch For $i = $FirstChar To $LastChar $Widths[$i] = $aTemp[$i - $FirstChar] Next Local $aRetTmp[6] = [$BaseFont, $FirstChar, $LastChar, $Param, $Widths, $MissingWidth] Return $aRetTmp EndFunc ;==>__FontSymbol Func __FontTimes($Style = $PDF_FONT_NORMAL) $BaseFont = "TimesNewRoman" $FirstChar = 32 $LastChar = 255 $MissingWidth = 333 Local $aTemp[$LastChar - $FirstChar + 1] Switch $Style Case $PDF_FONT_NORMAL $aTemp = StringSplit("250, 333, 408, 500, 500, 833, 778, 180, 333, 333, 500, 564, 250, 333, 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 278, 278, 564, 564, 564, 444, 921, 722, 667, 667, 722, 611, 556, 722, 722, 333, 389, 722, 611, 889, 722, 722, 556, 722, 667, 556, 611, 722, 722, 944, 722, 722, 611, 333, 278, 333, 469, 500, 333, 444, 500, 444, 500, 444, 333, 500, 500, 278, 278, 500, 278, 778, 500, 500, 500, 500, 333, 389, 278, 500, 500, 722, 500, 500, 444, 480, 200, 480, 541, 778, 500, 778, 333, 500, 444, 1000, 500, 500, 333, 1000, 556, 333, 889, 778, 611, 778, 778, 333, 333, 444, 444, 350, 500, 1000, 333, 980, 389, 333, 722, 778, 444, 722, 250, 333, 500, 500, 500, 500, 200, 500, 333, 760, 276, 500, 564, 333, 760, 500, 400, 549, 300, 300, 333, 576, 453, 250, 333, 300, 310, 500, 750, 750, 750, 444, 722, 722, 722, 722, 722, 722, 889, 667, 611, 611, 611, 611, 333, 333, 333, 333, 722, 722, 722, 722, 722, 722, 722, 564, 722, 722, 722, 722, 722, 722, 556, 500, 444, 444, 444, 444, 444, 444, 667, 444, 444, 444, 444, 444, 278, 278, 278, 278, 500, 500, 500, 500, 500, 500, 500, 549, 500, 500, 500, 500, 500, 500, 500, 500", ", ", 3) $Param = "/Flags 34 /FontBBox [-250 -216 1200 1000] " & _ "/MissingWidth 333 /StemV 73 " & _ "/StemH 73 /ItalicAngle 0 /CapHeight 891 /XHeight 446 " & _ "/Ascent 891 /Descent -216 /Leading 149 " & _ "/MaxWidth 1000 /AvgWidth 401" Case $PDF_FONT_BOLD $BaseFont = $BaseFont & ",Bold" $aTemp = StringSplit("250, 333, 555, 500, 500, 1000, 833, 278, 333, 333, 500, 570, 250, 333, 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, 570, 570, 570, 500, 930, 722, 667, 722, 722, 667, 611, 778, 778, 389, 500, 778, 667, 944, 722, 778, 611, 778, 722, 556, 667, 722, 722, 1000, 722, 722, 667, 333, 278, 333, 581, 500, 333, 500, 556, 444, 556, 444, 333, 500, 556, 278, 333, 556, 278, 833, 556, 500, 556, 556, 444, 389, 333, 556, 500, 722, 500, 500, 444, 394, 220, 394, 520, 778, 500, 778, 333, 500, 500, 1000, 500, 500, 333, 1000, 556, 333, 1000, 778, 667, 778, 778, 333, 333, 500, 500, 350, 500, 1000, 333, 1000, 389, 333, 722, 778, 444, 722, 250, 333, 500, 500, 500, 500, 220, 500, 333, 747, 300, 500, 570, 333, 747, 500, 400, 549, 300, 300, 333, 576, 540, 250, 333, 300, 330, 500, 750, 750, 750, 500, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 389, 389, 389, 389, 722, 722, 778, 778, 778, 778, 778, 570, 778, 722, 722, 722, 722, 722, 611, 556, 500, 500, 500, 500, 500, 500, 722, 444, 444, 444, 444, 444, 278, 278, 278, 278, 500, 556, 500, 500, 500, 500, 500, 549, 500, 556, 556, 556, 556, 500, 556, 500", ", ", 3) $Param = "/Flags 16418 /FontBBox [-250 -216 1201 1000] " & _ "/MissingWidth 333 /StemV 136 " & _ "/StemH 136 /ItalicAngle 0 /CapHeight 891 /XHeight 446 " & _ "/Ascent 891 /Descent -216 /Leading 149 " & _ "/MaxWidth 1001 /AvgWidth 401" Case $PDF_FONT_ITALIC $BaseFont = $BaseFont & ",Italic" $aTemp = StringSplit("250, 333, 420, 500, 500, 833, 778, 214, 333, 333, 500, 675, 250, 333, 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, 675, 675, 675, 500, 920, 611, 611, 667, 722, 611, 611, 722, 722, 333, 444, 667, 556, 833, 667, 722, 611, 722, 611, 500, 556, 722, 611, 833, 611, 556, 556, 389, 278, 389, 422, 500, 333, 500, 500, 444, 500, 444, 278, 500, 500, 278, 278, 444, 278, 722, 500, 500, 500, 500, 389, 389, 278, 500, 444, 667, 444, 444, 389, 400, 275, 400, 541, 778, 500, 778, 333, 500, 556, 889, 500, 500, 333, 1000, 500, 333, 944, 778, 556, 778, 778, 333, 333, 556, 556, 350, 500, 889, 333, 980, 389, 333, 667, 778, 389, 556, 250, 389, 500, 500, 500, 500, 275, 500, 333, 760, 276, 500, 675, 333, 760, 500, 400, 549, 300, 300, 333, 576, 523, 250, 333, 300, 310, 500, 750, 750, 750, 500, 611, 611, 611, 611, 611, 611, 889, 667, 611, 611, 611, 611, 333, 333, 333, 333, 722, 667, 722, 722, 722, 722, 722, 675, 722, 722, 722, 722, 722, 556, 611, 500, 500, 500, 500, 500, 500, 500, 667, 444, 444, 444, 444, 444, 278, 278, 278, 278, 500, 500, 500, 500, 500, 500, 500, 549, 500, 500, 500, 500, 500, 444, 500, 444", ", ", 3) $Param = "/Flags 98 /FontBBox [-250 -216 1200 1000] " & _ "/MissingWidth 333 /StemV 73 " & _ "/StemH 73 /ItalicAngle -11 /CapHeight 891 /XHeight 446 " & _ "/Ascent 891 /Descent -216 /Leading 149 " & _ "/MaxWidth 1000 /AvgWidth 402" Case $PDF_FONT_BOLDITALIC $BaseFont = $BaseFont & ",BoldItalic" $aTemp = StringSplit("250, 389, 555, 500, 500, 833, 778, 278, 333, 333, 500, 570, 250, 333, 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, 570, 570, 570, 500, 832, 667, 667, 667, 722, 667, 667, 722, 778, 389, 500, 667, 611, 889, 722, 722, 611, 722, 667, 556, 611, 722, 667, 889, 667, 611, 611, 333, 278, 333, 570, 500, 333, 500, 500, 444, 500, 444, 333, 500, 556, 278, 278, 500, 278, 778, 556, 500, 500, 500, 389, 389, 278, 556, 444, 667, 500, 444, 389, 348, 220, 348, 570, 778, 500, 778, 333, 500, 500, 1000, 500, 500, 333, 1000, 556, 333, 944, 778, 611, 778, 778, 333, 333, 500, 500, 350, 500, 1000, 333, 1000, 389, 333, 722, 778, 389, 611, 250, 389, 500, 500, 500, 500, 220, 500, 333, 747, 266, 500, 606, 333, 747, 500, 400, 549, 300, 300, 333, 576, 500, 250, 333, 300, 300, 500, 750, 750, 750, 500, 667, 667, 667, 667, 667, 667, 944, 667, 667, 667, 667, 667, 389, 389, 389, 389, 722, 722, 722, 722, 722, 722, 722, 570, 722, 722, 722, 722, 722, 611, 611, 500, 500, 500, 500, 500, 500, 500, 722, 444, 444, 444, 444, 444, 278, 278, 278, 278, 500, 556, 500, 500, 500, 500, 500, 549, 500, 556, 556, 556, 556, 444, 500, 444", ", ", 3) $Param = "/Flags 16482 /FontBBox [-250 -216 1200 1000] " & _ "/MissingWidth 333 /StemV 131 " & _ "/StemH 131 /ItalicAngle -11 /CapHeight 891 /XHeight 446 " & _ "/Ascent 891 /Descent -216 /Leading 149 " & _ "/MaxWidth 1000 /AvgWidth 412" EndSwitch For $i = $FirstChar To $LastChar $Widths[$i] = $aTemp[$i - $FirstChar] Next Local $aRetTmp[6] = [$BaseFont, $FirstChar, $LastChar, $Param, $Widths, $MissingWidth] Return $aRetTmp EndFunc ;==>__FontTimes Func __InitObj($iObj = 0) If $iObj = 0 Then $iObj = $_iMaxObject + 1 If $iObj > $_iMaxObject Then $_iMaxObject = $iObj ReDim $aXREF[$_iMaxObject + 1] $aXREF[$iObj] = StringRight("0000000000" & ($_Offset + $iObj + 2), 10) & " 00000 n" __ToBuffer($iObj & " 0 obj") Return $iObj EndFunc ;==>__InitObj Func __InsertObjectOnPage() If $_iObject >= 0 Then For $_iObject In $aOBJECTS If ((($PDF_OBJECT_OPTIONS And $PDF_OBJECT_ALLPAGES) = $PDF_OBJECT_ALLPAGES) Or _ ((($PDF_OBJECT_OPTIONS And $PDF_OBJECT_EVENPAGES) <> 0) And (Mod($_Pages, 2) = 0)) Or _ ((($PDF_OBJECT_OPTIONS And $PDF_OBJECT_ODDPAGES) <> 0) And (Mod($_Pages, 2) <> 0)) And (Not _ ((($PDF_OBJECT_OPTIONS And $PDF_OBJECT_NOTFIRSTPAGE) <> 0) And ($_Pages = 1)))) Then __DrawObject($PDF_OBJECT_NAME) EndIf Next EndIf EndFunc ;==>__InsertObjectOnPage Func __Test($sText) ConsoleWrite($sText & @CRLF) EndFunc ;==>__Test Func __ToBinary($sImage) Local $hFile, $Bin $hFile = FileOpen($sImage, 16) $Bin = FileRead($hFile) FileClose($hFile) Return BinaryToString($Bin) EndFunc ;==>__ToBinary Func __ToBuffer($sT) $_Buffer &= $sT & @CRLF EndFunc ;==>__ToBuffer Func __ToPdfStr($Temp) Return StringReplace(StringReplace(StringReplace($Temp, "\", "\\"), "(", "\("), ")", "\)") EndFunc ;==>__ToPdfStr Func __ToSpace($sValue) Local $lRet Switch $__SetUnit Case $PDF_UNIT_PT $lRet = $sValue Case $PDF_UNIT_INCH $lRet = $sValue * 72 Case $PDF_UNIT_CM $lRet = $sValue * 72 / 2.54 Case $PDF_UNIT_MM $lRet = $sValue * 72 / 25.4 EndSwitch Return $lRet EndFunc ;==>__ToSpace Func __ToStr($sValue, $Dec = 3) Return StringReplace(Round($sValue, $Dec), ",", ".") EndFunc ;==>__ToStr Func __ToUser($sValue) Local $lRet Switch $__SetUnit Case $PDF_UNIT_PT $lRet = $sValue Case $PDF_UNIT_INCH $lRet = $sValue / 72 Case $PDF_UNIT_CM $lRet = ($sValue / 72) * 2.54 Case $PDF_UNIT_MM $lRet = ($sValue / 72) * 25.4 EndSwitch Return $lRet EndFunc ;==>__ToUser #endregion #INTERNAL_USE_ONLY#