Index of /php/pmPDF
Name Last modified Size Description
Parent Directory 15-Aug-2007 11:23 -
Changes 15-Aug-2007 10:40 4k
pmPDF-0.1.tar.gz 03-Feb-2007 17:11 4k
pmPDF-0.2.tar.gz 16-Feb-2007 11:12 6k
pmPDF-0.3.tar.gz 19-Apr-2007 12:22 16k
pmPDF-0.3_01.tar.gz 18-Apr-2007 12:02 7k
pmPDF-0.4.tar.gz 05-Jun-2007 10:51 5k
pmPDF-0.5.tar.gz 15-Aug-2007 10:40 33k
NAME
pmPDF - Simple PHP class to create 'pocketmod' style booklets
SYNOPSIS
include_once("pmPDF.php");
$pdf = new pmPDF();
$pdf->SetFont("Helvetica");
$pdf->SetFontSize(8);
$pdf->add_text("...");
$pdf->Output();
DESCRIPTION
Simple PHP class to create 'pocketmod' style booklets.
At the moment, the *only* thing it will do is take an arbitrary amount
of unformatted text (excepting newlines) and render on to multiple
sheets of US letter sized paper to create a nice little "pocketmod"
booklet.
The package will take care of all the bring pagination stuff if your
text span more than one sheet (or 8 pocketmod "pages").
PACKAGE METHODS
pmPDF($args=array())
Valid arguments are :
* folds
Boolean.
Draw the crease marks for folding individual sheets of paper.
Default is false.
* borders
Boolean.
Draw the borders surrounding individual (pocketmod) pages. This is
principally for debugging purposes.
Default is false.
* dimensions
Array
The dimensions for each page. Dimensions should be passed in inches.
Default is (8.5, 11)
Returns a pmPDF object
OBJECT METHODS
pmPDF subclasses FPDF so it inherits all its method. In addition it
exposes the following public object methods :
$obj->add_text($txt, $pg='', $args=array())
Add a chunk of text at a given page number.
Valid arguments are :
* txt
String. *required*
The chunk of text to add.
* pg
Int.
If not defined the text will be added to the current page number, or
page 1.
* $args
Hash.
* x Float.
Offset the text by x inches from the beginning of the page (not
the sheet).
* y Float.
Offset the text by y inches from the beginning of the page (not
the sheet).
* h Float.
The maximum number of inches that a chunk of text may occupy, in
height. This may not exceed the height on any single page.
* w Float.
The maximum number of inches that a chunk of text may occupy, in
width. This may not exceed the width of any single page.
* resume
Boolean.
By default, the method will try to resume adding text at x/y
coordinates of the last call to *add_text*.
Default is true.
* nopagination
Boolean.
By default if a chunk of text exceeds it's containing page (or
user-defined contraints) pmPDF will continue writing the
remaining text to subsequent pages. If this value is true, pmPDF
will simply stop when it reaches the end of the page/container.
Default is false.
Returns a hash containing the following keys :
* page
The last page that *$txt* was written to.
* x The last *x* position that *txt* was written to.
* y The last *y* position that *txt* was written to.
* txt
Any remaining text. This should only be non-empty if you passed the
*nopagination* argument.
$obj->add_image($path, $x_position, $y_position)
Valid arguments are :
* $path
String. *required*
The path to the image to include. Image files are automatically
resized relative to their starting x and y coordinates (see below)
and the edge of the page they are being placed on.
If your copy of PHP was compiled with the GD 'imagerotate' function,
images will be rotated according to the page they are being added
to. If not, you will need to ensure that the image is correctly
rotated before passing it to the *add_image* method.
* $x_position
Float.
The starting x position of top left hand corner of the image. x is
relative to the size of the actual page and not the sheet, which may
contain multiple pages.
If not defined, the image will be placed at the top left most x
coordinate of the page.
* $y_position
Float.
The starting y position of top left hand corner of the image. y is
relative to the size of the actual page and not the sheet, which may
contain multiple pages.
If not defined, the image will be placed at the top left most y
coordinate of the page.
$obj->simple_get($url)
A really simple HTTP GET method.
By default it tries to use the cURL library but that is not present it
falls back on PHP's *file_get_contents* function.
Returns a chunk of text, or not.
THINGS THIS LIBRARY DOESN'T SUPPORT (YET)
* Formatted text.
VERSION
0.5
DATE
$Date: 2007/08/14 19:25:47 $
AUTHOR
Aaron Straup Cope <http://www.aaronstraupcope.com/>
CONTRIBUTORS
Theis P. Hansen
REQUIREMENTS
PHP 5 or higher
SEE ALSO
* <http://www.pocketmod.com>
* <http://www.fpdf.org/>
* <http://www.aaronland.info/weblog/2007/01/24/bacon#pocketnet>
* <http://www.aaronland.info/php/mmPDF>
LICENSE
Copyright (c) 2007 Aaron Straup Cope. All Rights Reserved.
This is free software, you may use it and distribute it under the same
terms as Perl itself.