GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
PDF::Create::Page(3) User Contributed Perl Documentation PDF::Create::Page(3)

PDF::Create::Page - PDF pages tree for PDF::Create

Version 1.46

FOR INTERNAL USE ONLY

Adds a page to the PDF document.

Returns page count.

Returns ref to a list of page ids.

Returns page list.

Return new page.

Moves the current point to (x, y), omitting any connecting line segment.

Appends a straight line segment from the current point to (x, y).

Appends a Bezier curve to the path. The curve extends from the current point to (x3 ,y3) using (x1 ,y1) and (x2 ,y2) as the Bezier control points.The new current point is (x3 ,y3).

Adds a rectangle to the current path.

Closes the current subpath by appending a straight line segment from the current point to the starting point of the subpath.

Ends the path without filling or stroking it.

Strokes the path.

Closes and strokes the path.

Fills the path using the non-zero winding number rule.

Fills the path using the even-odd rule.

Draw a line between ($x1, $y1) and ($x2, $y2). Combined moveto / lineto / stroke command.

Set the width of subsequent lines to "w" points.

Sets the color space to DeviceGray and sets the gray tint to use for filling paths.

Sets the color space to DeviceGray and sets the gray tint to use for stroking paths.

Sets the fill colors used for normal text or filled objects.

Set the color of the subsequent drawing operations. Valid r, g, and b values are each between 0.0 and 1.0, inclusive.

Each color ranges from 0.0 to 1.0, i.e., darkest red (0.0) to brightest red(1.0). The same holds for green and blue. These three colors mix additively to produce the colors between black (0.0, 0.0, 0.0) and white (1.0, 1.0, 1.0).

PDF distinguishes between the stroke and fill operations and provides separate color settings for each.

Renders the text. Parameters are explained as below:

    +--------+------------------------------------------------------------------+
    | Key    | Description                                                      |
    +--------+------------------------------------------------------------------+
    | start  | The start marker, add directive BT                               |
    | end    | The end marker, add directive ET                                 |
    | text   | Text to add to the pdf                                           |
    | F      | Font index to be used, add directive /F<font_index>              |
    | Tf     | Font size for the text, add directive <font_size> Tf             |
    | Ts     | Text rise (super/subscript), add directive <mode> Ts             |
    | Tr     | Text rendering mode, add directive <mode> Tr                     |
    | TL     | Text leading, add directive <number> TL                          |
    | Tc     | Character spacing, add directive <number> Tc                     |
    | Tw     | Word spacing, add directive <number> Tw                          |
    | Tz     | Horizontal scaling, add directive <number> Tz                    |
    | Td     | Move to, add directive <x> <y> Td                                |
    | TD     | Move to and set TL, add directive <x> <y> TD                     |
    | rot    | Move to and rotate (<r> <x> <y>), add directive                  |
    |        | <cos(r)>, <sin(r)>, <sin(r)>, <cos(r)>, <x>, <y> Tm              |
    | T*     | Add new line.                                                    |
    +--------+------------------------------------------------------------------+

Add text to the current page using the font object at the given size and position. The point (x, y) is the bottom left corner of the rectangle containing the text.

The optional alignment can be 'r' for right-alignment and 'c' for centered.

Example :

    my $f1 = $pdf->font(
       'Subtype'  => 'Type1',
       'Encoding' => 'WinAnsiEncoding',
       'BaseFont' => 'Helvetica'
    );

    $page->string($f1, 20, 306, 396, "some text");

Draw a line for underlining.The parameters are the same as for the string function but only the line is drawn. To draw an underlined string you must call both,string and string_underline. To change the color of your text use the "setrgbcolor()". It returns the length of the string. So its return value can be used directly for the bounding box of an annotation.

Example :

    $page->string($f1, 20, 306, 396, "some underlined text");

    $page->string_underline($f1, 20, 306, 396, "some underlined text");

Same as "string()".

Same as "string()" but right aligned (alignment 'r').

Same as "string()" but centered (alignment 'c').

Return the size of the text using the given font in default user space units.This does not contain the size of the font yet, to get the length you must multiply by the font size.

Similar to "string()" but parses the string for newline and prints each part on a separate line. Lines spacing is the same as the font-size.Returns the number of lines.

Note the different parameter sequence.The first call should specify all parameters, font is the absolute minimum, a warning will be given for the missing y position and 800 will be assumed. All subsequent invocations can omit all but the string parameters.

ATTENTION:There is no provision for changing pages.If you run out of space on the current page this will draw the string(s) outside the page and it will be invisible.

Add block of text to the page. Parameters are explained as below:

    +------------+--------------------------------------------------------------+
    | Key        | Description                                                  |
    +------------+--------------------------------------------------------------+
    | page       | Object of type PDF::Create::Page                             |
    | font       | Font index to be used.                                       |
    | text       | Text block to be used.                                       |
    | font_size  | Font size for the text.                                      |
    | text_color | Text color as arrayref i.e. [r, g, b]                        |
    | line_width | Line width (in points)                                       |
    | start_y    | First row number (in points) when adding new page.           |
    | end_y      | Last row number (in points) when to add new page.            |
    | x          | x co-ordinate to start the text.                             |
    | y          | y co-ordinate to start the text.                             |
    +------------+--------------------------------------------------------------+

    use strict; use warnings;
    use PDF::Create;

    my $pdf  = PDF::Create->new('filename'=>"$0.pdf", 'Author'=>'MANWAR', 'Title'=>'Create::PDF');
    my $root = $pdf->new_page('MediaBox' => $pdf->get_page_size('A4'));
    my $page = $root->new_page;
    my $font = $pdf->font('BaseFont' => 'Helvetica');

    $page->rectangle(30, 780, 535, 40);
    $page->setrgbcolor(0,1,0);
    $page->fill;

    $page->setrgbcolorstroke(1,0,0);
    $page->line(30, 778, 565, 778);

    $page->setrgbcolor(0,0,1);
    $page->string($font, 15, 102, 792, 'MANWAR - PDF::Create');

    my $text = qq{
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into ele-It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions
    };

    $page->block_text({
        page       => $page,
        font       => $font,
        text       => $text,
        font_size  => 6,
        text_color => [0,0,1],
        line_width => 535,
        start_y    => 780,
        end_y      => 60,
        'x'        => 30,
        'y'        => 770,
    });

    $pdf->close;

Inserts an image. Parameters can be:

    +----------------+----------------------------------------------------------+
    | Key            | Description                                              |
    +----------------+----------------------------------------------------------+
    |                |                                                          |
    | image          | Image id returned by PDF::image (required).              |
    |                |                                                          |
    | xpos, ypos     | Position of image (required).                            |
    |                |                                                          |
    | xalign, yalign | Alignment of image.0 is left/bottom, 1 is centered and 2 |
    |                | is right, top.                                           |
    |                |                                                          |
    | xscale, yscale | Scaling of image. 1.0 is original size.                  |
    |                |                                                          |
    | rotate         | Rotation of image.0 is no rotation,2*pi is 360° rotation.|
    |                |                                                          |
    | xskew, yskew   | Skew of image.                                           |
    |                |                                                          |
    +----------------+----------------------------------------------------------+

Example jpeg image:

    # include a jpeg image with scaling to 20% size
    my $jpg = $pdf->image("image.jpg");

    $page->image(
        'image'  => $jpg,
        'xscale' => 0.2,
        'yscale' => 0.2,
        'xpos'   => 350,
        'ypos'   => 400
    );

Fabien Tassin

GIF and JPEG-support: Michael Gross (info@mdgrosse.net)

Maintenance since 2007: Markus Baertschi (markus@markus.org)

Currently maintained by Mohammad S Anwar (MANWAR) "<mohammad.anwar at yahoo.com>"

<https://github.com/manwar/pdf-create>

Copyright 1999-2001,Fabien Tassin.All rights reserved.It may be used and modified freely, but I do request that this copyright notice remain attached to the file. You may modify this module as you wish,but if you redistribute a modified version, please attach a note listing the modifications you have made.

Copyright 2007 Markus Baertschi

Copyright 2010 Gary Lieberman

This is free software; you can redistribute it and / or modify it under the same terms as Perl 5.6.0.
2019-09-30 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.