EPOC   SDK Home Glossary   Previous Next Up

Printer.opx — Printer and text handling


Contents


Overview

The Printer OPX provides access to print and text handling. An object to be printed is first created dynamically by sending text, bitmaps and formatting information. Printing itself is then handled by calling standard print dialogs. One procedure is provided for each of the four dialogs usually called from standard applications.

    DECLARE OPX PRINTER,KUidOpxPrinter&,KOpxPrinterVersion%
          SendStringToPrinter:(string$) : 1
          InsertString:(string$,pos&) : 2
          SendNewParaToPrinter: : 3
          InsertNewPara:(pos&) : 4
          SendSpecialCharToPrinter:(character%) : 5
          InsertSpecialChar:(character%,pos&) : 6
          SetAlignment:(alignment%) : 7
          InitialiseParaFormat:(Red&, Green&, Blue&,
                LeftMarginInTwips&,  RightMarginInTwips&,
                IndentInTwips&, HorizontalAlignment%,
                VerticalAlignment%, LineSpacingInTwips&,
                LineSpacingControl%, SpaceBeforeInTwips&,
                SpaceAfterInTwips&, KeepTogether%, KeepWithNext%,
                StartNewPage%, WidowOrphan%, Wrap%,
                BorderMarginInTwips&, DefaultTabWidthInTwips&) : 8
          SetLocalParaFormat: : 9
          SetGlobalParaFormat: : 10
          RemoveSpecificParaFormat: : 11
          SetFontName:(name$) : 12
          SetFontHeight:(height%) : 13
          SetFontPosition:(pos%) : 14
          SetFontWeight:(weight%) : 15
          SetFontPosture:(posture%) : 16
          SetFontStrikethrough:(strikethrough%) : 17
          SetFontUnderline:(underline%) : 18
          SetGlobalCharFormat: : 19
          RemoveSpecificCharFormat: : 20
          SendBitmapToPrinter:(bitmapHandle&) : 21
          InsertBitmap:(bitmapHandle&,pos&) : 22
          SendScaledBitmapToPrinter:(bitmapHandle&,xScale&,yScale&) : 23
          InsertScaledBitmap:(bitmapHandle&,pos&,xScale&,yScale&) : 24
          PrinterDocLength&: : 25
          SendRichTextToPrinter:(richTextAddress&) : 26
          ResetPrinting: : 27
          PageSetupDialog: : 28
          PrintPreviewDialog: : 29
          PrintRangeDialog: : 30
          PrintDialog: : 31
          SendBufferToPrinter:(addr&) : 32
    END DECLARE

Compatibility

ER5 WINS OPXs are not useable on the ER3 EPOC Emulator, and ER3 WINS OPXs will not work on the ER5 Emulator. However, ER5 MARM OPXs will work on ER3 EPOC devices, and ER3 MARM OPXs will work under ER5.


SENDSTRINGTOPRINTER:

Usage: SENDSTRINGTOPRINTER:(string$)

Append a string to whatever has already been sent to the printer.

See INSERTSTRING:, SENDNEWPARATOPRINTER:.


INSERTSTRING:

Usage: INSERTSTRING:(string$,pos&)

Insert string$ at position pos& in the buffer. Inserting at position zero puts the string ahead of anything already sent or inserted.

See SENDSTRINGTOPRINTER:, INSERTNEWPARA:.


SENDNEWPARATOPRINTER:

Usage: SENDNEWPARATOPRINTER:

Paragraphs delimit paragraph formatting, such as centring. This procedure is equivalent to

    SENDSPECIALCHARTOPRINTER:(KParagraphDelimiter%)

See SENDSPECIALCHARTOPRINTER:, INSERTNEWPARA:, SENDSTRINGTOPRINTER:.


INSERTNEWPARA:

Usage: INSERTNEWPARA:(pos&)

Inserts a new paragraph at position pos& in the buffer.

See SENDNEWPARATOPRINTER:, INSERTSTRING:.


SENDSPECIALCHARTOPRINTER:

Usage: SENDSPECIALCHARTOPRINTER:(character%)

Sends a special character, for example line and page breaks etc., to the printer. Constants for special characters are defined in Const.oph as follows:

    CONST KParagraphDelimiter%=$06
    CONST KLineBreak%=$07
    CONST KPageBreak%=$08
    CONST KTabCharacter%=$09
    CONST KNonBreakingTab%=$0a
    CONST KNonBreakingHyphen%=$0b
    CONST KPotentialHyphen%=$0c
    CONST KNonBreakingSpace%=$10
    CONST KVisibleSpaceCharacter%=$0f

See SENDNEWPARATOPRINTER:, INSERTSPECIALCHAR:.


INSERTSPECIALCHAR:

Usage: INSERTSPECIALCHAR:(character%,pos&)

Inserts a special character at pos& in the buffer.

See SENDSPECIALCHARTOPRINTER:.


SETALIGNMENT:

Usage: SETALIGNMENT:(alignment%)

Sets alignment state of a paragraph. Default is KPrintLeftAlign%.

The setting does not take effect until either SETLOCALPARAFORMAT: or SETGLOBALPARAFORMAT: is called. The allowable alignments, defined in Printer.oxh, are:

    CONST KPrintLeftAlign%=0
    CONST KPrintCenterAlign%=1
    CONST KPrintRightAlign%=2
    CONST KPrintJustifiedAlign%=3
    CONST KPrintUnspecifiedAlign%=4

See INITIALISEPARAFORMAT:.


INITIALISEPARAFORMAT:

Usage: INITIALISEPARAFORMAT:(Red%, Green%, Blue%,
LeftMarginInTwips&, RightMarginInTwips&, IndentInTwips&, HorizontalAlignment%, VerticalAlignment%, LineSpacingInTwips&, LineSpacingControl%, SpaceBeforeInTwips&, SpaceAfterInTwips&, KeepTogether%, KeepWithNext%, StartNewPage%, WidowOrphan%, Wrap%, BorderMarginInTwips&, DefaultTabWidthInTwips&)

Sets a state for formatting. The setting does not take effect until either SETLOCALPARAFORMAT or SETGLOBALPARAFORMAT is called.

Red%,Green%,Blue% set the background colour. Each value can be in the range 0 to 255. Default colour is white, with all three arguments equal to 255.

LeftMarginInTwips& sets left text margin relative to left page margin. Default is zero.

RightMarginInTwips& sets right text margin, relative to right page margin. Default is zero.

IndentInTwips& sets left, right and first line indent. Default is zero.

HorizontalAlignment% sets horizontal alignment of paragraph. Default is left alignment. See SETALIGNMENT for values.

VerticalAlignment% sets vertical alignment of paragraph (for use by spreadsheet applications). Default is top alignment. Allowable values, supplied in Printer.oxh, are:

    CONST KPrintTopAlign%=0
    CONST KPrintBottomAlign%=2
    CONST KPrintUnspecifiedAlign%=4

LineSpacingInTwips& sets inter-line spacing in twips. Default is 200 (10 point).

LineSpacingControl% sets the control for LineSpacingInTwips& value. Default is KLineSpacingAtLeastInTwips&. Allowable values are:

    CONST KLineSpacingAtLeastInTwips% = 0
    CONST KLineSpacingExactlyInTwips% = 1

SpaceBeforeInTwips& sets the space above a paragraph. Default is zero.

SpaceAfterInTwips& sets the space below a paragraph. Default is zero.

KeepTogether% prevents a page break within paragraph when KTrue%. Default is KFalse%. (Constants are defined in Const.oph.)

KeepWithNext% prevents a page break between this paragraph and the following paragraph when KTrue%. Default is KFalse%.

StartNewPage% inserts a page break immediately before this paragraph when KTrue%. Default is KFalse%.

WidowOrphan% prevents the printing of the last line of a paragraph by itself on the top of a new page (widow) or the first line of a paragraph by itself on the bottom of the page (orphan). Default is KFalse%.

Wrap% forces the paragraph to line wrap at the right margin when KTrue%. KFalse% disables line wrap. Default is KTrue%.

BorderMarginInTwips& sets distance in twips between paragraph border and enclosed text (must be non-negative). Default is zero.

DefaultTabWidthInTwips& specifies the spacing between the default tab stops. Default is 360.


SETLOCALPARAFORMAT:

Usage: SETLOCALPARAFORMAT:

Sets the initialised global paragraph formatting as local.

See SETGLOBALPARAFORMAT:.


SETGLOBALPARAFORMAT:

Usage: SETGLOBALPARAFORMAT:

Sets the local paragraph format as global (after initialising formatting).

See SETLOCALPARAFORMAT:, REMOVESPECIFICPARAFORMAT:.


REMOVESPECIFICPARAFORMAT:

Usage: REMOVESPECIFICPARAFORMAT:

Unsets local paragraph formatting, using global formatting instead

See SETGLOBALPARAFORMAT:, SETLOCALPARAFORMAT:.


SETFONTNAME:

Usage: SETFONTNAME:(name$)

Gives a new font name. Takes immediate effect locally, but requires the use of SETGLOBALCHARFORMAT: to set as the global default.


SETFONTHEIGHT:

Usage: SETFONTHEIGHT:(height%)

Gives a new font height in twips

(1 twip = 1/20 points or 1/1440 inches)

Takes immediate effect locally, but requires the use of SETGLOBALCHARFORMAT: to set as the global default.


SETFONTPOSITION:

Usage: SETFONTPOSITION:(POS%)

Sets font position as normal, superscript or subscript. The following constants can be used for this:

    CONST KPrintPosNormal%=0 
    CONST KPrintPosSuperscript%=1
    CONST KPrintPosSubscript%=2

Takes immediate effect locally, but requires the use of SETGLOBALCHARFORMAT: to set as the global default.


SETFONTWEIGHT:

Usage: SETFONTWEIGHT:(weight%)

Sets the font weight (normal or bold). Allowable values are:

    CONST KStrokeWeightNormal%=0
    CONST KStrokeWeightBold%=1

Takes immediate effect locally, but requires the use of SETGLOBALCHARFORMAT: to set as the global default.


SETFONTPOSTURE:

Usage: SETFONTPOSTURE:(posture%)

Sets font posture using the following constants:

    CONST KPostureUpright%=0
    CONST KPostureItalic%=1

Takes immediate effect locally, but requires the use of SETGLOBALCHARFORMAT: to set as the global default.


SETFONTSTRIKETHROUGH:

Usage: SETFONTSTRIKETHROUGH:(strikethrough%)

Set strike-through on or off using:

    CONST KStrikethroughOff%=0
    CONST KStrikethroughOn%=1

Takes immediate effect locally, but requires the use of SETGLOBALCHARFORMAT: to set as the global default.      


SETFONTUNDERLINE:

Usage: SETFONTUNDERLINE:(underline%)

Set underline on or off using:

    CONST KUnderlineOff%=0
    CONST KUnderlineOn%=1

Takes immediate effect locally, but requires the use of SETGLOBALCHARFORMAT: to set as the global default.


SETGLOBALCHARFORMAT:

Usage: SETGLOBALCHARFORMAT:

Sets the currently active character format to be the global default.

See REMOVESPECIFICCHARFORMAT:.


REMOVESPECIFICCHARFORMAT:

Usage: REMOVESPECIFICCHARFORMAT:

Unsets local character formatting, replacing it with the global formatting instead.

See SETGLOBALCHARFORMAT:.


SENDBITMAPTOPRINTER:

Usage: SENDBITMAPTOPRINTER:(bitmapHandle&)

Appends a bitmap from its handle bitmapHandle&.

See INSERTBITMAP:, SENDSCALEDBITMAPTOPRINTER:.


INSERTBITMAP:

Usage: INSERTBITMAP:(bitmapHandle&,pos&)

Inserts a bitmap specified by bitmapHandle& at position pos& in the buffer to be sent to the printer. The handle is the same as that returned by gLOADBIT.

See SENDBITMAPTOPRINTER:, INSERTSCALEDBITMAP:.


SENDSCALEDBITMAPTOPRINTER:

Usage: SENDSCALEDBITMAPTOPRINTER:(bitmapHandle&,xScale&,yScale&)

Appends a scaled bitmap specified by bitmapHandle& and scaled according to xScale& and yScale& to the buffer sent to the printer. The handle is the same as that returned by gLOADBIT. Default scaling is xScale& = yScale& = 1000.

See SENDBITMAPTOPRINTER:, INSERTSCALEDBITMAP:.


INSERTSCALEDBITMAP:

Usage: INSERTSCALEDBITMAP:(bitmapHandle&,pos&,xScale&,yScale&)

Inserts a scaled bitmap specified by bitmapHandle& and scaled according to xScale& and yScale& at position pos& in the buffer sent to the printer. The handle is the same as that returned by gLOADBIT.

See INSERTBITMAP:, SENDSCALEDBITMAPTOPRINTER:.


PRINTERDOCLENGTH&:

Usage: PRINTERDOCLENGTH&:      

Returns the count of characters currently held in the buffer. It is not possible to insert characters beyond the length of the document buffer. Bitmaps and special characters each count as one character.


SENDRICHTEXTTOPRINTER:

Usage: SENDRICHTEXTTOPRINTER:(richTextAddress&)

Sends the address of a rich text object richTextAddress& to the printer. This is intended to be used on a pointer returned by another OPX. This new Rich Text will replace all content currently stored.


RESETPRINTING:

Usage: RESETPRINTING:

Deletes all text, bitmaps and formatting in the printing buffer.


PAGESETUPDIALOG:

Usage: PAGESETUPDIALOG:

Calls the standard page setup dialog.

See PRINTPREVIEWDIALOG:, PRINTRANGEDIALOG:, PRINTDIALOG:.


PRINTPREVIEWDIALOG:

Usage: PRINTPREVIEWDIALOG:

Calls the standard print preview dialog. This allows the data sent to the printer to be viewed. The other three dialogs can all be called from this dialog.

See PAGESETUPDIALOG:, PRINTRANGEDIALOG:, PRINTDIALOG:.


PRINTRANGEDIALOG:

Usage: PRINTRANGEDIALOG:

Calls a standard print range dialog.

See PAGESETUPDIALOG:, PRINTPREVIEWDIALOG:, PRINTDIALOG:.


PRINTDIALOG:

Usage: PRINTDIALOG:

Calls a standard print dialog.

See PAGESETUPDIALOG:, PRINTPREVIEWDIALOG:, PRINTRANGEDIALOG:.


SENDBUFFERTOPRINTER:

Usage: SENDBUFFERTOPRINTER:(addr&)

Appends the contents of a buffer to whatever has already been sent to the printer. The addr& parameter should be the address of a buffer into which text has been inserted by dEDITMULTI.

EPOC       SDK Home Glossary   Previous Next Up