PageScript 32 - User guide for [x]Harbour and Xbase++ - Version 3.0.3

Print Preview Window

The Print Preview Window

Function reference

PSAbort()

PSAsciiToAnsi()

PSBarCode()

PSBeginDoc()

PSBeginDocEx()

PSBeginEmuDoc()

PSBeginRawDoc()

PSBitmap()

PSEllipse()

PSEllipseEx()

PSEndDoc()

PSEndEmuDoc()

PSEndRawDoc()

PSFrame()

PSFrameEx()

PSGetAsciiToAnsi()

PSGetBin()

PSGetBorderColor()

PSGetBorderThickness()

PSGetCaps()

PSGetCoorSystem()

PSGetCopies()

PSGetCPI()

PSGetDecimalSep()

PSGetDefPrinter()

PSGetDefaultPrinter()

PSGetDuplex()

PSGetFillColor()

PSGetFillPattern()

PSGetFonts()

PSGetFontAngle()

PSGetFontBColor()

PSGetFontCount()

PSGetFontFColor()

PSGetFontJustify()

PSGetFontName()

PSGetFontNames()

PSGetFontSize()

PSGetFontStyle()

PSGetJustify()

PSGetLPI()

PSGetMaxHeight()

PSGetMaxWidth()

PSGetOrientation()

PSGetPageSize()

PSGetPaperBin()

PSGetPaperBins()

PSGetPaperBinCount()

PSGetPaperBinNames()

PSGetPaperBinNumbers()

PSGetPaperCount()

PSGetPaperNames()

PSGetPaperNumbers()

PSGetPrinter()

PSGetPrinters()

PSGetPrinterCaps()

PSGetPrinterCapsEx()

PSGetPrinterCount()

PSGetPrinterHandle()

PSGetPrinterNames()

PSGetTextHeight()

PSGetTextWidth()

PSGetTitle()

PSGetUnit()

PSGetUseDIB()

PSGetVersion()

PSGetXerox()

PSInit()

PSIsPreviewVisible()

PSLine()

PSLineEx()

PSNewPage()

PSPrintDialog()

PSPrintFile()/PSPrintEmuFile()

PSPrintRawFile()

PSSetAsciiToAnsi()

PSSetBin()

PSSetBorder()

PSSetBorderColor()

PSSetBorderThickness()

PSSetClipperComp()

PSSetCoorSystem()

PSSetCopies()

PSSetCPI()

PSSetDecimalSep()

PSSetDevice()

PSSetDirectPrint()

PSSetDuplex()

PSSetFileName()

PSSetFill()

PSSetFillColor()

PSSetFillPattern()

PSSetFont()

PSSetFontAttributes()

PSSetFontAngle()

PSSetFontBColor()

PSSetFontFColor()

PSSetFontName()

PSSetFontSize()

PSSetFontStyle()

PSSetJustify()

PSSetLPI()

PSSetOrientation()

PSSetPageSize()

PSSetPaperBin()

PSSetPDFOwnerPassword()

PSSetPrinter()

PSSetPWBounds()

PSSetPWColors()

PSSetPWPosition()

PSSetPWSize()

PSSetPWState()

PSSetPWZoomLevel()

PSSetRowCol()

PSSetTitle()

PSSetUnit()

PSSetUseDIB()

PSSetXerox()

PSTextBox()

PSTextBoxEx()

PSTextOut()

PSTextOutEx()

PSVersion()

PSWaterMark()

RGB()

Obsolete or unsupported

These functions are either unsupported or became obsolete in this version of PageScript 32 for xbase like programming languages.

PSPrnChanged()

PSRefreshPrinters()

PSSendMail()

PSSetPrintPreview()

PSSetTimeSlice()

PSShowIcon()

PSShutDown()

Using PageScript 32

PageScript 32 is easy to use and learn. If you're programming using either [x]Harbour or Xbase++, you have the choice of using PS function calls or to instantiate an object based on the TPageScript class. The source code for these programming languages is located in TPSCRIPT.PRG.

If you're programming using Delphi, you must instantiate an object of the TPageScript class. The source code for Delphi is located in PageScript.pas. See PageScript 32 for Delphi user guide for more informations.

If you're using any other programming languages, then you must call PageScript 32's API functions and procedures, as described in the PageScript 32 API user guide.

Here's an example on how to initialize the print library, start a new print job, print some text and then end the print job using PageScript 32 functions, procedures and commands :

XBase++ / [x]Harbour, using functions, procedures and commands wrappers

1 #Include "PScript.ch"
2 if PSInit() == 0
3    BEGINDOC USING 0 TITLE "Hello world"
4       PSSetUnit(APS_TEXT)
5       PSSetLPI(6)
6       PSSetCPI(10)
7       @5,5 TEXTOUT "Hello world"
8    ENDDOC
9 endif

Lets explain the code, line by line.

Line 1 is the standard Include statement. PSCRIPT.CH contains all deinitions you need to work with PageScript 32.

Line 2 initializes PageScript 32. If everything is OK, it returns 0. You need to call this function only once, at application start, not everytime you start a new print job

Line 3 starts a new print job, on the default printer with the title set to "Hello world"

Line 4 sets the unit of mesurement to text coordinates that barely mimics old DOS printer's rows and columns coordinate system.

Line 5 sets the number of LPI (lines per inch) to 6. The default value is 6, so this line is not required. We added it for demonstration purposes only.

Line 6 sets the number of CPI (characters per inch) to 10. The default value is 10, so this line is not required. We added it for demonstration purposes only.

Line 7 send the command to print "Hello world" at column 5 and row 5. It uses the default/current set font, font size, font foreground and background colors.

Line 8 ends the print job.

Line 9 is the end of the if structure.

Here's an example on how to create a new TPageScript object, start a new print job, print some text and then end the print job using TPageScript methods :

XBase++ / [x]Harbour, using the TPageScript class

1 #Include "PScript.ch"
2 Local oPS := TPageScript:New()
3 if oPS:nError == 0
4    oPS:BeginDoc(0, "Hello world")
5       oPS:SetUnit(APS_TEXT)
6       oPS:SetLPI(6)
7       oPS:SetCPI(10)
8       oPS:TextOutEx(5, 5, "Hello world")
9    oPS:EndDoc()
10 endif

Lets explain the code, line by line.

Line 1 is the standard Include statement. PSCRIPT.CH contains all deinitions you need to work with PageScript 32.

Line 2 creates a new TPageScript object and initializes a local variable, named oPS

Line 3 checks if the object is correctly initialized by comparing oPS:nError. If everything is OK, oPS:nError is set to 0.

Line 4 starts a new print job, on the default printer with the title set to "Hello world"

Line 5 sets the unit of mesurement to text coordinates that barely mimics old DOS printer's rows and columns coordinate system.

Line 6 sets the number of LPI (lines per inch) to 6. The default value is 6, so this line is not required. We added it for demonstration purposes only.

Line 7 sets the number of CPI (characters per inch) to 10. The default value is 10, so this line is not required. We added it for demonstration purposes only.

Line 8 send the command to print "Hello world" at column 5 and row 5. It uses the default/current set font, font size, font foreground and background colors.

Line 9 ends the print job.

Line 10 is the end of the if structure.

PageScript 32 is shipped with a demo program (PSTESTXXX.EXE) for each programming languages that we included (althgough every 32 bits programming languages are supported) that demonstrates most of the aspects and techniques to produce all kind of documents. We invite you to open and study these sample programs.