Jump to content

Recommended Posts

Posted

Hello,
I wrote a simple library to print using the script.dll
the code pscript.au3:

#include "pscriptCostant.au3"

local $DllHandle
;-------------------------------------------
; Inizializza la Dll
;-------------------------------------------
Func PscriptInit($Dll)
local $ret
$DllHandle = DllOpen($Dll)
if $DllHandle = -1 Then
ConsoleWrite("errore Laod Dll")
Exit
EndIf
$ret = DllCall($DllHandle,"INT","PSInit")
if $ret[0] <> $PSE_NOERROR then
   ConsoleWrite("Errore Init")
   Exit
EndIf
DllCall($DllHandle,"NONE","PSSetCoorSystem","INT",$APS_TOPLEFT)
DllCall($DllHandle,"NONE","PSSetUnit","INT",$APS_MILL)
EndFunc
;-----------------------------------------------
; Avvia Creazione Documento
;-----------------------------------------------
Func PsStartDoc()
DllCall($DllHandle,"NONE","PSBeginDoc")
EndFunc
;-------------------------------------------------
; Termona Stampa Documento
;-------------------------------------------------
Func PsEndDoc()
DllCall($DllHandle,"NONE","PSEndDoc")
EndFunc
;-------------------------------------------------
; Dialog di scelta stampante
;-------------------------------------------------
Func PsPrintDialog()
local $ret
$ret = DllCall($DllHandle,"BOOLEAN","PSPrintDialog")
Return $ret[0]
EndFunc
;------------------------------------------------
; Imposta formato Pagina
;------------------------------------------------
Func PsSetPageSize($Dimensione)
DllCall($DllHandle,"NONE","PSSetPageSize","SHORT",$Dimensione)
EndFunc
;------------------------------------------------
; Recupera dimensione pagina
;------------------------------------------------
Func PsGetPageSize()
   local $ret
   $ret = DllCall($DllHandle,"SHORT","PSGetPageSize")
return $ret[0]
EndFunc
;----------------------------------------------------
; Visualizza Anteprima di Stampa
;----------------------------------------------------
Func PsPrintPreview($Flagh)
   DllCall($DllHandle,"NONE","PSSetPrintPreview","INT",$Flagh)
EndFunc
;-----------------------------------------------------
; Stampa una Stringa con parametri
;------------------------------------------------------
Func PsOutText($nTop, $nLeft, $xValue, $nJustify, $cFont, $nSize, $nStyle, $nTFColor, $nTBColor, $nAngle)
EndFunc
;-----------------------------------------------------
; Stampa il Testo con i parametri standard
;-----------------------------------------------------
Func PsTextOut($nTop, $nLeft, $xValue)
   DllCall($DllHandle,"NONE","PSTextOut","INT",PSFtoI($nTop),"INT", PSFtoI($nLeft),"STR",$xValue)
EndFunc
;------------------------------------------------------
; Stampa il Testo con i parametri passati
;------------------------------------------------------
Func PsTextOutEx($Top, $Left, $xValue, $Just = $APS_LEFT , $FontName = $APS_SYSTEM, $FontSize = 12, $FontStyle = $APS_PLAIN, $FontFColor = $APS_BLACK, $FontBColor = $APS_NONE, $Angle=0)
   DllCall($Dllhandle,"NONE","PSTextOutEx","INT",PSFtoI($Top),"INT",PSFtoI($left),"STR",$xValue,"INT",$Just,"STR",$FontName,"INT",PSFtoI($FontSize),"INT",$FontStyle,"INT",$FontFColor,"INT",$FontBColor,"INT",$Angle)
EndFunc
;------------------------------------------------------
; Aggiunge una nuova pagina
;------------------------------------------------------
Func PSNewPage()
   DllCall($DllHandle,"NONE","PSNewPage")
EndFunc
;------------------------------------------------------
; recupera il Font in uso
;------------------------------------------------------
Func PsGetFontName()
   local $Font
   $Font = DllCall($DllHandle,"NONE",'PSGetFontName',"str", "")
return $Font[1]
EndFunc
;--------------------------------------------------------
; Inposta il Font
;--------------------------------------------------------
Func PsSetFontName($FontName)
   DllCall($DllHandle,"NONE","PSSetFontName","STR",$FontName)
EndFunc
;--------------------------------------------------------
; Imposta la dimensione del font
;--------------------------------------------------------
Func PsSetFontSize($Size)
   DllCall($DllHandle,"NONE","PSSetFontSize","INT", PSFtoI($Size))
EndFunc
;--------------------------------------------------------
; Recupera la dimensione del Font
;---------------------------------------------------------
Func PsGetFontSize()
   Local $ret
   $ret = DllCall($DllHandle,"INT","PSGetFontSize")
   Return PSItoF($ret[0])
EndFunc
;----------------------------------------------------------
; Imposta lo stile del Font
;----------------------------------------------------------
Func PsSetFontStyle($Stile)
   DllCall($DllHandle,"NONE","PSSetFontStyle","INT",$Stile)
EndFunc
;----------------------------------------------------------
; Recupera lo stile del Font
;----------------------------------------------------------
Func PsGetFontStyle()
   Local $ret
   $ret = DllCall($DllHandle,"INT","PSGetFontStyle")
   Return $ret[0]
EndFunc
;----------------------------------------------------------
; Imposta il Colore del Font
;----------------------------------------------------------
Func PsSetFontFColor($FontFColor)
   DllCall($DllHandle,"NONE","PSSetFontFColor","INT",$FontFColor)
EndFunc
;----------------------------------------------------------
; Recupera il colore del Font
;----------------------------------------------------------
Func PsGetFontFColor()
   local $ret
   $ret = DllCall($DllHandle,"INT","PSGetFontFColor")
   return $ret[0]
EndFunc
;-----------------------------------------------------------
; Imposta il colore di fondo
;-----------------------------------------------------------
Func PsSetFontBColor($FontBColor)
   DllCall($DllHandle,"NONE","PSSetFontBColor","INT",$FontBColor)
EndFunc
;-----------------------------------------------------------
; Recupera il colore del fondo
;-----------------------------------------------------------
Func PSGetFontBColor()
   local $ret
   $ret = DllCall($DllHandle,"INT","PSGetFontBColor")
   return $ret[0]
EndFunc
;-----------------------------------------------------------------------------
;Function ...: #PSFtoI(AValue) -> Value
;Description : Converts a Double to an Integer for PSInt compatibility
;-----------------------------------------------------------------------------*/
Func PSFtoI($AValue)
Return Int($AValue * 10000)
EndFunc
;*-----------------------------------------------------------------------------
;Function ...: #PSItoF(AValue) -> Value
;Description : Converts a PSInt to a Double for PSInt compatibility
;-----------------------------------------------------------------------------*/
Func PSItoF($AValue)
Return Round($AValue / 10000, 4)
EndFunc

pscriptCostant.au3

;==================================================
; Costanti della Libreria
; Devices
;-----------------------------------------------------------------------------*/
Global Const $DEV_PRINTER  =        1     ; Printer
Global Const $DEV_PREVIEW  =        2     ; Printer with Print preview
Global Const $DEV_PDFFILE  =        3     ; Print to a PDF File
Global Const $DEV_RESERVED =        4     ; Reserved for future use
Global Const $DEV_EMFFILE  =        5     ; Print to a serie of EMF files

;-----------------------------------------------------------------------------
;*** OBSOLETE ***    Special printer numbers
;-----------------------------------------------------------------------------*/
Global Const $PRN_DEFAULT    =      0         ; Select Windows default printer
Global Const $PRN_PREVIEW    =     -1         ; Print preview     (Obsolete)
Global Const $PRN_PDF        =     -2         ; Print to PDF File (Obsolete)

;-----------------------------------------------------------------------------
;Possible error codes
;-----------------------------------------------------------------------------*/
Global Const $PSE_NOERROR        =  0         ; No error
Global Const $PSE_NOPRINTER      =  1         ; No printer installed
Global Const $PSE_DLLNOTLOADED   =  2         ; Could not load DLL
Global Const $PSE_NOTINITIALIZED =  3         ; Library not initialized
Global Const $PSE_TIMEDOUT       =  5         ; Beta version timed out

;-----------------------------------------------------------------------------
;Misc. definitions
;-----------------------------------------------------------------------------*/
Global Const $APS_DEFAULT    =  -999          ; Default value for Integer and Double parameters

;-----------------------------------------------------------------------------
;Basic fonts definitions. Any other valid font is accepted
;-----------------------------------------------------------------------------*/
Global Const $APS_SYSTEM    =      "Courier New"     ; System font
Global Const $APS_COURIER   =      "Courier New"     ; Courier new
Global Const $APS_ARIAL     =      "Arial"           ; Arial
Global Const $APS_TIMES     =      "Times New Roman" ; Times new roman
Global Const $APS_DINGBATS  =      "WingDings"       ; WingDings
Global Const $APS_VERDANA   =      "Verdana"         ; Verdana

;-----------------------------------------------------------------------------
; Supported font styles definitions.
;-----------------------------------------------------------------------------*/
Global Const $APS_PLAIN      =     0     ; Plain
Global Const $APS_BOLD       =     1     ; Bold
Global Const $APS_ITALIC     =     2     ; Italic
Global Const $APS_UNDERLINE  =     4     ; UnderLine
Global Const $APS_STRIKEOUT  =     8     ; StrikeOut
Global Const $APS_BOLDITALIC =     $APS_BOLD + $APS_ITALIC   ; BoldItalic (Compatibility)

;-----------------------------------------------------------------------------
; Text justification definitions                                         X,Y
;-------------------------------------------------------------------------|---*/
Global Const $APS_LEFT      =      0     ; Text is left justified              PageScript
Global Const $APS_RIGHT     =      1     ; Text is right justified    PageScript
Global Const $APS_CENTER    =      2     ; Text is centered                PageScript
Global Const $APS_DECIMAL   =      3     ; Text is aligned on the decimal 9,999.99

;-----------------------------------------------------------------------------
; Units of mesurement used to calculate position on the document
;-----------------------------------------------------------------------------*/
Global Const $APS_TEXT      =      0     ; Unit is text coordinates (Row, Col)
Global Const $APS_MILL      =      1     ; Unit is millimeter
Global Const $APS_CENT      =      2     ; Unit is centimeter
Global Const $APS_INCH      =      3     ; Unit is inch
Global Const $APS_PIXEL     =      4     ; Unit is pixel
Global Const $APS_PICA      =      5     ; Unit is pica (6 picas per inch)
Global Const $APS_POINT     =      6     ; Unit is point (72 points per inch)
Global Const $APS_TWIPS     =      7     ; Unit is twips (1440 twips per inch)
Global Const $APS_CLIP      =      8     ; Unit is text coordinates (Row, Col) but compatible with PageScript for Clipper

;-----------------------------------------------------------------------------
; Page orientation
;-----------------------------------------------------------------------------*/
Global Const $APS_PORTRAIT    =    1     ; Print in portrait
Global Const $APS_LANDSCAPE   =    2     ; Print in landscape

;-----------------------------------------------------------------------------
; BarCode types
;-----------------------------------------------------------------------------*/
Global Const $APS_BC39      =      1     ; Code 3 of 9
Global Const $APS_BC128     =      2     ; Code 128 B
Global Const $APS_EAN128A   =      3
Global Const $APS_EAN128B   =    4
Global Const $APS_EAN128C   =      5
Global Const $APS_EAN8      =    6
Global Const $APS_EAN13     =    7
Global Const $APS_CODE128A  =    8
Global Const $APS_CODE128B  =      9
Global Const $APS_CODE128C  =     10
Global Const $APS_UPCA      =     11
Global Const $APS_UPCE0     =     12
Global Const $APS_CODABAR   =     13
Global Const $APS_POSTNET   =     14
Global Const $APS_INTER25   =     15

;-----------------------------------------------------------------------------
; PDF Encoding
;------------------------------------------------------------------------------*/
Global Const $APS_PDF_WINANSI_ENC  = 0
Global Const $APS_PDF_STD_ENC      = 1
Global Const $APS_PDF_DOC_ENC      = 2

;-----------------------------------------------------------------------------
; PDF Version
;------------------------------------------------------------------------------*/
Global Const $APS_PDF14     =   0
Global Const $APS_PDF15     =   1
Global Const $APS_PDF16     =   2
Global Const $APS_PDF17     =   3

;-----------------------------------------------------------------------------
; PDF Embedded fonts
;------------------------------------------------------------------------------*/
Global Const $APS_PDF_FNT_NONE    =     0
Global Const $APS_PDF_FNT_FULL    =     1
Global Const $APS_PDF_FNT_SUB     =     2
;-----------------------------------------------------------------------------
; Basic colors supported. Corresponds to Clipper's. We're using negative
; values because we don't want to interfere with RGS values that are
; represented by a positive integer.
;-----------------------------------------------------------------------------*/
Global Const $APS_BLACK      =    -1     ; Black
Global Const $APS_BLUE       =    -2     ; Dark blue
Global Const $APS_GREEN      =    -3     ; Dark green
Global Const $APS_CYAN       =    -4     ; Dark cyan
Global Const $APS_RED        =    -5     ; Dark red
Global Const $APS_MAGENTA    =    -6     ; Dark magenta
Global Const $APS_BROWN      =    -7     ; Brown (more orange than brown)
Global Const $APS_PALEGRAY   =    -8     ; Pale gray
Global Const $APS_GRAY       =    -9     ; Dark gray
Global Const $APS_BBLUE      =   -10     ; Bright blue
Global Const $APS_BGREEN     =   -11     ; Bright green
Global Const $APS_BCYAN      =   -12     ; Bright cyan
Global Const $APS_BRED       =   -13     ; Bright red
Global Const $APS_BMAGENTA   =   -14     ; Bright magenta
Global Const $APS_YELLOW     =   -15     ; Yellow
Global Const $APS_WHITE      =   -16     ; White
Global Const $APS_NONE       =  -255     ; Transparent (No color)

;-----------------------------------------------------------------------------
; Supported patterns used in conjunction with the filling color
;-----------------------------------------------------------------------------*/
Global Const $APS_SOLID        =   0     ; Û  Solid
Global Const $APS_CLEAR        =   1     ;    Clear (no color / transparent)
Global Const $APS_BDIAGONAL    =   2     ; \\ Backward diagonal
Global Const $APS_FDIAGONAL    =   3     ; ; Forward diagonal
Global Const $APS_CROSS        =   4     ; ++ Cross
Global Const $APS_DIAGCROSS    =   5     ; XX Diagonal cross
Global Const $APS_HORIZONTAL   =   6     ; ÍÍ Horizontal
Global Const $APS_VERTICAL     =   7     ; ³³ Vertical

;-----------------------------------------------------------------------------
; Watermark type
;-----------------------------------------------------------------------------*/
Global Const $AWM_NONE        =    0     ; No Watermark
Global Const $AWM_FOREGROUND  =    1     ; Watermark is printed in foreground
Global Const $AWM_BACKGROUND  =    2     ; Watermark is printed in background

;-----------------------------------------------------------------------------
; Coordinate system
;-----------------------------------------------------------------------------*/
Global Const $APS_LEFTTOP    =     0     ; Left/Top coordinate system
Global Const $APS_TOPLEFT    =     1     ; Top/Left coordinate system

;-----------------------------------------------------------------------------
; Printer Caps. All caps are in pixels
;-----------------------------------------------------------------------------*/
Global Const $APC_PAPERWIDTH   =   1     ; Paper width
Global Const $APC_PAPERHEIGHT  =   2     ; Paper height
Global Const $APC_AREAWIDTH    =   3     ; Printable area width
Global Const $APC_AREAHEIGHT   =   4     ; Printable area height
Global Const $APC_TOPMARGIN    =   5     ; Top margin
Global Const $APC_LEFTMARGIN   =   6     ; Left margin
Global Const $APC_HPIXELS      =   7     ; Number of horizontal pixels per inch
Global Const $APC_VPIXELS      =   8     ; Number of vertical pixels per inch
Global Const $APC_BITSPIXEL    =   9     ; Number of bits per pixel (1 = B&W printer)

;-----------------------------------------------------------------------------
; Print Preview Window State
;-----------------------------------------------------------------------------*/
Global Const $PWS_MINIMIZED    =   0     ; Minimized
Global Const $PWS_MAXIMIZED    =   1     ; Maximized - Default
Global Const $PWS_NORMAL       =   2     ; Normal
Global Const $PWS_NORMALCENTERED = 3     ; Normal centered (Only Width and Height required)
Global Const $PWS_AUTO         =   4     ; Saves and reuses the size and pos automaticaly

;-----------------------------------------------------------------------------
; PDF font character sets (As defined by Microsoft)
;-----------------------------------------------------------------------------*/
Global Const $ANSI_CHARSET     =     0    ; Latin - Western European languages: English, French, German, Spanish, Italian, Portuguese...
Global Const $ARABIC_CHARSET   =   178    ; Arabic -Arabic, Syriac
Global Const $BALTIC_CHARSET   =   186    ; Baltic - Estonian, Latvian, Lithuanian
Global Const $EASTEUROPE_CHARSET = 238    ; European - Eastern European languages: Czech, Croatian, Hungarian, Polish, Romanian, Slovak, Slovenian...
Global Const $GREEK_CHARSET      = 161    ; Greek
Global Const $HEBREW_CHARSET     = 177    ; Hebrew
Global Const $RUSSIAN_CHARSET    = 204    ; Cyrillic - Belarussian, Bulgarian, Russian, Serbian, Ukrainian...
Global Const $TURKISH_CHARSET    = 162    ; Turkish

;-----------------------------------------------------------------------------
; Predefined Paper selection (based on Windows API constants)
;-----------------------------------------------------------------------------*/
Global Const $DMPAPER_LETTER             =       1  ; Letter 8 12 x 11 in
Global Const $DMPAPER_FIRST              =       $DMPAPER_LETTER
Global Const $DMPAPER_LETTERSMALL        =       2  ; Letter Small 8 12 x 11 in
Global Const $DMPAPER_TABLOID            =       3  ; Tabloid 11 x 17 in
Global Const $DMPAPER_LEDGER             =       4  ; Ledger 17 x 11 in
Global Const $DMPAPER_LEGAL              =       5  ; Legal 8 12 x 14 in
Global Const $DMPAPER_STATEMENT          =       6  ; Statement 5 12 x 8 12 in
Global Const $DMPAPER_EXECUTIVE          =       7  ; Executive 7 14 x 10 12 in
Global Const $DMPAPER_A3                 =       8  ; A3 297 x 420 mm
Global Const $DMPAPER_A4                 =       9  ; A4 210 x 297 mm
Global Const $DMPAPER_A4SMALL            =      10  ; A4 Small 210 x 297 mm
Global Const $DMPAPER_A5                 =      11  ; A5 148 x 210 mm
Global Const $DMPAPER_B4                 =      12  ; B4 (JIS) 250 x 354
Global Const $DMPAPER_B5                 =      13  ; B5 (JIS) 182 x 257 mm
Global Const $DMPAPER_FOLIO              =      14  ; Folio 8 12 x 13 in
Global Const $DMPAPER_QUARTO             =      15  ; Quarto 215 x 275 mm
Global Const $DMPAPER_10X14              =      16  ; 10x14 in
Global Const $DMPAPER_11X17              =      17  ; 11x17 in
Global Const $DMPAPER_NOTE               =      18  ; Note 8 12 x 11 in
Global Const $DMPAPER_ENV_9              =      19  ; Envelope #9 3 78 x 8 78
Global Const $DMPAPER_ENV_10             =      20  ; Envelope #10 4 18 x 9 12
Global Const $DMPAPER_ENV_11             =      21  ; Envelope #11 4 12 x 10 38
Global Const $DMPAPER_ENV_12             =      22  ; Envelope #12 4 \276 x 11
Global Const $DMPAPER_ENV_14             =      23  ; Envelope #14 5 x 11 12
Global Const $DMPAPER_CSHEET             =      24  ; C size sheet
Global Const $DMPAPER_DSHEET             =      25  ; D size sheet
Global Const $DMPAPER_ESHEET             =      26  ; E size sheet
Global Const $DMPAPER_ENV_DL             =      27  ; Envelope DL 110 x 220mm
Global Const $DMPAPER_ENV_C5             =      28  ; Envelope C5 162 x 229 mm
Global Const $DMPAPER_ENV_C3             =      29  ; Envelope C3  324 x 458 mm
Global Const $DMPAPER_ENV_C4             =      30  ; Envelope C4  229 x 324 mm
Global Const $DMPAPER_ENV_C6             =      31  ; Envelope C6  114 x 162 mm
Global Const $DMPAPER_ENV_C65            =      32  ; Envelope C65 114 x 229 mm
Global Const $DMPAPER_ENV_B4             =      33  ; Envelope B4  250 x 353 mm
Global Const $DMPAPER_ENV_B5             =      34  ; Envelope B5  176 x 250 mm
Global Const $DMPAPER_ENV_B6             =      35  ; Envelope B6  176 x 125 mm
Global Const $DMPAPER_ENV_ITALY          =      36  ; Envelope 110 x 230 mm
Global Const $DMPAPER_ENV_MONARCH        =      37  ; Envelope Monarch 3.875 x 7.5 in
Global Const $DMPAPER_ENV_PERSONAL       =      38  ; 6 34 Envelope 3 58 x 6 12 in
Global Const $DMPAPER_FANFOLD_US         =      39  ; US Std Fanfold 14 78 x 11 in
Global Const $DMPAPER_FANFOLD_STD_GERMAN  =     40  ; German Std Fanfold 8 12 x 12 in
Global Const $DMPAPER_FANFOLD_LGL_GERMAN  =     41  ; German Legal Fanfold 8 12 x 13 in
Global Const $DMPAPER_ISO_B4              =     42  ; B4 (ISO) 250 x 353 mm
Global Const $DMPAPER_JAPANESE_POSTCARD   =     43  ; Japanese Postcard 100 x 148 mm
Global Const $DMPAPER_9X11                =     44  ; 9 x 11 in
Global Const $DMPAPER_10X11               =     45  ; 10 x 11 in
Global Const $DMPAPER_15X11               =     46  ; 15 x 11 in
Global Const $DMPAPER_ENV_INVITE          =     47  ; Envelope Invite 220 x 220 mm
Global Const $DMPAPER_RESERVED_48         =     48  ; RESERVED--DO NOT USE
Global Const $DMPAPER_RESERVED_49         =     49  ; RESERVED--DO NOT USE
Global Const $DMPAPER_LETTER_EXTRA        =     50  ; Letter Extra 9 \275 x 12 in
Global Const $DMPAPER_LEGAL_EXTRA         =     51  ; Legal Extra 9 \275 x 15 in
Global Const $DMPAPER_TABLOID_EXTRA       =     52  ; Tabloid Extra 11.69 x 18 in
Global Const $DMPAPER_A4_EXTRA            =     53  ; A4 Extra 9.27 x 12.69 in
Global Const $DMPAPER_LETTER_TRANSVERSE   =     54  ; Letter Transverse 8 \275 x 11 in
Global Const $DMPAPER_A4_TRANSVERSE       =     55  ; A4 Transverse 210 x 297 mm
Global Const $DMPAPER_LETTER_EXTRA_TRANSVERSE = 56  ; Letter Extra Transverse 9\275 x 12 in
Global Const $DMPAPER_A_PLUS                  = 57  ; SuperASuperAA4 227 x 356 mm
Global Const $DMPAPER_B_PLUS                  = 58  ; SuperBSuperBA3 305 x 487 mm
Global Const $DMPAPER_LETTER_PLUS             = 59  ; Letter Plus 8.5 x 12.69 in
Global Const $DMPAPER_A4_PLUS                 = 60  ; A4 Plus 210 x 330 mm
Global Const $DMPAPER_A5_TRANSVERSE           = 61  ; A5 Transverse 148 x 210 mm
Global Const $DMPAPER_B5_TRANSVERSE           = 62  ; B5 (JIS) Transverse 182 x 257 mm
Global Const $DMPAPER_A3_EXTRA                = 63  ; A3 Extra 322 x 445 mm
Global Const $DMPAPER_A5_EXTRA                = 64  ; A5 Extra 174 x 235 mm
Global Const $DMPAPER_B5_EXTRA                = 65  ; B5 (ISO) Extra 201 x 276 mm
Global Const $DMPAPER_A2                      = 66  ; A2 420 x 594 mm
Global Const $DMPAPER_A3_TRANSVERSE           = 67  ; A3 Transverse 297 x 420 mm
Global Const $DMPAPER_A3_EXTRA_TRANSVERSE     = 68  ; A3 Extra Transverse 322 x 445 mm
Global Const $DMPAPER_LAST                    = $DMPAPER_A3_EXTRA_TRANSVERSE
Global Const $DMPAPER_USER                    = 256  ; User defined paper size

;-----------------------------------------------------------------------------
; Paper bin selection (based on Windows API constants)
;-----------------------------------------------------------------------------*/
Global Const $DMBIN_UPPER            =           1  ; Upper bin
Global Const $DMBIN_FIRST            =           $DMBIN_UPPER
Global Const $DMBIN_ONLYONE          =           1  ; Same as Upper bin
Global Const $DMBIN_LOWER            =           2  ; Lower bin
Global Const $DMBIN_MIDDLE           =           3  ; Middle bin
Global Const $DMBIN_MANUAL           =           4  ; Manual feed
Global Const $DMBIN_ENVELOPE         =           5  ; Envelope
Global Const $DMBIN_ENVMANUAL        =           6  ; Envelope manual feed
Global Const $DMBIN_AUTO             =           7  ; Auto select (depending on paper size)
Global Const $DMBIN_TRACTOR          =           8  ; Tractor feed
Global Const $DMBIN_SMALLFMT         =           9  ; Small forms
Global Const $DMBIN_LARGEFMT         =          10  ; Large forms
Global Const $DMBIN_LARGECAPACITY    =          11  ; Large capacity bin
Global Const $DMBIN_CASSETTE         =          14  ; Cassette
Global Const $DMBIN_FORMSOURCE       =          15  ; Form source
Global Const $DMBIN_LAST             =          $DMBIN_FORMSOURCE
Global Const $DMBIN_USER             =         256  ; Device specific bins start here

; XEROX N4525 specific Trays numbers
; Contributed by Jeremy Suiter, England, UK. Thanks.
Global Const $XEROX_4525_1_W98        =          1  ; Xerox N4525 Tray 1
Global Const $XEROX_4525_2_W98        =          2  ; Xerox N4525 Tray 2
; Tray's 3,4,5 belong to optional 2,500 feeder unit
Global Const $XEROX_4525_3_W98        =        258  ; Xerox N4525 Tray 3
Global Const $XEROX_4525_4_W98        =        259  ; Xerox N4525 Tray 4
Global Const $XEROX_4525_5_W98        =        260  ; Xerox N4525 Tray 5

; Windows 2000 Pro/NT/XP
Global Const $XEROX_4525_1_W2K         =       262  ; Xerox N4525 Tray 1
Global Const $XEROX_4525_2_W2K         =       261  ; Xerox N4525 Tray 2
; Tray's 3,4,5 belong to optional 2,500 feeder unit
Global Const $XEROX_4525_3_W2K          =      260  ; Xerox N4525 Tray 3
Global Const $XEROX_4525_4_W2K          =      259  ; Xerox N4525 Tray 4
Global Const $XEROX_4525_5_W2K          =      258  ; Xerox N4525 Tray 5

;-----------------------------------------------------------------------------
; Duplex mode support for printers with Duplex printing options
;-----------------------------------------------------------------------------*/
Global Const $DMDUP_SIMPLEX             =        1  ; Simplex mode
Global Const $DMDUP_VERTICAL            =        2  ; Vertical Duplex
Global Const $DMDUP_HORIZONTAL          =        3  ; Horizontal Duplex

Example :

#include "pscript.au3"

local $x =0
PscriptInit(@ScriptDir &  "\PSCRIPT.dll")
PsPrintPreview(1)
if PsPrintDialog() Then
   PsSetPageSize($DMPAPER_A3)
   PsStartDoc()
   PsSetFontName($APS_VERDANA)
   PsSetFontStyle($APS_BOLD)
   PsSetFontFColor($APS_BRED)
   PsSetFontBColor($APS_YELLOW)
   PsSetFontSize(10)
   for $i=0 to 10
      PsTextOut(($i*5)+50, 0, 'Prova Testo Stampa')
      PSNewPage()
   Next
   PsTextOutEx(0,100,"Prova Due",$APS_CENTER)
   PsEndDoc()
EndIf

the library is not finished yet, many functions are missing.
I can not get printPreview to work.
You can help me?
Thank you.

  • 4 months later...
Posted (edited)

Hey,  try this function: Use the DEV_PREVIEW

Constant        Value   Description
DEV_PRINTER     1       The output is sent to the selected printer.
DEV_PREVIEW     2       The output is sent to the print preview dialog box
DEV_PDFFILE     3       The output is saved in a .pdf file. The file name is set by calling PSSetFileName() before starting the print job.
Reserved        4       Reserved for future use
DEV_EMFFILE     5       The output is saved in a series of EMF files. The path of the files to be created is set by calling PSSetFileName() before starting the print job. Files are named Page1.emf, Page2.emf, Pagen.emf
func PSSetDevice($nDevice)
    DllCall($DllHandle, "NONE", "PSSetDevice", "INT", $nDevice)
endfunc

 

Edited by x_bennY
  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...