Jump to content

GRS

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by GRS

  1. Thanks martin. I am running AutoIt version 3.2.12.0, but that was not the only problem. Some how the code in my original post had some strange formating that broke the UDF. I have edited the original post and now it looks correct if you want to give it another try.
  2. I am somewhat new to AutoIt, but have been trying to create a UDF for printing that does not require a DLL external to the OS. I have not been able to add the ability to print images or to change the paper orientation. I have only tested this on WinXP with AutoIt v3.2.12.0. Could someone help add these features(printing images & setting paper orientation)? PrintWinAPI.au3: #include-once #include <WinAPI.au3> #include <FontConstants.au3> #include <GDIPlus.au3> Const $HORZRES = 8 Const $VERTRES = 10 Const $PS_SOLID = 0 Const $PS_DASH = 1 Const $PS_DOT = 2 Const $PS_DASHDOT = 3 Const $PS_DASHDOTDOT = 4 Const $PS_NULL = 5 Const $PS_INSIDEFRAME = 6 Const $AD_COUNTERCLOCKWISE = 1 Const $AD_CLOCKWISE = 2 ;========================================================= Global Const $tagDOCINFO = "int Size;" & _ ; int cbSize; "ptr DocName;" & _ ; LPCTSTR lpszDocName; "ptr Output;" & _ ; LPCTSTR lpszOutput; "ptr Datatype;" & _ ; LPCTSTR lpszDatatype; "dword Type" ; DWORD fwType; ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_CreateDC ; Description ...: Creates a device context (DC) for a device using the specified name. ; Syntax.........: _WinAPI_CreateDC($sDriver, $sDevice) ; Parameters ....: $sDriver - Specifies driver name, "winspool" for printing, "display" for screen ; $sDevice - Specifies device name ; Return values .: Success - handle to a DC for the specified device ; ==================================================================================================== Func _WinAPI_CreateDC($sDriver, $sDevice) Local $aResult $aResult = DllCall("GDI32.dll", "hwnd", "CreateDC", "str", $sDriver, "str", $sDevice, "long", 0, "long", 0) Return $aResult[0] EndFunc ;==>_WinAPI_CreateDC ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_StartDoc ; Description ...: Starts a print job ; Syntax.........: _WinAPI_StartDoc($hDC, $tDocInfo) ; Parameters ....: $hDC - Identifies the device contex ; $tDocInfo - $tagDOCINFO structure that specifies document info ; Return values .: Success - print job identifier for the document ; ==================================================================================================== Func _WinAPI_StartDoc($hDC, $tDocInfo) Local $aResult $aResult = DllCall("GDI32.dll", "long", "StartDoc", "hwnd", $hDC, "ptr", DllStructGetPtr($tDocInfo)) Return $aResult[0] EndFunc ;==>_WinAPI_StartDoc ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_EndDoc ; Description ...: Ends a print job ; Syntax.........: _WinAPI_EndDoc($hDC) ; Parameters ....: $hDC - Identifies the device contex ; Return values .: Success - return value greater than zero ; ==================================================================================================== Func _WinAPI_EndDoc($hDC) Local $aResult $aResult = DllCall("GDI32.dll", "long", "EndDoc", "hwnd", $hDC) Return $aResult[0] EndFunc ;==>_WinAPI_EndDoc ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_StartPage ; Description ...: Prepares the printer driver to accept data ; Syntax.........: _WinAPI_StartPage($hDC) ; Parameters ....: $hDC - Identifies the device contex ; Return values .: Success - return value greater than zero ; ==================================================================================================== Func _WinAPI_StartPage($hDC) Local $aResult $aResult = DllCall("GDI32.dll", "long", "StartPage", "hwnd", $hDC) Return $aResult[0] EndFunc ;==>_WinAPI_StartPage ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_EndPage ; Description ...: Notifies the device that the application has finished writing to a page ; Syntax.........: _WinAPI_EndPage($hDC) ; Parameters ....: $hDC - Identifies the device contex ; Return values .: Success - return value greater than zero ; ==================================================================================================== Func _WinAPI_EndPage($hDC) Local $aResult $aResult = DllCall("GDI32.dll", "long", "EndPage", "hwnd", $hDC) Return $aResult[0] EndFunc ;==>_WinAPI_EndPage ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_TextOut ; Description ...: Writes a character string at the specified location, using the currently selected font, background color, and text color ; Syntax.........: _WinAPI_TextOut($hDC, $iXStart, $iYStart, $sString) ; Parameters ....: $hDC - Identifies the device contex ; $iXStart - x-coordinate of starting position ; $iYStart - y-coordinate of starting position ; $sString - character string ; Return values .: Success - return value is nonzero ; ==================================================================================================== Func _WinAPI_TextOut($hDC, $iXStart, $iYStart, $sString = "") Local $aResult $aResult = DllCall("GDI32.dll", "long", "TextOut", "hwnd", $hDC, "long", $iXStart, "long", $iYStart, "str", $sString, "long", StringLen($sString)) Return $aResult[0] EndFunc ;==>_WinAPI_TextOut ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_CreatePen ; Description ...: Creates a logical pen that has the specified style, width, and color ; Syntax.........: _WinAPI_CreatePen($iPenStyle, $iWidth, $iColor) ; Parameters ....: $iPenStyle - specifies pen style ; $PS_SOLID = 0 ; $PS_DASH = 1 ; $PS_DOT = 2 ; $PS_DASHDOT = 3 ; $PS_DASHDOTDOT = 4 ; $PS_NULL = 5 ; $PS_INSIDEFRAME = 6 ; $iWidth - width of the pen ; $iColor - pen color stated in RGB ; Return values .: Success - Handle to logical pen ; ==================================================================================================== Func _WinAPI_CreatePen($iPenStyle = $PS_SOLID, $iWidth = 0, $iColor = 0x000000) Local $aResult $aResult = DllCall("GDI32.dll", "hwnd", "CreatePen", "int", $iPenStyle, "int", $iWidth, "dword", $iColor) Return $aResult[0] EndFunc ;==>_WinAPI_CreatePen ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_MoveToEx ; Description ...: Updates the current position to the specified point and optionally retrieves the previous position ; Syntax.........: _WinAPI_MoveToEx($hDC, $iX, $iY, $tPoint) ; Parameters ....: $hDC - Identifies the device contex ; $iX - x-coordinate of the new position, in logical units ; $iY - y-coordinate of the new position, in logical units ; $tPoint - $tagPOINT structure that receives the previous position ; Return values .: Success - non-zero value ; ==================================================================================================== Func _WinAPI_MoveToEx($hDC, $iX, $iY, ByRef $tPoint) Local $aResult $aResult = DllCall("GDI32.dll", "long", "MoveToEx", "long", $hDC, "int", $iX, "int", $iY, "ptr", DllStructGetPtr($tPoint)) Return $aResult[0] EndFunc ;==>_WinAPI_MoveToEx ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_LineTo ; Description ...: Draws a line from the current position up to, but not including, the specified point ; Syntax.........: _WinAPI_LineTo($hDC, $iXEnd, $iYEnd) ; Parameters ....: $hDC - Identifies the device contex ; $iXEnd - x-coordinate, in logical units, of the endpoint of the line ; $iYEnd - y-coordinate, in logical units, of the endpoint of the line ; Return values .: Success - non-zero value ; ==================================================================================================== Func _WinAPI_LineTo($hDC, $iXEnd, $iYEnd) Local $aResult $aResult = DllCall("GDI32.dll", "long", "LineTo", "long", $hDC, "int", $iXEnd, "int", $iYEnd) Return $aResult[0] EndFunc ;==>_WinAPI_LineTo ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_SetArcDirection ; Description ...: Sets the drawing direction to be used for arc and rectangle functions ; Syntax.........: _WinAPI_SetArcDirection($hDC, $Direction) ; Parameters ....: $hDC - Identifies the device contex ; $Direction - Specifies the new arc direction ; $AD_COUNTERCLOCKWISE = 1 ; $AD_CLOCKWISE = 2 ; Return values .: Success - old arc direction ; ==================================================================================================== Func _WinAPI_SetArcDirection($hDC, $Direction) Local $aResult $aResult = DllCall("GDI32.dll", "long", "SetArcDirection", "long", $hDC, "int", $Direction) Return $aResult[0] EndFunc ;==>_WinAPI_SetArcDirection ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_ArcTo ; Description ...: Draws an elliptical arc ; Syntax.........: _WinAPI_ArcTo($hDC, $iLeftRect, $iTopRect, $iRightRect, $iBottomRect, $iXRadial1, $iYRadial1, $iXRadial2, $iYRadial2) ; Parameters ....: $hDC - Identifies the device contex ; $iLeftRect - x-coord of rectangle's upper-left corner ; $iTopRect - y-coord of rectangle's upper-left corner ; $iRightRect - x-coord of rectangle's lower-right corner ; $iBottomRect - y-coord of rectangle's lower-right corner ; $iXRadial1 - x-coord of first radial ending point ; $iYRadial1 - y-coord of first radial ending point ; $iXRadial2 - x-coord of second radial ending point ; $iYRadial2 - y-coord of second radial ending point ; Return values .: Success - return value is nonzero ; ==================================================================================================== Func _WinAPI_ArcTo($hDC, $iLeftRect, $iTopRect, $iRightRect, $iBottomRect, $iXRadial1, $iYRadial1, $iXRadial2, $iYRadial2) Local $aResult $aResult = DllCall("GDI32.dll", "long", "ArcTo", "long", $hDC, "int", $iLeftRect, "int", $iTopRect, "int", $iRightRect, "int", $iBottomRect, "int", $iXRadial1, "int", $iYRadial1, "int", $iXRadial2, "int", $iYRadial2) Return $aResult[0] EndFunc ;==>_WinAPI_ArcTo ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_Arc ; Description ...: Draws an elliptical arc ; Syntax.........: _WinAPI_Arc($hDC, $iLeftRect, $iTopRect, $iRightRect, $iBottomRect, $iXStartArc, $iYStartArc, $iXEndArc, $iYEndArc) ; Parameters ....: $hDC - Identifies the device contex ; $iLeftRect - x-coord of rectangle's upper-left corner ; $iTopRect - y-coord of rectangle's upper-left corner ; $iRightRect - x-coord of rectangle's lower-right corner ; $iBottomRect - y-coord of rectangle's lower-right corner ; $iXStartArc - x-coord of first radial ending point ; $iYStartArc - y-coord of first radial ending point ; $iXEndArc - x-coord of second radial ending point ; $iYEndArc - y-coord of second radial ending point ; Return values .: Success - return value is nonzero ; ==================================================================================================== Func _WinAPI_Arc($hDC, $iLeftRect, $iTopRect, $iRightRect, $iBottomRect, $iXStartArc, $iYStartArc, $iXEndArc, $iYEndArc) Local $aResult $aResult = DllCall("GDI32.dll", "long", "Arc", "long", $hDC, "int", $iLeftRect, "int", $iTopRect, "int", $iRightRect, "int", $iBottomRect, "int", $iXStartArc, "int", $iYStartArc, "int", $iXEndArc, "int", $iYEndArc) Return $aResult[0] EndFunc ;==>_WinAPI_Arc ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_Rectangle ; Description ...: Draws a rectangle ; Syntax.........: _WinAPI_Rectangle($hDC, $iLeftRect, $iTopRect, $iRightRect, $iBottomRect) ; Parameters ....: $hDC - Identifies the device contex ; $iLeftRect - x-coord of rectangle's upper-left corner ; $iTopRect - y-coord of rectangle's upper-left corner ; $iRightRect - x-coord of rectangle's lower-right corner ; $iBottomRect - y-coord of rectangle's lower-right corner ; Return values .: Success - return value is nonzero ; ==================================================================================================== Func _WinAPI_Rectangle($hDC, $iLeftRect, $iTopRect, $iRightRect, $iBottomRect) Local $aResult $aResult = DllCall("GDI32.dll", "long", "Rectangle", "long", $hDC, "int", $iLeftRect, "int", $iTopRect, "int", $iRightRect, "int", $iBottomRect) Return $aResult[0] EndFunc ;==>_WinAPI_Rectangle ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_RoundRect ; Description ...: Draws a rectangle ; Syntax.........: _WinAPI_RoundRect($hDC, $iLeftRect, $iTopRect, $iRightRect, $iBottomRect, $iWidth, $iHeight) ; Parameters ....: $hDC - Identifies the device contex ; $iLeftRect - x-coord of rectangle's upper-left corner ; $iTopRect - y-coord of rectangle's upper-left corner ; $iRightRect - x-coord of rectangle's lower-right corner ; $iBottomRect - y-coord of rectangle's lower-right corner ; $iWidth - width of ellipse ; $iHeight - height of ellipse ; Return values .: Success - return value is nonzero ; ==================================================================================================== Func _WinAPI_RoundRect($hDC, $iLeftRect, $iTopRect, $iRightRect, $iBottomRect, $iWidth, $iHeight) Local $aResult $aResult = DllCall("GDI32.dll", "long", "RoundRect", "long", $hDC, "int", $iLeftRect, "int", $iTopRect, "int", $iRightRect, "int", $iBottomRect, "int", $iWidth, "int", $iHeight) Return $aResult[0] EndFunc ;==>_WinAPI_RoundRect ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_Ellipse ; Description ...: Draws a ellipse ; Syntax.........: _WinAPI_Ellipse($hDC, $iLeftRect, $iTopRect, $iRightRect, $iBottomRect) ; Parameters ....: $hDC - Identifies the device contex ; $iLeftRect - x-coord of rectangle's upper-left corner of rectangle ; $iTopRect - y-coord of rectangle's upper-left corner of rectangle ; $iRightRect - x-coord of rectangle's lower-right corner of rectangle ; $iBottomRect - y-coord of rectangle's lower-right corner of rectangle ; Return values .: Success - return value is nonzero ; ==================================================================================================== Func _WinAPI_Ellipse($hDC, $iLeftRect, $iTopRect, $iRightRect, $iBottomRect) Local $aResult $aResult = DllCall("GDI32.dll", "long", "Ellipse", "long", $hDC, "int", $iLeftRect, "int", $iTopRect, "int", $iRightRect, "int", $iBottomRect) Return $aResult[0] EndFunc ;==>_WinAPI_EllipseSample output: Example.au3 #include <PrintWinAPI.au3> ; Create a printer device context $s_DefaultPrinter = _GetDefaultPrinter() $s_PrinterName = InputBox("AutoIt API Printing", "Enter printer name", $s_DefaultPrinter) If $s_PrinterName = "" Then Exit $hPrintDc = _WinAPI_CreateDC("winspool", $s_PrinterName) ; get pixel and twips info $PixelsPerInchY = _WinAPI_GetDeviceCaps($hPrintDc, $__WINAPCONSTANT_LOGPIXELSY) ; Get Pixels Per Inch Y $TwipsPerPixelY = 1440 / $PixelsPerInchY $PixelsPerInchX = _WinAPI_GetDeviceCaps($hPrintDc, $__WINAPCONSTANT_LOGPIXELSX) ; Get Pixels Per Inch X $TwipsPerPixelX = 1440 / $PixelsPerInchX ; get page width and height $PageWidth = _WinAPI_GetDeviceCaps($hPrintDc, $HORZRES) ; Get width, in millimeters, of the physical screen $PageHeight = _WinAPI_GetDeviceCaps($hPrintDc, $VERTRES) ; Get height, in millimeters, of the physical screen. ; set docinfo $s_DocName = "Printing from AutoIt with WinAPI" $DocName = DllStructCreate("char DocName[" & StringLen($s_DocName & Chr(0)) & "]") DllStructSetData($DocName, "DocName", $s_DocName & Chr(0)) ; Size of DOCINFO structure $DOCINFO = DllStructCreate($tagDOCINFO) ; Structure for Print Document info DllStructSetData($DOCINFO, "Size", 20) ; Size of DOCINFO structure DllStructSetData($DOCINFO, "DocName", DllStructGetPtr($DocName)) ; Set name of print job (Optional) ; start new print doc $result = _WinAPI_StartDoc($hPrintDc, $DOCINFO) ; start new page $result = _WinAPI_StartPage($hPrintDc) ; create font $DESIREDFONTSIZE = 16 $hFont = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 0, 0, $FW_NORMAL, True, True, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Verdona') ; set newfond, save old font $hFontOld = _WinAPI_SelectObject($hPrintDc, $hFont) ; print centered test message $s_TextOut = "This is a test..." $OutSize = _WinAPI_GetTextExtentPoint32($hPrintDc, $s_TextOut) ; Compute the starting point for the text-output operation(centered) $xLeft = (($PageWidth / 2) - (DllStructGetData($OutSize, "X") / 2)) ; Compute the starting point for the text-output 2 lines down $yTop = DllStructGetData($OutSize, "Y") * 2 ; Send text $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; create font structure, rotated 180 degrees $lf = DllStructCreate($tagLOGFONT) $DESIREDFONTSIZE = 12 DllStructSetData($lf, "Escapement", 2700) DllStructSetData($lf, "Height", (($DESIREDFONTSIZE * -20) / $TwipsPerPixelY)) DllStructSetData($lf, "Italic", False) DllStructSetData($lf, "Underline", False) DllStructSetData($lf, "FaceName", "Arial") ; set font $hLF = _WinAPI_CreateFontIndirect($lf) $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; Send rotated text to printer, starting at location 1000, 1000 $xLeft = 1000 $yTop = 1000 $s_TextOut = "Testing...123" $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) DllStructSetData($lf, "Escapement", 2250) $hLF = _WinAPI_CreateFontIndirect($lf) $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; Send rotated text to printer, starting at location 1000, 1000 $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 1800, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; Send rotated text to printer, starting at location 1000, 1000 $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 1500, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; Send rotated text to printer, starting at location 1000, 1000 $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 1200, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; Send rotated text to printer, starting at location 1000, 1000 $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 900, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; set textcolor, save last textcolor $iColorOld = _WinAPI_SetTextColor($hPrintDc, 0xFF0000) ; Send rotated text to printer, starting at location 1000, 1000 $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 600, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; set textcolor, save last textcolor $result = _WinAPI_SetTextColor($hPrintDc, 0x00FF00) ; Send rotated text to printer, starting at location 1000, 1000 $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 300, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; set textcolor, save last textcolor $result = _WinAPI_SetTextColor($hPrintDc, 0x0000FF) ; Send rotated text to printer, starting at location 1000, 1000 $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 0, 0, $FW_BOLD, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; set textcolor, save last textcolor $result = _WinAPI_SetTextColor($hPrintDc, 0x0) ; Send rotated text to printer, starting at location 1000, 1000 $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; set textcolor $result = _WinAPI_SetTextColor($hPrintDc, 0x0000FF) ; restore original font $result = _WinAPI_SelectObject($hPrintDc, $hFontOld) ; restore original color $result = _WinAPI_SetTextColor($hPrintDc, $iColorOld) ; delete fonts _WinAPI_DeleteObject($hFont) _WinAPI_DeleteObject($hLF) ; create pens to draw with (PenStyle, Width, RGB-Color) $hPen0 = _WinAPI_CreatePen($PS_SOLID, 0, 0x000000) $hPen1 = _WinAPI_CreatePen($PS_DASH, 0, 0x000000) $hPen2 = _WinAPI_CreatePen($PS_DOT, 0, 0x000000) $hPen3 = _WinAPI_CreatePen($PS_DASHDOT, 0, 0x000000) $hPen4 = _WinAPI_CreatePen($PS_DASHDOTDOT, 0, 0x000000) $hPen5 = _WinAPI_CreatePen($PS_SOLID, 20, 0x000000) $hPen6 = _WinAPI_CreatePen($PS_SOLID, 40, 0x000000) $hPen7 = _WinAPI_CreatePen($PS_SOLID, 40, 0x0000FF) $hPen8 = _WinAPI_CreatePen($PS_SOLID, 40, 0x00FF00) $hPen9 = _WinAPI_CreatePen($PS_SOLID, 40, 0xFF0000) ; set starting point $LastPoint = DllStructCreate($tagPOINT) $result = _WinAPI_MoveToEx($hPrintDc, 1000, 2000, $LastPoint) ; select pen, save old pen $hPenOld = _WinAPI_SelectObject($hPrintDc, $hPen2) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1100, 3000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen4) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1200, 2000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen3) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1300, 3000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen1) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1400, 2000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen0) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1500, 3000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen5) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1600, 2000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen6) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1700, 3000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen7) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1800, 2000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen8) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1900, 3000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen9) ; draw line $result = _WinAPI_LineTo($hPrintDc, 2000, 2000) ; draw arch connected from current point $result = _WinAPI_SetArcDirection($hPrintDc, $AD_CLOCKWISE) $result = _WinAPI_ArcTo($hPrintDc, 2500, 2000, 3000, 2500, 2500, 2500, 3000, 2500) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen4) ; draw arch $result = _WinAPI_Arc($hPrintDc, 2500, 1000, 3500, 1500, 0, 0, 0, 0) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen5) ; create brush $hBrush = _WinAPI_CreateSolidBrush(0x0000FF) ; select brush $hBrushOld = _WinAPI_SelectObject($hPrintDc, $hBrush) ; draw rectangles $result = _WinAPI_Rectangle($hPrintDc, 3500, 2000, 4500, 2500) $result = _WinAPI_RoundRect($hPrintDc, 3500, 2600, 4500, 3100, 200, 200) ; draw circle $result = _WinAPI_Ellipse($hPrintDc, 3300, 1800, 3700, 2200) ; restore original brush $result = _WinAPI_SelectObject($hPrintDc, $hBrushOld) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen2) $result = _WinAPI_Arc($hPrintDc, 3300, 1900, 3700, 2300, 0, 0, 0, 0) ; End the page $result = _WinAPI_EndPage($hPrintDc) ; start new page $result = _WinAPI_StartPage($hPrintDc) ; print centered test message $s_TextOut = "This is page 2" $OutSize = _WinAPI_GetTextExtentPoint32($hPrintDc, $s_TextOut) ; Compute the starting point for the text-output operation(centered) $xLeft = (($PageWidth / 2) - (DllStructGetData($OutSize, "X") / 2)) ; Compute the starting point for the text-output 2 lines down $yTop = DllStructGetData($OutSize, "Y") * 2 ; Send text $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; delete pens _WinAPI_DeleteObject($hPen0) _WinAPI_DeleteObject($hPen1) _WinAPI_DeleteObject($hPen2) _WinAPI_DeleteObject($hPen3) _WinAPI_DeleteObject($hPen4) _WinAPI_DeleteObject($hPen5) _WinAPI_DeleteObject($hPen6) _WinAPI_DeleteObject($hPen7) _WinAPI_DeleteObject($hPen8) _WinAPI_DeleteObject($hPen9) ; delete brush _WinAPI_DeleteObject($hBrush) ; restore original pen $result = _WinAPI_SelectObject($hPrintDc, $hPenOld) ; restore original brush $result = _WinAPI_SelectObject($hPrintDc, $hBrushOld) ; End the page $result = _WinAPI_EndPage($hPrintDc) ; End the print job $result = _WinAPI_EndDoc($hPrintDc) ; Delete the printer device context _WinAPI_DeleteDC($hPrintDc) Func _GetDefaultPrinter() $s_TempDeviceID = "" If @OSType = "WIN32_NT" Then Local $objWMIService = ObjGet("winmgmts:\\.\root\CIMV2") If Not @error = 0 Then ; error Else Local $wbemFlagReturnImmediately = 0x10 Local $wbemFlagForwardOnly = 0x20 Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Printer", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems If $s_TempDeviceID = "" Then $s_TempDeviceID = $objItem.DeviceID If $objItem.Default Then $s_TempDeviceID = $objItem.DeviceID Next Else ;Msgbox(262192,"WMI Output","No WMI Objects Found for class: " & "Win32_Printer" ) EndIf EndIf EndIf Return $s_TempDeviceID EndFunc ;==>_GetDefaultPrinter
  3. This is great, thanks for making the changes!
  4. Hey martin, I have been experimenting with your UDF and dll, it works great! I was wondering if you would post the sorce for your dll or if you could add the parameter for setting the angle of escapement of a font, and secondly a function for drawing round rectangles.
  5. I am somewhat new to AutoIt, but have been trying to create a UDF for printing that does not require a DLL external to the OS. PrintWinAPI.au3 Sample output: Example.au3 CODE#Include <PrintWinAPI.au3> ; Create a printer device context $s_DefaultPrinter = _GetDefaultPrinter() $s_PrinterName = InputBox("AutoIt API Printing", "Enter printer name", $s_DefaultPrinter) If $s_PrinterName = "" Then Exit $hPrintDc = _WinAPI_CreateDC("winspool", $s_PrinterName) ; get pixel and twips info $PixelsPerInchY = _WinAPI_GetDeviceCaps($hPrintDc, $__WINAPCONSTANT_LOGPIXELSY) ; Get Pixels Per Inch Y $TwipsPerPixelY = 1440 / $PixelsPerInchY $PixelsPerInchX = _WinAPI_GetDeviceCaps($hPrintDc, $__WINAPCONSTANT_LOGPIXELSX) ; Get Pixels Per Inch X $TwipsPerPixelX = 1440 / $PixelsPerInchX ; get page width and height $cWidthPels = _WinAPI_GetDeviceCaps($hPrintDc, $HORZRES) ; Get Pixels Per Inch X $cHeightPels = _WinAPI_GetDeviceCaps($hPrintDc, $VERTRES) ; Get Pixels Per Inch Y ; set docinfo $s_DocName = "Printing from AutoIt with WinAPI" $DocName = DllStructCreate("char DocName[" & StringLen($s_DocName & chr(0)) & "]") DllStructSetData($DocName, "DocName", $s_DocName & chr(0)) ; Size of DOCINFO structure $DOCINFO = DllStructCreate($tagDOCINFO) ; Structure for Print Document info DllStructSetData($DOCINFO, "Size", 20) ; Size of DOCINFO structure DllStructSetData($DOCINFO, "DocName", DllStructGetPtr($DocName)) ; Set name of print job (Optional) ; start new print doc $result = _WinAPI_StartDoc($hPrintDc, $DOCINFO) ; start new page $result = _WinAPI_StartPage($hPrintDc) ; create font $DESIREDFONTSIZE = 16 $hFont = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 0, 0, $FW_NORMAL, True, True, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Verdona') ; set newfond, save old font $hFontOld = _WinAPI_SelectObject($hPrintDc, $hFont) ; print centered test message $s_TextOut = "This is a test..." $OutSize = _WinAPI_GetTextExtentPoint32($hPrintDc, $s_TextOut) ; Compute the starting point for the text-output operation(centered) $xLeft = (($cWidthPels / 2) - (DllStructGetData($OutSize,"X") / 2)) ; Compute the starting point for the text-output 2 lines down $yTop = DllStructGetData($OutSize,"Y") * 2 ; Send text $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; create font structure, rotated 180 degrees $lf = DllStructCreate($tagLOGFONT) $DESIREDFONTSIZE = 12 DllStructSetData($lf, "Escapement", 2700) DllStructSetData($lf, "Height", (($DESIREDFONTSIZE * -20) / $TwipsPerPixelY)) DllStructSetData($lf, "Italic", False) DllStructSetData($lf, "Underline", False) DllStructSetData($lf, "FaceName", "Arial") ; set font $hLF = _WinAPI_CreateFontIndirect($lf) $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; Send rotated text to printer, starting at location 1000, 1000 $xLeft = 1000 $yTop = 1000 $s_TextOut = "Testing...123" $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) DllStructSetData($lf, "Escapement", 2250) $hLF = _WinAPI_CreateFontIndirect($lf) $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; Send rotated text to printer, starting at location 1000, 1000 $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 1800, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; Send rotated text to printer, starting at location 1000, 1000 $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 1500, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; Send rotated text to printer, starting at location 1000, 1000 $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 1200, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; Send rotated text to printer, starting at location 1000, 1000 $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 900, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; set textcolor, save last textcolor $iColorOld = _WinAPI_SetTextColor($hPrintDc, 0xFF0000) ; Send rotated text to printer, starting at location 1000, 1000 $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 600, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; set textcolor, save last textcolor $result = _WinAPI_SetTextColor($hPrintDc, 0x00FF00) ; Send rotated text to printer, starting at location 1000, 1000 $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 300, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; set textcolor, save last textcolor $result = _WinAPI_SetTextColor($hPrintDc, 0x0000FF) ; Send rotated text to printer, starting at location 1000, 1000 $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 0, 0, $FW_BOLD, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result = _WinAPI_SelectObject($hPrintDc, $hLF) ; set textcolor, save last textcolor $result = _WinAPI_SetTextColor($hPrintDc, 0x0) ; Send rotated text to printer, starting at location 1000, 1000 $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; set textcolor $result = _WinAPI_SetTextColor($hPrintDc, 0x0000FF) ; restore original font $result = _WinAPI_SelectObject($hPrintDc, $hFontOld) ; restore original color $result = _WinAPI_SetTextColor($hPrintDc, $iColorOld) ; delete fonts _WinAPI_DeleteObject($hFont) _WinAPI_DeleteObject($hLF) ; create pens to draw with (PenStyle, Width, RGB-Color) $hPen0 = _WinAPI_CreatePen($PS_SOLID, 0, 0x000000) $hPen1 = _WinAPI_CreatePen($PS_DASH, 0, 0x000000) $hPen2 = _WinAPI_CreatePen($PS_DOT, 0, 0x000000) $hPen3 = _WinAPI_CreatePen($PS_DASHDOT, 0, 0x000000) $hPen4 = _WinAPI_CreatePen($PS_DASHDOTDOT, 0, 0x000000) $hPen5 = _WinAPI_CreatePen($PS_SOLID, 20, 0x000000) $hPen6 = _WinAPI_CreatePen($PS_SOLID, 40, 0x000000) $hPen7 = _WinAPI_CreatePen($PS_SOLID, 40, 0x0000FF) $hPen8 = _WinAPI_CreatePen($PS_SOLID, 40, 0x00FF00) $hPen9 = _WinAPI_CreatePen($PS_SOLID, 40, 0xFF0000) ; set starting point $LastPoint = DllStructCreate($tagPOINT) $result = _WinAPI_MoveToEx($hPrintDc, 1000, 2000, $LastPoint) ; select pen, save old pen $hPenOld = _WinAPI_SelectObject($hPrintDc, $hPen2) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1100, 3000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen4) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1200, 2000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen3) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1300, 3000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen1) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1400, 2000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen0) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1500, 3000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen5) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1600, 2000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen6) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1700, 3000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen7) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1800, 2000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen8) ; draw line $result = _WinAPI_LineTo($hPrintDc, 1900, 3000) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen9) ; draw line $result = _WinAPI_LineTo($hPrintDc, 2000, 2000) ; draw arch connected from current point $result = _WinAPI_SetArcDirection($hPrintDc, $AD_CLOCKWISE) $result = _WinAPI_ArcTo($hPrintDc, 2500, 2000, 3000, 2500, 2500, 2500, 3000, 2500) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen4) ; draw arch $result = _WinAPI_Arc($hPrintDc, 2500, 1000, 3500, 1500, 0, 0, 0, 0) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen5) ; create brush $hBrush = _WinAPI_CreateSolidBrush(0x0000FF) ; select brush $hBrushOld = _WinAPI_SelectObject($hPrintDc, $hBrush) ; draw rectangles $result = _WinAPI_Rectangle($hPrintDc, 3500, 2000, 4500, 2500) $result = _WinAPI_RoundRect($hPrintDc, 3500, 2600, 4500, 3100, 200, 200) ; draw circle $result = _WinAPI_Ellipse($hPrintDc, 3300, 1800, 3700, 2200) ; restore original brush $result = _WinAPI_SelectObject($hPrintDc, $hBrushOld) ; select pen $result = _WinAPI_SelectObject($hPrintDc, $hPen2) $result = _WinAPI_Arc($hPrintDc, 3300, 1900, 3700, 2300, 0, 0, 0, 0) ; ; End the page $result = _WinAPI_EndPage($hPrintDc) ; start new page $result = _WinAPI_StartPage($hPrintDc) ; print centered test message $s_TextOut = "This is page 2" $OutSize = _WinAPI_GetTextExtentPoint32($hPrintDc, $s_TextOut) ; Compute the starting point for the text-output operation(centered) $xLeft = (($cWidthPels / 2) - (DllStructGetData($OutSize,"X") / 2)) ; Compute the starting point for the text-output 2 lines down $yTop = DllStructGetData($OutSize,"Y") * 2 ; Send text $result = _WinAPI_TextOut($hPrintDc, $xLeft, $yTop, $s_TextOut) ; delete pens _WinAPI_DeleteObject($hPen0) _WinAPI_DeleteObject($hPen1) _WinAPI_DeleteObject($hPen2) _WinAPI_DeleteObject($hPen3) _WinAPI_DeleteObject($hPen4) _WinAPI_DeleteObject($hPen5) _WinAPI_DeleteObject($hPen6) _WinAPI_DeleteObject($hPen7) _WinAPI_DeleteObject($hPen8) _WinAPI_DeleteObject($hPen9) ; delete brush _WinAPI_DeleteObject($hBrush) ; restore original pen $result = _WinAPI_SelectObject($hPrintDc, $hPenOld) ; restore original brush $result = _WinAPI_SelectObject($hPrintDc, $hBrushOld) ; End the page $result = _WinAPI_EndPage($hPrintDc) ; End the print job $result = _WinAPI_EndDoc($hPrintDc) ; Delete the printer device context _WinAPI_DeleteDC($hPrintDc) Func _GetDefaultPrinter() $s_TempDeviceID = "" If @OSTYPE = "WIN32_NT" Then Local $objWMIService = ObjGet("winmgmts:\\.\root\CIMV2") If Not @error = 0 Then ; error Else Local $wbemFlagReturnImmediately = 0x10 Local $wbemFlagForwardOnly = 0x20 Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Printer", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems If $s_TempDeviceID = "" Then $s_TempDeviceID = $objItem.DeviceID If $objItem.Default Then $s_TempDeviceID = $objItem.DeviceID Next Else ;Msgbox(262192,"WMI Output","No WMI Objects Found for class: " & "Win32_Printer" ) Endif EndIf EndIf Return $s_TempDeviceID EndFunc I have not been able to add the ability to print images or to change paper orientation. It would be great if someone could help add these two features or expand it to include any others.
  6. I reproduced the same results. I made a small change to the PrintBarCode function as follows and it works great now. CODEFunc PrintBarCode($bctext,$bcode);<-------------added by martin Local $hp, $mmssgg Local $barSpacing = 5;0.5 mm - i don't know what is normal Local $barHt = 200;20mm Local $xstart = 100, $ystart = 300;offsets to start of print $hp = _PrintDllStart($mmssgg);this must always be called first If $hp = 0 Then MsgBox(262144,"ERROR","Error from dllstart = " & $mmssgg & @CRLF) Return EndIf _PrintGetPrinter($hp);choose the printer if you don't want the default printer $newselect = _PrintSetPrinter($hp);see also _PrintSelectPrinter ;MsgBox(0, 'reseult from set printer = ', _PrintGetPrinter($hp));choose the printer if you don't want the default printer _PrintPageOrientation($hp, 1);portrait _PrintStartPrint($hp) _PrintSetLineWid($hp,$barSpacing) _PrintSetLineCol($hp, 0);set line col to black $i = 1 While $i <= StringLen($bcode) If StringMid($bcode, $i, 1) = "1" Then _PrintLine($hp, $xstart + $i * $barSpacing, $ystart, $xstart + $i * $barSpacing, $ystart + $barHt) EndIf $i += 1 WEnd ;quickest way I could think of to neaten up the ragged line ends _PrintSetLineCol($hp, 0xffffff);set line col to white _PrintLine($hp, $xstart , $ystart, $xstart + $i * $barSpacing, $ystart) _PrintLine($hp, $xstart , $ystart + $barHt, $xstart + $i * $barSpacing, $ystart + $barHt) _PrintSetFont($hp, 'Arial', 18, 0, 'bold') _PrintText($hp,$bctext,$xstart,$ystart + $barHt + _PrintGetTextHeight($hp,"{") + 5) _PrintEndPrint($hp) _PrintNewPage($hp);not really needed since only one page used _printDllClose($hp) EndFunc
×
×
  • Create New...