Aprint version 1.5
10/03/2008

Description

Aprint is a small class built to print many text directly from Php at server site.

From version 1.4 it has the module that make Postscript files using the PHP extension 'ps'.

Feature:

  • set the page margins
  • define many font parameters like font type, size, underline
  • use different font type for different row
  • automatically start new page when the previous is full
  • simple page numbering
  • may choose which printer to use
  • text alignment, left, center, right (work only with fixed size font)
  • For more information see the Aprint page at www.andrioli.com/en/aprint.html (www.andrioli.com/it/aprint.html italian version).

     

    Installation

    The class require Php 4.3.0 or greater. I had tested this class with that version, but I think it should work also with Php 4.2.x. As version 1.5, the class is tested on PHP 5.2.x system. So far I haven't any notice about the support for 'ps' module on PHP 5.

    Class Aprint Requiremets

    Any Windows box supported by the php_printer extension (see 'Printer function' in the Php manual)

    This class require to add the line extension=php_printer.dll to your php.ini file.

    Class PsPrint Requirements

    In order to create Postscript file you must get the Postscript extensions see 'ps' at PECL repository, and add it to to your php.ini as extension

     

    How it works

    Here a quick example how to use Aprint.

    Create a new istance of the class and initialize it
    $p=new aprint();
    Set the document title
    $p->Title("test_1");
    Write some text using the standard font
    $p->Text("Left text");
    Printout the text
    $p->run();

    That's all!

    Now a more complete example

    $p=new aprint();
    Set the top and left margins. -1 means ignore this parameter
    $p->SetMargin(2880,-1,1200);
    $p->Title("test_1");
    $p->Text("Left text");
    Now write a centered text
    $p->Text("Center text",-1,AP_CENTER);
    Define a new font
    $fnt=$p->CreateFont("Arial");
    Write some text using the new font
    $p->Text("Arial text",$fnt);
    $p->run();

    Predefined settings

    Margins

    Top margin

    400

    Bottom margin

    400

    Left margin

    40

    Right margin

    40

    Normal font

    Font name

    Courier new

    Height

    336

    Width

    168

    Font_weight

    400

    Italic

    no

    Underline

    no

    Strikeout

    no

    Bold font

    Font name

    Courier new

    Height

    336

    Width

    168

    Font_weight

    800

    Italic

    no

    Underline

    no

    Strikeout

    no

    Footer font

    Font name

    Courier new

    Height

    163

    Width

    50

    Font_weight

    200

    Italic

    no

    Underline

    no

    Strikeout

    no

    Change Log

    10/03/2008 ver 1.5

  • Fixed PHP5 E_STRICT warnings
  • 16/02/2005 ver 1.4

  • Added new class to create PostScript file.
  • Built new api documentation
  • 29/02/2004 ver 1.3

  • Added, new functions, TextXY (print the text at the given position), AutoNewPage (you may disable the automatic page skip).
  • Fixed, again some problem about the right alignment.
  • Fixed, don't skip to the new page if pagefooter is not set.
  • 05/12/2003 ver 1.2

  • You may add an header repeated on each page.
  • Fix right alignment.
  • 27/09/2003 ver 1.1

  • Added move function.
  • Added callback, you my call custom function each time the module change the page.
  • 28/05/2003 ver 1.0

    First public release

    Known limit

    The alignment, AP_CENTER, AP_RIGHT work only with fixed size font like Courier New.

    License

    Aprint is licensed under the GNU/LGPL. See license.txt.

    That's all. I hope it be useful.
    Darvin
    (darvin at andrioli dot com)