Edgars Bināns > Win32-Printer-0.9.1 > Win32::Printer

Download:
Win32-Printer-0.9.1.zip

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Module Version: 0.9.1   Source  

NAME ^

Win32::Printer - Perl extension for Win32 printing

SYNOPSIS ^

 use Win32::Printer;

 my $dc = new Win32::Printer(
                                papersize       => A4,
                                dialog          => NOSELECTION,
                                description     => 'Hello, Mars!',
                                unit            => 'mm'
                            );

 my $font = $dc->Font('Arial Bold', 24);
 $dc->Font($font);
 $dc->Color(0, 0, 255);
 $dc->Write("Hello, Mars!", 10, 10);

 $dc->Brush(128, 0, 0);
 $dc->Pen(4, 0, 0, 128);
 $dc->Ellipse(10, 25, 50, 50);

 $dc->Close();

ABSTRACT ^

DISCONTINUED!!! Win32 GDI graphical printing If You are desperate to find me You can try to to do it through CPAN!

INSTALLATION ^

Source installation

1. Make sure you have a C/C++ compiler and you're running Win32.

2. For VC++ 6.0 or VC++ .NET do the following (others not tested):

  > perl Makefile.PL
  > nmake
  > nmake test
  > nmake install

3. For bitmap support, copy FreeImage.dll somewhere in your system path. You may get this library form http://sourceforge.net.

4. For PDF support, install Ghostscript and set path to it's \bin directory. You may get this PostScript interpreter form http://sourceforge.net.

5. For Barcode support, install ebbl. DISCONTINUED!!!

6. Enjoy it ;)

DESCRIPTION ^

All symbolic constants are exported by default!!!

new

 new Win32::Printer ( [ parameter => value, ... ] );

The new class method creates printer object, starts new document (a print job), returns printer object and changes $dc->{flags} variable. $dc->{flags} contains modified printer dialog flags. new also sets $dc->{copies}, $dc->{collate}, $dc->{maxp} and $dc->{minp}, $dc->{xres}, $dc->{yres}, $dc->{xsize}, $dc->{ysize} variables.

  $dc->{xres};  # X resolution
  $dc->{yres};  # Y resolution
  $dc->{xsize}; # X size in chosen units
  $dc->{ysize}; # Y size in chosen units

NOTE! Print job is automatically aborted if print job is not ended by "End" or "Close" methods or if an error occurs!

The new class method sets the following optional printer object and document parameters:

collate

Specifies whether collation should be used when printing multiple copies. This member can be be one of the following values:

  0 - Do not collate when printing multiple copies. 
  1 - Collate when printing multiple copies (default).

Using collate provides faster, more efficient output for collation, since the data is sent to the device driver just once, no matter how many copies are required. The printer is told to simply print the page again. If this flag is set to 1 and print dialog is used, the Collate check box is initially checked.

$dc->{collate} variable shows if collation was required. You may use it after print dialog to check user input.

If $dc->{collate} is set to 0 - You need to handle multiple copies by yourself.

See also "copies".

color*

Switches between color and monochrome on color printers. Following are the possible values:

  MONOCHROME                    = 1
  COLOR                         = 2

copies

Initial number of document copies to print. Used by dialog and/or printer driver. $dc->{collate} variable shows how many copies were required.

See also "collate".

dc

If dc defined- returns only device context without starting the document and new page.

debug*

Set to:

  0 - default;
  1 - die on warnings;
  2 - warn on errors (not recomended);

If debug level set to 2- methods return undef value on error.

MAY INTERFERE WITH DIFFERENT PRINTER OBJECTS!

See also "Debug".

description

Document description. Default is "Printer". It is used as document name, filename suggestion and/or PDF document title;

dialog

If both "printer" and dialog attributes omitted- systems default printer is used.

Printer dialog settings. You may use the combination of the following flags ($dc->{flags} contains modified printer dialog flags):

  ALLPAGES                      = 0x000000

The default flag that indicates that the All radio button is initially selected. This flag is used as a placeholder to indicate that the PAGENUMS and SELECTION flags are not specified.

  SELECTION                     = 0x000001

If this flag is set, the Selection radio button is selected. If neither PAGENUMS nor SELECTION is set, the All radio button is selected.

  PAGENUMS                      = 0x000002

If this flag is set, the Pages radio button is selected. If this flag is set when the new method returns, the $dc->{maxp} and $dc->{minp} variables indicate the starting and ending pages specified by the user.

  NOSELECTION                   = 0x000004

Disables the Selection radio button.

  NOPAGENUMS                    = 0x000008

Disables the Pages radio button and the associated edit controls.

  PRINTTOFILE                   = 0x000020

If this flag is set, the Print to File check box is selected.

  PRINTSETUP                    = 0x000040

Causes the system to display the Print Setup dialog box rather than the Print dialog box.

  NOWARNING                     = 0x000080

Prevents the warning message from being displayed when there is no default printer.

  DISABLEPRINTTOFILE            = 0x080000

Disables the Print to File check box.

  HIDEPRINTTOFILE               = 0x100000

Hides the Print to File check box.

  NONETWORKBUTTON               = 0x200000

Hides and disables the Network button.

duplex

Duplexing mode:

  SIMPLEX                       = 1
  VERTICAL                      = 2
  HORIZONTAL                    = 3

file

Set file attribute to save printer drivers output into the file specified by value of attribute. Note: Specified file will not be overwritten- it's name will be changed to file_name(1)... file_name(n) to avoid overwriting.

If the flag is set - End(), Abort() and Close() methods returns possibly modified file name.

See also "pdf", "prompt", "End", "Abort" and "Close".

It is used as suggestion if used with prompt or dialog's PRINTTOFILE.

height

Set specific page height (must be greater than tenth of milimetre).

See also "width".

maxp

Major page number in printer dialog (maximal allowed value).

See also "minp".

minp

Minor page number in printer dialog (minimal allowed value).

See also "maxp".

orientation

Page orientation (portrait by default).

  PORTRAIT                      = 1
  LANDSCAPE                     = 2

papersize

Defined paper sizes:

  LETTER                        = 1
  LETTERSMALL                   = 2
  TABLOID                       = 3
  LEDGER                        = 4
  LEGAL                         = 5
  STATEMENT                     = 6
  EXECUTIVE                     = 7
  A3                            = 8
  A4                            = 9
  A4SMALL                       = 10
  A5                            = 11
  B4                            = 12
  B5                            = 13
  FOLIO                         = 14
  QUARTO                        = 15
  IN_10X14                      = 16
  IN_11X17                      = 17
  NOTE                          = 18
  ENV_9                         = 19
  ENV_10                        = 20
  ENV_11                        = 21
  ENV_12                        = 22
  ENV_14                        = 23
  CSHEET                        = 24
  DSHEET                        = 25
  ESHEET                        = 26
  ENV_DL                        = 27
  ENV_C5                        = 28
  ENV_C3                        = 29
  ENV_C4                        = 30
  ENV_C6                        = 31
  ENV_C65                       = 32
  ENV_B4                        = 33
  ENV_B5                        = 34
  ENV_B6                        = 35
  ENV_ITALY                     = 36
  ENV_MONARCH                   = 37
  ENV_PERSONAL                  = 38
  FANFOLD_US                    = 39
  FANFOLD_STD_GERMAN            = 40
  FANFOLD_LGL_GERMAN            = 41
  ISO_B4                        = 42
  JAPANESE_POSTCARD             = 43
  IN_9X11                       = 44
  IN_10X11                      = 45
  IN_15X11                      = 46
  ENV_INVITE                    = 47
  RESERVED_48                   = 48
  RESERVED_49                   = 49
  LETTER_EXTRA                  = 50
  LEGAL_EXTRA                   = 51
  TABLOID_EXTRA                 = 52
  A4_EXTRA                      = 53
  LETTER_TRANSVERSE             = 54
  A4_TRANSVERSE                 = 55
  LETTER_EXTRA_TRANSVERSE       = 56
  A_PLUS                        = 57
  B_PLUS                        = 58
  LETTER_PLUS                   = 59
  A4_PLUS                       = 60
  A5_TRANSVERSE                 = 61
  B5_TRANSVERSE                 = 62
  A3_EXTRA                      = 63
  A5_EXTRA                      = 64
  B5_EXTRA                      = 65
  A2                            = 66
  A3_TRANSVERSE                 = 67
  A3_EXTRA_TRANSVERSE           = 68

pdf

Set this attribute if You want to convert PostScript printer drivers output to PDF format. WARNING: This feature needs installed Ghostscript and atleast one PostScript printer driver. Use this attribute with "file" or "prompt" attributes.

Set attribute value to:

   0    - ignore Ghostscript messages;
   1    - redirect Ghostscript messages to log file;
 other  - redirect Ghostscript messages to STDERR;

Use "file" attribute "-" to generate pdf to STDOUT.

See also "file", "prompt".

printer

If both printer and "dialog" attributes omitted- systems default printer is used. Value of attribute is also used for "dialog" initialisation.

Set printer's "friendly" name e.g. "HP LaserJet 8500" or network printer's UNC e.g. "\\\\server\\printer" or "//server/printer".

prompt

If prompt attribute defined- prompts for print output filename and sets "file" attribute. Behaves like "file" attribute. Also sets "dialog"'s PRINTTOFILE flag.

See also "file", "pdf".

source

Specifies the paper source.

  BIN_ONLYONE                   = 1
  BIN_LOWER                     = 2
  BIN_MIDDLE                    = 3
  BIN_MANUAL                    = 4
  BIN_ENVELOPE                  = 5
  BIN_ENVMANUAL                 = 6
  BIN_AUTO                      = 7
  BIN_TRACTOR                   = 8
  BIN_SMALLFMT                  = 9
  BIN_LARGEFMT                  = 10
  BIN_LARGECAPACITY             = 11
  BIN_CASSETTE                  = 14
  BIN_FORMSOURCE                = 15

unit*

Document units (inches by default). Specified unit is used for all coordinates and sizes, except for font sizes and pen widths.

You may use strings:

  'in' - inches
  'mm' - millimeters
  'cm' - centimeters
  'pt' - points (in/72)

Or unit ratio according to:

  ratio = in / unit

  Example: 2.5409836 cm = 1 in

Set units to 0 to use device units.

See also "Unit".

width

Set specific page width (must be greater than tenth of milimetre).

See also "height".

Abort

  $dc->Abort();

The Abort method stops the current print job and erases everything drawn since the last call to the "Start" method. Method returns possibly changed file name if "file" attribute is set.

See also "Start", "Next", "End" and "file".

Arc

  $dc->Arc($x, $y, $width, $height, $start_angle, $end_angle2);

The Arc method draws an elliptical arc. $x, $y sets the upper-left corner coordinates of bounding rectangle. $width, $height sets the width and height of bounding rectangle. $start_angle, $end_angle2 sets the starting and ending angle of the arc according to the center of bounding rectangle. The current point is not updated.

See also "ArcTo", "Ellipse", "Chord" and "Pie".

ArcTo

  $dc->ArcTo($x, $y, $width, $height, $start_angle, $end_angle2);

The ArcTo method draws an elliptical arc. $x, $y sets the upper-left corner coordinates of bounding rectangle. $width, $height sets the width and height of bounding rectangle. $start_angle, $end_angle2 sets the starting and ending angle of the arc according to the center of bounding rectangle. The current point is updated.

See also "Move", "Arc", "Ellipse", "Chord" and "Pie".

Bezier

  $dc->Bezier(@points);

The Polybezier method draws cubic Bézier curves by using the endpoints and control points specified by the @points array. The first curve is drawn from the first point to the fourth point by using the second and third points as control points. Each subsequent curve in the sequence needs exactly three more points: the ending point of the previous curve is used as the starting point, the next two points in the sequence are control points, and the third is the ending point. The current point is not updated.

See also "BezierTo".

BezierTo

  $dc->Bezier(@points);

The BezierTo method draws one or more Bézier curves. This method draws cubic Bézier curves by using the control points specified by the @points array. The first curve is drawn from the current position to the third point by using the first two points as control points. For each subsequent curve, the method needs exactly three more points, and uses the ending point of the previous curve as the starting point for the next. The current point is updated.

See also "Bezier" and "Move".

Brush

  $handle = $dc->Brush([$r, $g, $b, [$hatch]]);
  ($handle, $previous_handle) = $dc->Brush([$r, $g, $b, [$hatch]]);
  $previous_handle = $dc->Brush($handle);

The Brush method creates a logical brush that has the specified style and optional hatch style. If no parameters specified, creates transparent brush.

You may use the following brush hatch styles:

  HS_HORIZONTAL                 = 0

Horizontal hatch.

  HS_VERTICAL                   = 1

Vertical hatch.

  HS_FDIAGONAL                  = 2

A 45-degree downward, left-to-right hatch.

  HS_BDIAGONAL                  = 3

A 45-degree upward, left-to-right hatch.

  HS_CROSS                      = 4

Horizontal and vertical cross-hatch

  HS_DIAGCROSS                  = 5

45-degree crosshatch.

See also "Pen" and "EBbl".

Caps

  $dc->Caps($index);

The Caps method retrieves device-specific information about a specified device.

$index specifies the item to return. This parameter can be one of the following values:

  DRIVERVERSION                 = 0

The device driver version.

  HORZSIZE                      = 4

Width, in millimeters, of the physical screen.

  VERTSIZE                      = 6

Height, in millimeters, of the physical screen.

  HORZRES                       = 8

Width, in pixels, of the screen.

  VERTRES                       = 10

Height, in raster lines, of the screen.

  BITSPIXEL                     = 12

Number of adjacent color bits for each pixel.

  PLANES                        = 14

Number of color planes.

  NUMBRUSHES                    = 16

Number of device-specific brushes.

  NUMPENS                       = 18

Number of device-specific pens.

  NUMFONTS                      = 22

Number of device-specific fonts.

  NUMCOLORS                     = 24

Number of entries in the device's color table, if the device has a color depth of no more than 8 bits per pixel. For devices with greater color depths, -1 is returned.

  CURVECAPS                     = 28

Value that indicates the curve capabilities of the device, as shown in the following table:

    0           Device does not support curves.
    1           Device can draw circles.
    2           Device can draw pie wedges.
    4           Device can draw chord arcs.
    8           Device can draw ellipses.
    16          Device can draw wide borders.
    32          Device can draw styled borders.
    64          Device can draw borders that are wide and styled.
    128         Device can draw interiors.
    256         Device can draw rounded rectangles.
-

  LINECAPS                      = 30

Value that indicates the line capabilities of the device, as shown in the following table:

    0           Device does not support lines.
    2           Device can draw a polyline.
    4           Device can draw a marker.
    8           Device can draw multiple markers.
    16          Device can draw wide lines.
    32          Device can draw styled lines.
    64          Device can draw lines that are wide and styled.
    128         Device can draw interiors.
_

  POLYGONALCAPS                 = 32

Value that indicates the polygon capabilities of the device, as shown in the following table:

    0           Device does not support polygons.
    1           Device can draw alternate-fill polygons.
    2           Device can draw rectangles.
    4           Device can draw winding-fill polygons.
    8           Device can draw a single scanline.
    16          Device can draw wide borders.
    32          Device can draw styled borders.
    64          Device can draw borders that are wide and styled.
    128         Device can draw interiors.
-

  TEXTCAPS                      = 34

Value that indicates the text capabilities of the device, as shown in the following table:

    0x0001      Device is capable of character output precision.
    0x0002      Device is capable of stroke output precision.
    0x0004      Device is capable of stroke clip precision.
    0x0008      Device is capable of 90-degree character rotation.
    0x0010      Device is capable of any character rotation.
    0x0020      Device can scale independently in the x- and y-directions.
    0x0040      Device is capable of doubled character for scaling.
    0x0080      Device uses integer multiples only for character scaling.
    0x0100      Device uses any multiples for exact character scaling.
    0x0200      Device can draw double-weight characters.
    0x0400      Device can italicize.
    0x0800      Device can underline.
    0x1000      Device can draw strikeouts.
    0x2000      Device can draw raster fonts.
    0x4000      Device can draw vector fonts.
_

  CLIPCAPS                      = 36

Flag that indicates the clipping capabilities of the device. If the device can clip to a rectangle, it is 1. Otherwise, it is 0.

  RASTERCAPS                    = 38

Value that indicates the raster capabilities of the device, as shown in the following table:

    0x0001      Capable of transferring bitmaps.
    0x0002      Requires banding support.
    0x0004      Capable of scaling.
    0x0008      Capable of supporting bitmaps larger than 64K.
    0x0010      Capable of supporting features of 16-bit Windows 2.0.
    0x0080      Capable of supporting the SetDIBits and GetDIBits functions
                (Win API).
    0x0100      Specifies a palette-based device.
    0x0200      Capable of supporting the SetDIBitsToDevice function (Win API).
    0x0800      Capable of performing the StretchBlt function (Win API).
    0x1000      Capable of performing flood fills.
    0x2000      Capable of performing the StretchDIBits function (Win API).
-

  ASPECTX                       = 40

Relative width of a device pixel used for line drawing.

  ASPECTY                       = 42

Relative height of a device pixel used for line drawing.

  ASPECTXY                      = 44

Diagonal width of the device pixel used for line drawing.

  LOGPIXELSX                    = 88

Number of pixels per logical inch along the screen width.

  LOGPIXELSY                    = 90

Number of pixels per logical inch along the screen height.

  SIZEPALETTE                   = 104

Number of entries in the system palette. This index is valid only if the device driver sets the RC_PALETTE bit in the RASTERCAPS index and is available only if the driver is compatible with 16-bit Windows.

  NUMRESERVED                   = 106

Number of reserved entries in the system palette. This index is valid only if the device driver sets the RC_PALETTE bit in the RASTERCAPS index and is available only if the driver is compatible with 16-bit Windows.

  COLORRES                      = 108

Actual color resolution of the device, in bits per pixel. This index is valid only if the device driver sets the RC_PALETTE bit in the RASTERCAPS index and is available only if the driver is compatible with 16-bit Windows.

  PHYSICALWIDTH                 = 110

For printing devices: the width of the physical page, in device units. For example, a printer set to print at 600 dpi on 8.5"x11" paper has a physical width value of 5100 device units. Note that the physical page is almost always greater than the printable area of the page, and never smaller.

  PHYSICALHEIGHT                = 111

For printing devices: the height of the physical page, in device units. For example, a printer set to print at 600 dpi on 8.5"x11" paper has a physical height value of 6600 device units. Note that the physical page is almost always greater than the printable area of the page, and never smaller.

  PHYSICALOFFSETX               = 112

For printing devices: the distance from the left edge of the physical page to the left edge of the printable area, in device units. For example, a printer set to print at 600 dpi on 8.5"x11" paper, that cannot print on the leftmost 0.25" of paper, has a horizontal physical offset of 150 device units.

  PHYSICALOFFSETY               = 113

For printing devices: the distance from the top edge of the physical page to the top edge of the printable area, in device units. For example, a printer set to print at 600 dpi on 8.5"x11" paper, that cannot print on the topmost 0.5" of paper, has a vertical physical offset of 300 device units.

  SCALINGFACTORX                = 114

Scaling factor for the x-axis of the printer.

  SCALINGFACTORY                = 115

Scaling factor for the y-axis of the printer.

See also "new".

Chord

  $dc->Chord($x, $y, $width, $height, $start_angle, $end_angle2);

The Chord method draws a chord (a region bounded by the intersection of an ellipse and a line segment, called a "secant"). The chord is outlined by using the current pen and filled by using the current brush. $x, $y sets the upper-left corner coordinates of bounding rectangle. $width, $height sets the width and height of bounding rectangle. $start_angle, $end_angle2 sets the starting and ending angle of the chord according to the center of bounding rectangle.

See also "Ellipse", "Pie", "Arc" and "ArcTo".

Close

  $dc->Close([$image_handle_or_path]);

The Close method finishes current print job, closes all open handles and frees memory. Method returns possibly changed file name if "file" attribute is set.

If optional image handle or path is provided- closes only that image!

See also "new", "Image", "MetaEnd", "EBbl" and "file".

Color

  $previous_coloref = $dc->Color($b, $g, $b);
  $previous_coloref = $dc->Color($coloref);

The Color method sets the text to the specified color.

See also "Write", "Font" and "EBbl".

Debug

  $dc->Debug([$debuglevel]);

The Debug method changes debug level from now on or gets current level. Possible values:

  0 - default;
  1 - die on warnings;
  2 - warn on errors (not recomended);

If debug level set to 2- methods return undef value on error.

MAY INTERFERE WITH DIFFERENT PRINTER OBJECTS!

See also "debug*".

EBbl

  $dc->EBbl($string, $x, $y, $flags, $baw, $bah);

The EBbl method draws barcode. Uses "Brush" to fill the bars, current "Font" for the text and "Color" for the text color. $string string to encode, $x drawing x origin, $y drawing y origin, $flags barcode mode flags, $baw narrowest bar width in pts, $bah bar height in pts.

  Mode flags:

  EB_25MATRIX   - 2 of 5 Matrix
  EB_25INTER    - 2 of 5 Interleaved
  EB_25IND      - 2 of 5 Industrial
  EB_25IATA     - 2 of 5 IATA

  EB_27         - 2 of 7 (aka CODABAR)

  EB_39STD      - 3 of 9
  EB_39EXT      - 3 of 9 extended
  EB_39DUMB     - 3 of 9 "dumb" (allows to pass asterixes *)

  EB_93         - 9 of 3

  EB_128SMART   - Code 128 "Smart" (smallest possible with shifting and code changes)
  EB_128A       - Code 128 A
  EB_128B       - Code 128 B
  EB_128C       - Code 128 C
  EB_128SHFT    - Allow shifting (for 128A, 128B, 128C)
  EB_128EAN     - EAN fnc (for 128SMART, 128A, 128B, 128C)

  EB_EAN13      - EAN-13
  EB_UPCA       - UPC-A
  EB_EAN8       - EAN-8
  EB_UPCE       - UPC-E
  EB_ISBN       - ISBN
  EB_ISBN2      - ISBN (reserved)
  EB_ISSN       - ISSN

  EB_AD2        - 2 digit addon (for EAN13, EAN8, UPCA, UPCE, ISSN, ISBN, ISBN2 modes)
  EB_AD5        - 5 digit addon (for EAN13, EAN8, UPCA, UPCE, ISSN, ISBN, ISBN2 modes)

  EB_CHK        - With optional check character (for 25, 39 modes)

  EB_TXT        - Draw text (for all codes)

See also "Brush", "Font" and "Color".

Ellipse

  $dc->Ellipse($x, $y, $width, $height);

The Ellipse method draws an ellipse. The center of the ellipse is the center of the specified bounding rectangle. The ellipse is outlined by using the current pen and is filled by using the current brush. $x, $y sets the upper-left corner coordinates of bounding rectangle. $width, $height sets the width and height of bounding rectangle.

See also "Pie", "Chord", "Arc" and "ArcTo".

End

  $dc->End();

The End method finishes a current print job. Method returns possibly changed file name if "file" attribute is set.

Not allowed in "Meta" brackets!

See also "Start", "Next", "Abort", "Page" and "file".

Fill

  $dc->Fill($mode);

The Fill method sets the polygon fill mode for methods that fill polygons.

  ALTERNATE                     = 1

Selects alternate mode (fills the area between odd-numbered and even-numbered polygon sides on each scan line).

  WINDING                       = 2

Selects winding mode (fills any region with a nonzero winding value).

See also "PDraw" and "Poly".

Fit

  $char_num = $dc->Fit($text, $maxwidth, [UTF8]);
  ($char_num, $width, $height) = $dc->Fit($text, $maxwidth, [UTF8]);

The Fit method retrieves the number of characters ($char_num) in a specified string ($text) that will fit within a specified space ($maxwidth) and in array context also returns $width, $height of string. Use UTF8 for UTF-8 encoded strings;

See also "Write" and "Write2".

Font

  $font_handle = $dc->Font([$face, [$size, [$angle, [$charset]]]]);
  ($font_handle, $previous_font) = $dc->Font([$face, [$size, [\[$escapement, [orientation]\], [$charset]]]]);

or

  $dc->Font($font_handle);

The Font method creates and selects a logical font that has specific characteristics and returns handle to it or selects given font by it's handle. Fontsize is set in pts. In array context also returns previously selecte font handle.

For UTF-8 support see "Write".

IMPORTANT!!! First font (e.g. "Arial") that matches desired attributes is selected if desired font is not found. Reason of that may be raster font, wrong font name, character set unsupported by font etc. Warning is issued!

If $angle is array reference then function looks for ($escapement, [orientation])

Example:

  $fh = $dc->Font("Arial", 10, [-90, 0]); # Same as:
  $fh = $dc->Font("Arial", 10, [-90]);    # ...prints characters cascaded vertically

$escapement - Specifies the angle in degrees, between the escapement vector and the x-axis of the device. The escapement vector is parallel to the base line of a row of text.

Windows NT/2k/XP/...: You can specify the escapement angle of the string independently of the orientation angle of the string's characters.

Windows 95/98/Me: The $escapement member specifies both the escapement and orientation. You should set $escapement and $orientation to the same value.

$orientation - Specifies the angle, in degrees, between each character's base line and the x-axis of the device.

Defaults to:

  $face = '';           # First font (e.g. "Arial") that matches desired attributes
  $size = 10;           # fontsize
  $angle = 0;           # text direction angle in degrees
  $charset = DEFAULT;   # character set code

$face may include any combination of the following attributes: bold italic underline strike.

Defined character set constants:

  ANSI                          = 0
  DEFAULT                       = 1
  SYMBOL                        = 2
  MAC                           = 77
  SHIFTJIS                      = 128
  HANGEUL                       = 129
  JOHAB                         = 130
  GB2312                        = 134
  CHINESEBIG5                   = 136
  GREEK                         = 161
  TURKISH                       = 162
  VIETNAMESE                    = 163
  HEBREW                        = 177
  ARABIC                        = 178
  BALTIC                        = 186
  RUSSIAN                       = 204
  THAI                          = 222
  EASTEUROPE                    = 238
  OEM                           = 255

See also "FontEnum", "Write", "Color" and "EBbl".

FontEnum

  $font_table = $dc->FontEnum([$face, [$charset]]);
  @font_array = $dc->FontEnum([$face, [$charset]]);

The FontEnum method enumerates all fonts in the system available for printer that match the font characteristics specified. It returns tab-delimited table of values in scalar context or array of hashes in array context. $font - font face of interest, $charset - character set of interest.

Follown hash keys available:

  {Face}        - enumerated font face
  {Charset}     - enumerated character set (character set codes - see Font method)
  {Style}       - enumerated font style ('bold' and/or 'italic')
  {Type}        - type of enumerated font face (Raster = 1, Device = 2, TrueType = 4);

See also "Font".

FontSpace

  $old_space = $dc->FontSpace($space);

The FontSpace function sets the intercharacter spacing ($space) and returns previous value. $space is in pts. Intercharacter spacing is added to each character, including break characters, when the system writes a line of text.

See also "Font" and "Write2".

Image

  $image_handle = $dc->Image($filename);
  ($image_handle, $original_width, $original_height) = $dc->Image($filename);

or

  $image_handle = $dc->Image($filename, $x, $y, [$width, $height]);
  ($image_handle, $original_width, $original_height) = $dc->Image($filename, $x, $y, [$width, $height]);
  $dc->Image($image_handle, $x, $y, [$width, $height]);

or

  ($width, $height) = $dc->Image($image_handle);

The Image method loads an image file into memory and returns a handle to it or draws it by it's filename or handle. $x, $y specifies coordinates of the image upper-left corner. $width, $height specifies the width and height of image on the paper (default is set by image header). Once loaded by image path- image is cached in to memory and it may be referenced by it's path.

In second case if signed integer is given- method assumes it's a handle!

In array context also returns original image width an d height $original_width, $original_height.

Natively it supports EMF and WMF format files. BMP, CUT, DDS, ICO, JPEG, JNG, KOALA, LBM, IFF, MNG, PBM, PBMRAW, PCD, PCX, PGM, PGMRAW, PNG, PPM, PPMRAW, PSD, RAS, TARGA, TIFF, WBMP, XBM, XPM bitmap formats are handled via FreeImage library.

Image file formats are recognized by their extensions. On failure- method tries to recognize it by file content (bitmaps only).

WARNING! Metafiles may have objects outside the bounding box specified by metafile header. These objects will be visible unless you specify clipping region (See "PClip").

After usage, you should use "Close" to unload image from memory and destroy a handle.

See also "Close", "MetaEnd" and "EBbl".

ImageSave

  $dc->ImageSave($handle, $filename, [$bpp, [$width, $height, [$format, [$flag]]]]);

The ImageSave method saves image as bitmap by its $handle aquired by "Image", "MetaEnd" or "EBbl" methods. $filename represents the file name and path string. $bpp for setting target bit depth (currently only 24-bit & 8-bit images supported). $width, $height target width of the image.

$format is one of the following (Note, that not all formats are writable yet):

  FIF_BMP                       = 0

Windows or OS/2 Bitmap File (*.BMP)

  FIF_ICO                       = 1

Windows Icon (*.ICO)

  FIF_JPEG                      = 2

Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE)

  FIF_JNG                       = 3

JPEG Network Graphics (*.JNG)

  FIF_KOALA                     = 4

Commodore 64 Koala format (*.KOA)

  FIF_IFF                       = 5

Amiga IFF (*.IFF, *.LBM)

  FIF_MNG                       = 6

Multiple Network Graphics (*.MNG)

  FIF_PBM                       = 7

Portable Bitmap (ASCII) (*.PBM)

  FIF_PBMRAW                    = 8

Portable Bitmap (BINARY) (*.PBM)

  FIF_PCD                       = 9

Kodak PhotoCD (*.PCD)

  FIF_PCX                       = 10

Zsoft Paintbrush PCX bitmap format (*.PCX)

  FIF_PGM                       = 11

Portable Graymap (ASCII) (*.PGM)

  FIF_PGMRAW                    = 12

Portable Graymap (BINARY) (*.PGM)

  FIF_PNG                       = 13

Portable Network Graphics (*.PNG)

  FIF_PPM                       = 14

Portable Pixelmap (ASCII) (*.PPM)

  FIF_PPMRAW                    = 15

Portable Pixelmap (BINARY) (*.PPM)

  FIF_RAS                       = 16

Sun Rasterfile (*.RAS)

  FIF_TARGA                     = 17

Truevision Targa files (*.TGA, *.TARGA)

  FIF_TIFF                      = 18

Tagged Image File Format (*.TIF, *.TIFF)

  FIF_WBMP                      = 19

Wireless Bitmap (*.WBMP)

  FIF_PSD                       = 20

Adobe Photoshop (*.PSD)

  FIF_CUT                       = 21

Dr. Halo (*.CUT)

  FIF_XBM                       = 22

X11 Bitmap Format (*.XBM)

  FIF_XPM                       = 23

X11 Pixmap Format (*.XPM)

  FIF_DDS                       = 24

DirectDraw Surface (*.DDS)

  FIF_GIF                       = 25

Graphics Interchange Format (*.GIF)

$flag is one of the following:

BMP:

  BMP_DEFAULT                   = 0

Save without any compression

  BMP_SAVE_RLE                  = 1

Compress the bitmap using RLE when saving

JPEG:

  JPEG_DEFAULT                  = 0

Saves with good quality (75:1)

  JPEG_QUALITYSUPERB            = 0x80

Saves with superb quality (100:1)

  JPEG_QUALITYGOOD              = 0x100

Saves with good quality (75:1)

  JPEG_QUALITYNORMAL            = 0x200

Saves with normal quality (50:1)

  JPEG_QUALITYAVERAGE           = 0x400

Saves with average quality (25:1)

  JPEG_QUALITYBAD               = 0x800

Saves with bad quality (10:1)

  Integer x in [0..100]

Save with quality x:100

PBM, PGM, PPM:

  PNM_DEFAULT                   = 0

Saves the bitmap as a binary file

  PNM_SAVE_RAW                  = 0

Saves the bitmap as a binary file

  PNM_SAVE_ASCII                = 1

Saves the bitmap as an ASCII file

TIFF:

  TIFF_DEFAULT                  = 0

Save using CCITTFAX4 compression for 1-bit bitmaps and LZW compression for any other bitmaps

  TIFF_CMYK                     = 0x0001

Stores tags for separated CMYK (use | to combine with TIFF compression flags)

  TIFF_PACKBITS                 = 0x0100

Save using PACKBITS compression.

  TIFF_DEFLATE                  = 0x0200

Save using DEFLATE compression (also known as ZLIB compression)

  TIFF_ADOBE_DEFLATE            = 0x0400

Save using ADOBE DEFLATE compression

  TIFF_NONE                     = 0x0800

Save without any compression

  TIFF_CCITTFAX3                = 0x1000

Save using CCITT Group 3 fax encoding

  TIFF_CCITTFAX4                = 0x2000

Save using CCITT Group 4 fax encoding

  TIFF_LZW                      = 0x4000

Save using LZW compression

See also "Image", "MetaEnd" and "EBbl".

Inject

  $dc->Inject($point, $page, $data);

The Inject method adds $data to a specific $point in specified $page.

Where $point specifies where to inject the raw data in the PostScript output. This member can be one of the following values. $page specifies the page number (starting from 1) to which the injection data is applied. Specify zero to apply the injection data to all pages. This member is meaningful only for page level injection points starting from PSI_PAGENUMBER. For other injection points, set PageNumber to zero.

The injection data for a specified injection point is cumulative. In other words, Inject method adds the new injection data to any injection data previously specified for the same injection point.

If the job is in EMF data type, you must provide all injection data before Start.

If the job is in RAW data type, you must provide the following injection data before the driver needs it:

1) Data for header sections (before first %%Page:) before calling the first Page method.

2) Data for page setup sections (when injecting data for one particular page) before calling the Page method for that particular page.

3) Data for page setup sections (when injecting data for all pages starting from a certain page) before calling Page for the starting page.

4) Data for page trailer sections before calling the next Page method.

5) Data for document trailer sections before calling the Close method.

The injection points are:

  PSI_BEGINSTREAM               = 1

Before the first byte of job stream.

  PSI_PSADOBE                   = 2

Before %!PS-Adobe.

  PSI_PAGESATEND                = 3

Replaces driver's %%Pages (atend).

  PSI_PAGES                     = 4

Replaces driver's %%Pages nnn.

  PSI_DOCNEEDEDRES              = 5

After %%DocumentNeededResources.

  PSI_DOCSUPPLIEDRES            = 6

After %%DocumentSuppliedResources.

  PSI_PAGEORDER                 = 7

Replaces driver's %%PageOrder.

  PSI_ORIENTATION               = 8

Replaces driver's %%Orientation.

  PSI_BOUNDINGBOX               = 9

Replaces driver's %%BoundingBox.

  PSI_PROCESSCOLORS             = 10

Replaces driver's %DocumentProcessColors <color>.

  PSI_COMMENTS                  = 11

Before %%EndComments.

  PSI_BEGINDEFAULTS             = 12

After %%BeginDefaults.

  PSI_ENDDEFAULTS               = 13

Before %%EndDefaults.

  PSI_BEGINPROLOG               = 14

After %%BeginProlog.

  PSI_ENDPROLOG                 = 15

Before %%EndProlog.

  PSI_BEGINSETUP                = 16

After %%BeginSetup.

  PSI_ENDSETUP                  = 17

Before %%EndSetup.

  PSI_TRAILER                   = 18

After %%Trailer.

  PSI_EOF                       = 19

After %%EOF.

  PSI_ENDSTREAM                 = 20

After the last byte of job stream.

  PSI_PROCESSCOLORSATEND        = 21

Replaces driver's %%DocumentProcessColors (atend).

Page level injection points

  PSI_PAGENUMBER                = 100

Replaces driver's %%Page.

  PSI_BEGINPAGESETUP            = 101

After %%BeginPageSetup.

  PSI_ENDPAGESETUP              = 102

Before %%EndPageSetup.

  PSI_PAGETRAILER               = 103

After %%PageTrailer.

  PSI_PLATECOLOR                = 104

Replace driver's %%PlateColor: <color>.

  PSI_SHOWPAGE                  = 105

Before showpage operator.

  PSI_PAGEBBOX                  = 106

Replaces driver's %%PageBoundingBox.

  PSI_ENDPAGECOMMENTS           = 107

Before %%EndPageComments.

  PSI_VMSAVE                    = 200

Before save operator.

  PSI_VMRESTORE                 = 201

After restore operator.

See also "Start", "Page" and "Close".

Line

  $dc->Line(@endpoints);

The Line method draws a series of line segments by connecting the points in the specified array. The current point is not updated.

See also "LineTo".

LineTo

  $dc->LineTo(@endpoints);

The LineTo method draws a series of line segments by connecting the points in the specified array. The current point is updated.

See also "Line".

Meta

  $filename2 = $dc->Meta([$filename1], [$width, $height]);

The Meta method opens an EMF bracket. This means that everything until "MetaEnd" will be drawn in to the EMF file. Device context is based on current Printer object device context, but only default objects and their default values are selected into it.

$filename2 - name of the EMF file to create (if omited or empty - creates only memory EMF file). $width, $height - width and height of the EMF file.

Function returns possibly changed filename.

Use "FILE:" or "FILE:C:/suggest.emf" as a file name to invoke 'Save as' dialog.

Function will not overwrite existing files but will change names like "file", except if set by dialog (this is different from "file").

You may not use nested brackets!

See also "MetaEnd".

MetaEnd

  $image_handle = $dc->MetaEnd();
  ($image_handle, $width, $height) = $dc->MetaEnd();

The MetaEnd method closes an EMF bracket and returns handle to a creted EMF image and also $width, $height in array context. After usage, you should use "Close" to unload image from memory and destroy a handle.

See also "Meta", "Image" and "Close".

Move

  ($old_x, $old_y) = $dc->Move($x, $y);

The Move method updates the current position to the specified point.

See also "ArcTo", "LineTo" and "BezierTo".

Next

  $dc->Next([$description]);

The Next method ends and starts new print job. Equivalent for:

  $dc->End();
  $dc->Start([$description]);

Default description - "Printer". Method returns possibly changed file name if "file" attribute is set.

Inside "Meta" brackets:

  ($image_handle ,$filename2) = $dc->Next(([$filename1], [$width, $height]);

In this context - closes previous and opens new "Meta" brackets. If arguments omited - uses arguments from previous brackets.

See also "Start", "End", "Abort", "Page", "Meta" and "MetaEnd".

Page

  $dc->Page();

The Page method starts new page.

Not allowed in "Meta" brackets!

See also "Start", "Next" and "End".

PAbort

  $dc->PAbort();

The PAbort method closes and discards any paths.

PBegin

  $dc->PBegin();

The PBegin method opens a path bracket.

See also "PClip", "PDraw", "PEnd" and "PAbort".

PClip

  $dc->PClip($mode);

The PClip method selects the current path as a clipping region, combining the new region with any existing clipping region by using the specified mode.

Where $mode is one of the following:

  CR_OFF                        = 0

Remove clipping region.

  CR_AND                        = 1

The new clipping region includes the intersection (overlapping areas) of the current clipping region and the current path.

  CR_OR                         = 2

The new clipping region includes the union (combined areas) of the current clipping region and the current path.

  CR_XOR                        = 3

The new clipping region includes the union of the current clipping region and the current path but without the overlapping areas.

  CR_DIFF                       = 4

The new clipping region includes the areas of the current clipping region with those of the current path excluded.

  CR_COPY                       = 5

The new clipping region is the current path.

See also "PBegin", "PDraw", "PEnd" and "PAbort".

PDraw

  $dc->PDraw();

The PDraw method closes any open figures in a path, strokes the outline of the path by using the current pen, and fills its interior by using the current brush and fill mode.

See also "PBegin", "PClip", "PEnd", "PAbort" and "Fill".

PEnd

  $dc->PEnd();

The PEnd method closes a path bracket and selects the path defined by the bracket.

See also "PBegin", "PClip", "PDraw" and "PAbort".

Pen

  $handle = $dc->Pen([$width, $r, $g, $b, [$style]]);
  ($handle, $previous_handle) = $dc->Pen([$width, $r, $g, $b, [$style]]);
  $previous_handle = $dc->Pen($handle);

The Pen method creates a logical pen that has the specified style, width, and color. The pen can subsequently be used to draw lines and curves. Pen width is set in pts regardless of "unit*" attribute in "new" constructor or whatever is set by "Unit" method. Using dashed or dotted styles will set the pen width to 1 px! If no parameters specified, creates transparent pen.

You may use the following pen styles:

  PS_DASH                       = 0x00000001

Pen is dashed.

  PS_DOT                        = 0x00000002

Pen is dotted.

  PS_DASHDOT                    = 0x00000003

Pen has alternating dashes and dots.

  PS_DASHDOTDOT                 = 0x00000004

Pen has alternating dashes and double dots.

  PS_NULL                       = 0x00000005

Pen is invisible.

  PS_INSIDEFRAME                = 0x00000006

Pen is solid. When this pen is used in drawing method that takes a bounding rectangle, the dimensions of the figure are shrunk so that it fits entirely in the bounding rectangle, taking into account the width of the pen.

  PS_SOLID                      = 0x00010000

Pen is solid (default).

  PS_JOIN_ROUND                 = 0x00010000

Joins are round (default).

  PS_ENDCAP_ROUND               = 0x00010000

End caps are round (default).

  PS_ENDCAP_SQUARE              = 0x00010100

End caps are square.

  PS_ENDCAP_FLAT                = 0x00010200

End caps are flat.

  PS_JOIN_BEVEL                 = 0x00011000

Joins are beveled.

  PS_JOIN_MITER                 = 0x00012000

Joins are mitered.

See also "Brush".

Pie

  $dc->Pie($x, $y, $width, $height, $start_angle, $end_angle2);

The Pie method draws a pie-shaped wedge bounded by the intersection of an ellipse and two radials. The pie is outlined by using the current pen and filled by using the current brush. $x, $y sets the upper-left corner coordinates of bounding rectangle. $width, $height sets the width and height of bounding rectangle. $start_angle, $end_angle2 sets the starting and ending angle of the pie according to the center of bounding rectangle.

See also "Ellipse", "Chord", "Arc" and "ArcTo".

Poly

  $dc->Poly(@vertices);

The Poly method draws a polygon consisting of two or more vertices connected by straight lines. The polygon is outlined by using the current pen and filled by using the current brush and polygon fill mode.

See also "Rect" and "Fill".

Rect

  $dc->Rect($x, $y, $width, $height, [$ellipse_width, $ellipse_height]);

The Rect method draws a rectangle or rounded rectangle. The rectangle is outlined by using the current pen and filled by using the current brush. $x, $y sets the upper-left corner coordinates of rectangle. $width, $height sets the width and height of rectangle. Optional parameters $ellipse_width, $ellipse_height sets the width and height of ellipse used to draw rounded corners.

See also "Poly".

Space

  $dc->Space($eM11, $eM12, $eM21, $eM22, $eDx, $eDy);

The Space method sets a two-dimensional linear transformation between world space and page space. This transformation can be used to scale, rotate, shear, or translate graphics output. Transformation on the next page is reset to default. Default page origin is upper-left corner, x from left to right and y from top to bottom.

  0
  ------- x
  |
  |
  | y

For any coordinates (x, y) in world space, the transformed coordinates in page space (x', y') can be determined by the following algorithm:

  x' = x * eM11 + y * eM21 + eDx, 
  y' = x * eM12 + y * eM22 + eDy, 

where the transformation matrix is represented by the following:

  | eM11 eM12 0 |
  | eM21 eM22 0 |
  | eDx  eDy  1 |

Start

  $dc->Start([$description]);

The Start method starts a print job. Default description - "Printer".

NOTE! Print job is automatically aborted if print job is not ended by "End" or "Close" methods or if an error occurs!

Not allowed in "Meta" brackets!

See also "Next", "End", "Abort" and "Page".

Unit

  $dc->Unit([$unit]);

The Unit method sets or gets current unit ratio.

Specified unit is used for all coordinates and sizes, except for font sizes and pen widths.

You may use strings:

  'in' - inches
  'mm' - millimeters
  'cm' - centimeters
  'pt' - points (in / 72)

Or unit ratio according to:

  ratio = in / unit

  Example: 2.5409836 cm = 1 in

Set units to 0 to use device units.

See also "unit*".

Write

  # String mode (SM):
  $height = $dc->Write($text, $x, $y, [$format, [$just_width]]);
  ($width, $height) = $dc->Write($text, $x, $y, [$format, [$just_width]]);

  # Draw mode (DM):
  $height = $dc->Write($text, $x, $y, $width, $height, [$format, [$tab_stop]]);
  ($width, $height, $length, $text) = $dc->Write($text, $x, $y, $width, $height, [$format, [$tab_stop]]);

SM: The Write method string mode writes a character string at the specified location, using the currently selected font, text color and alignment.

DM: The Write method draw mode draws formatted text in the specified rectangle. In array context method returns array containing ($width, $height, $length, $text). $height is returned in scalar context. $length receives the number of characters processed by Write, including white-space characters. See CALCRECT and MODIFYSTRING flags. Optional $tab_stop parameter specifies the number of average character widths per tab stop.

Warning! - $widt must be less than 0x80000000 units.

Optional text format flags:

  UTF8                          = 0x20000000 (SM & DM)

Treat $text as UTF-8 encoded string. Note that selected font must support desired unicode characters. Available for NT platforms and also supported by Microsoft Layer for Unicode.

  NOUPDATECP                    = 0x00000000 (SM)

The current position is not updated after each text output call. The reference point is passed to the text output method.

  TOP                           = 0x00000000 (SM & DM)

SM: The reference point will be on the top edge of the bounding rectangle.

DM: Top justifies text. This value must be combined with SINGLELINE.

  LEFT                          = 0x00000000 (SM & DM)

SL: The reference point will be on the left edge of the bounding rectangle.

ML: Aligns text to the left.

  UPDATECP                      = 0x00000001 (SM)

The current position is updated after each text output call. The current position is used as the reference point.

  RIGHT                         = 0x00000002 (SM & DM)

SL: The reference point will be on the right edge of the bounding rectangle.

ML: Aligns text to the right.

  VCENTER                       = 0x00000004 (DM)

Centers text vertically (single line only).

  BOTTOM                        = 0x00000008 (SM & DM)

SL: The reference point will be on the bottom edge of the bounding rectangle.

ML: Justifies the text to the bottom of the rectangle. This value must be combined with SINGLELINE.

  WORDBREAK                     = 0x00000010 (DM)

Breaks words. Lines are automatically broken between words if a word extends past the edge of the specified rectangle. A carriage return-linefeed sequence also breaks the line.

  BASELINE                      = 0x00000018 (SM)

The reference point will be on the base line of the text.

  SINGLELINE                    = 0x00000020 (DM)

Displays text on a single line only. Carriage returns and linefeeds do not break the line.

  EXPANDTABS                    = 0x00000040 (DM)

Expands tab characters. Number of characters per tab is eight.

  NOCLIP                        = 0x00000100 (DM)

Draws without clipping. Write is somewhat faster when NOCLIP is used.

  EXTERNALLEADING               = 0x00000200 (DM)

Includes the font external leading in line height. Normally, external leading is not included in the height of a line of text.

  CALCRECT                      = 0x00000400 (DM)

Determines the $width and $height of the rectangle. If there are multiple lines of text, Write uses the width of the given rectangle and extends the base of the rectangle to bound the last line of text. If there is only one line of text, Write modifies the width of the rectangle so that it bounds the last character in the line. In either case, Write returns the height of the formatted text, but does not draw the text.

  INTERNAL                      = 0x00001000 (DM)

Uses the system font to calculate text metrics.

  EDITCONTROL                   = 0x00002000 (DM)

Duplicates the text-displaying characteristics of a multiline edit control. Specifically, the average character width is calculated in the same manner as for an edit control, and the method does not display a partially visible last line.

  PATH_ELLIPSIS                 = 0x00004000 (DM)
  END_ELLIPSIS                  = 0x00008000 (DM)

Replaces part of the given string with ellipses, if necessary, so that the result fits in the specified rectangle. The $text element of returning array is not modified unless the MODIFYSTRING flag is specified.

You can specify END_ELLIPSIS to replace characters at the end of the string, or PATH_ELLIPSIS to replace characters in the middle of the string. If the string contains backslash (\) characters, PATH_ELLIPSIS preserves as much as possible of the text after the last backslash.

  MODIFYSTRING                  = 0x00010000 (DM)

Modifies the $text element of returning array to match the displayed text. This flag has no effect unless the END_ELLIPSIS, PATH_ELLIPSIS or WORD_ELLIPSIS flag is specified.

  RTLREADING                    = 0x00020000 (SM & DM)

Layout in right to left reading order for bi-directional text when the selected font is a Hebrew or Arabic font. The default reading order for all text is left to right.

  WORD_ELLIPSIS                 = 0x00040000 (DM)

Truncates text that does not fit in the rectangle and adds ellipses.

  CENTER                        = 0x00080000 (SM & DM)

SL: The reference point will be aligned horizontally with the center of the bounding rectangle.

ML: Centers text horizontally in the rectangle.

  JUSTIFY                       = 0x80000000 (SM)

Extends space characters to match given justification width ($just_width).

Note: Allways use $just_width parameter with JUSTIFY flag!

See also "Font", "Fit", "Color", "FontSpace" and "Write2".

Write2

  $height = $dc->Write2($text, $x, $y, $w, [$flags, [$indento, [$hspace, [$vspace]]]]);
  ($width, $height, $proctext) = $dc->Write2($text, $x, $y, $w, [$flags, [$indent, [$hspace, [$vspace]]]]);

The Write2 method adds multiline justification, custom vertical and horisontal spacing and left indent; Returns $height in scalar context and $width, $height, $proctext where $proctext is possibly modified text (e.g. added line breaks).

Reasonable only when justification, left indent, custom vertical and/or horizontal spacing is needed, othervise consider to use regular "Write" method.

  LEFT                          = 0x00000000

Aligns text to the left.

  RIGHT                         = 0x00000002

Aligns text to the right.

  CENTER                        = 0x00080000

Centers text horizontally in the rectangle.

  JUSTIFY                       = 0x80000000 

Extends space characters to match given width.

  UTF8                          = 0x20000000

Treat $text as UTF-8 encoded string. Note that selected font must support desired unicode characters. Available for NT platforms and also supported by Microsoft Layer for Unicode.

See also "Write", "Fit" and "FontSpace".

SEE ALSO ^

Win32::Printer::Enum, Win32::Printer::Direct, Win32 Platform SDK GDI documentation.

AUTHOR ^

Edgars Binans

COPYRIGHT AND LICENSE ^

This library may use FreeImage, a free, open source image library supporting all common bitmap formats. Get your free copy from http://sourceforge.net. FreeImage is licensed under the terms of GNU GPL.

This library may use Ghostscript for PDF support. GNU Ghostscript is licensed under terms of GNU GPL. AFPL Ghostscript is licensed under the terms of Aladdin Free Public License. Download Ghostscript from http://sourceforge.net.

Win32::Printer, Copyright (C) 2003-2005 Edgars Binans.

THIS LIBRARY IS LICENSED UNDER THE TERMS OF GNU LESSER GENERAL PUBLIC LICENSE V2.1

syntax highlighting: