<?xml version="1.0" encoding="utf-8" ?> <ApoPantou creator="www.incahellas.com"> <Printer>Epson 480-J</Printer> <page> <DrawString x="1" y="1">Hello world</DrawString> </page> </ApoPantou>
All languages need save data in UTF-8. This is about the same as plain ascii, if you are writing in English only.
Program is released under the MIT license, which means you can use it for free for either personal or commercial use. Copyright is held by INCA Hellas Ltd.
HKLM\Software\INCA Hellas\ApoPantou\CommonDir
HKLM\Software\INCA Hellas\ApoPantou\Timer
HKLM\Software\INCA Hellas\ApoPantou\MaxPendingJobs
string cPRINTJOB::version()
cPRINTJOB()
Object constructor.
XML:$pj = new cPRINTJOB(); if ($pj->err!==false) { echo "cPRINTJOB error: ".htmlentities($pj->err); return; }
<?xml version="1.0" encoding="utf-8" ?> <ApoPantou creator="www.incahellas.com"> ... ... ... </ApoPantou>
bool set_printer($printer_name, $ar1=false)
Name | Value type | Meaning |
---|---|---|
color | bool | Print in color if true. |
unit_mm | bool | Measurement units are in millimeter if true, otherwise in inches. Default is inches. |
landscape | bool | Print in landscape if true. |
filename | string |
Output filename, if specified. This allows you i.e. to
create an XPS file using Microsoft XPS Document
Writer. Attention if you are thinking to create a PDF file using a free PDF printer driver: most of free PDF printer drivers, when used with the filename option, do actually create a Postscript file, not a PDF one. |
filetype | string |
If filename is defined but left empty, filetype is
used to create a random filename in %CommonDatapath%/INCA Hellas/ApoPantouOut |
papersize | string | You must know which sizes your printer supports and set one of them, i.e. A4. |
paperheight | int | Units of 1/100 of inch, for custom paper size. |
paperwidth | int | Units of 1/100 of inch, for custom paper size. |
margins | comma separated list of 4 integers | Left, Top & Right, Bottom points in 1/100 of inch |
$pj = new cPRINTJOB(); if ($pj->err!==false) { echo "cPRINTJOB error: ".htmlentities($pj->err); return; } $pj->set_printer('Epson 760', array('color'=>true, 'landscape'=>false, 'papersize'=>'A4' ) );
<?xml version="1.0" encoding="utf-8" ?> <ApoPantou creator="www.incahellas.com"> <Printer color="1" landscape="0" papersize="A4" >Epson 760</Printer> ... ... ... </ApoPantou>
$fontRC create_font($fontname, $sz, $attr=false)
Font resource.
XML:$pj = new cPRINTJOB(); if ($pj->err!==false) { echo "cPRINTJOB error: ".htmlentities($pj->err); return; } $pj->set_printer('Epson 760', array('color'=>true, 'landscape'=>false, 'papersize'=>'A4' ) ); $f_id=$pj->create_font('Arial', 10, 'bold');
<?xml version="1.0" encoding="utf-8" ?> <ApoPantou creator="www.incahellas.com"> <Printer color="1" landscape="0" papersize="A4" >Epson 760</Printer> <Font id="1" size="10" style="bold">Arial</Font> ... ... ... </ApoPantou>
$penRC create_pen($color, $sz)
Pen resource.
XML:$pj = new cPRINTJOB(); if ($pj->err!==false) { echo "cPRINTJOB error: ".htmlentities($pj->err); return; } $pj->set_printer('Epson 760', array('color'=>true, 'landscape'=>false, 'papersize'=>'A4' ) ); $p_id=$pj->create_pen('ff000000', 0.01); // create black pen of 0.01 inches width
<?xml version="1.0" encoding="utf-8" ?> <ApoPantou creator="www.incahellas.com"> <Printer color="1" landscape="0" papersize="A4" >Epson 760</Printer> <Pen id="1" size="0.01">ff000000</Pen> ... ... ... </ApoPantou>
$brushRC create_brush($type='solid', $color)
$brushRC create_brush($type='texture', $image, $wrapmode=false)
$brushRC create_brush($type='gradient', $color1, $color2, $spec)
Brush resource.
XML:$pj = new cPRINTJOB(); if ($pj->err!==false) { echo "cPRINTJOB error: ".htmlentities($pj->err); return; } $pj->set_printer('Epson 760', array('color'=>true, 'landscape'=>false, 'papersize'=>'A4' ) ); $b_id=$pj->create_brush('solid', 'ffff0000' ); // create solid red brush
<?xml version="1.0" encoding="utf-8" ?> <ApoPantou creator="www.incahellas.com"> <Printer color="1" landscape="0" papersize="A4" >Epson 760</Printer> <Brush id="1" color="ffff0000">solid</Brush> ... ... ... </ApoPantou>
bool draw_string($str, $fontRC, $brushRC, $x, $y)
$pj = new cPRINTJOB(); if ($pj->err!==false) { echo "cPRINTJOB error: ".htmlentities($pj->err); return; } $pj->set_printer('Epson 760', array('color'=>true, 'landscape'=>false, 'papersize'=>'A4' ) ); $f_id=$pj->create_font('Arial', 12, 'bold' ); $b_id=$pj->create_brush('solid', 'ffff0000'); // red brush $pj->draw_string('Hello world', null, null, 1, 1); // print in default (Arial,10) $pj->draw_string('Hello world', $f_id, $b_id, 1, 1.5); // print with Arial,12,bold,red $pj->draw_string('One line\r\nAnother line', null, null, 1, 2); // print 2 lines at once
<?xml version="1.0" encoding="utf-8" ?> <ApoPantou creator="www.incahellas.com"> <Printer color="1" landscape="0" papersize="A4" >Epson 760</Printer> <Font id="1" size="12" style="bold">Arial</Font> <Brush id="1" color="ffff0000">solid</Brush> <Page> <DrawString x="1" y="1">Hello world</DrawString> <DrawString font="1" brush="1" x="1" y="1.5">Hello world</DrawString> <DrawString x="1" y="2">One line Another line</DrawString> </Page> </ApoPantou>
bool draw_next($s1, $fontRC=false, $brushRC=false, $dx=0, $dy=0)
$pj = new cPRINTJOB(); if ($pj->err!==false) { echo "cPRINTJOB error: ".htmlentities($pj->err); return; } $pj->set_printer('Epson 760', array('color'=>true, 'landscape'=>false, 'papersize'=>'A4' ) ); $b_id=$pj->create_brush('solid', 'ffff0000'); // red brush $pj->draw_string('Hello ', null, null, 1, 1); // print in default (Arial,10) $pj->draw_next('world', null, $b_id, 1, 1.5); // print next in red
<?xml version="1.0" encoding="utf-8" ?> <ApoPantou creator="www.incahellas.com"> <Printer color="1" landscape="0" papersize="A4" >Epson 760</Printer> <Brush id="1" color="ffff0000">solid</Brush> <Page> <DrawString x="1" y="1">Hello </DrawString> <DrawNext brush="1">world</DrawNext> </Page> </ApoPantou>
bool draw_rectangle($penRC, $x, $y, $width, $height)
$pj = new cPRINTJOB(); if ($pj->err!==false) { echo "cPRINTJOB error: ".htmlentities($pj->err); return; } $pj->set_printer('Epson 760', array('color'=>true, 'landscape'=>false, 'papersize'=>'A4' ) ); $p_id=$pj->create_pen('ff000000', 0.01); // create black pen of 0.01 inches width $pj->draw_rectangle($p_id, 1, 1, 5, 3); // draw rectangle 5 inches in width, 3 in height
<?xml version="1.0" encoding="utf-8" ?> <ApoPantou creator="www.incahellas.com"> <Printer color="1" landscape="0" papersize="A4" >Epson 760</Printer> <Pen id="1" size="0.01">ff000000</Pen> <Page> <DrawRectangle pen="1">1,1,5,3</DrawRectangle> </Page> </ApoPantou>
bool draw_lines($penRC, $points)
$pj = new cPRINTJOB(); if ($pj->err!==false) { echo "cPRINTJOB error: ".htmlentities($pj->err); return; } $pj->set_printer('Epson 760', array('color'=>true, 'landscape'=>false, 'papersize'=>'A4' ) ); $p_id=$pj->create_pen('ff000000', 0.01); // create black pen of 0.01 inches width $pj->draw_lines($p_id, array(1,0.9, 7,0.9, 1,9, 7,9) ); // draw a Z
<?xml version="1.0" encoding="utf-8" ?> <ApoPantou creator="www.incahellas.com"> <Printer color="1" landscape="0" papersize="A4" >Epson 760</Printer> <Pen id="1" size="0.01">ff000000</Pen> <Page> <DrawLines pen="1">1,0.9, 7,0.9, 1,9, 7,9</DrawLines> </Page> </ApoPantou>
bool draw_image($image, $up_left_x, $up_left_y, $up_right_x, $up_right_y, $lo_left_x, $lo_left_y)
Print an image file into parallelogram defined area.
Parameters:$pj = new cPRINTJOB(); if ($pj->err!==false) { echo "cPRINTJOB error: ".htmlentities($pj->err); return; } $pj->set_printer('Epson 760', array('color'=>true, 'landscape'=>false, 'papersize'=>'A4' ) ); $img="C:\\Users\\Bill\\Pictures\\sony ericsson\\DSC00013.JPG"; // draw image 8-1=7 inches in width, 8.25-3=5.25 inches in height: $pj->draw_image($img, 1, 3, 8, 3, 1, 8.25); // draw the same image with 45 degrees rotation $pj->draw_image($img, 1, 4.5, 4.5, 1, 3.62, 7.12);
<?xml version="1.0" encoding="utf-8" ?> <ApoPantou creator="www.incahellas.com"> <Printer color="1" landscape="0" papersize="A4" >Epson 760</Printer> <Page> <!-- draw image 8-1=7 inches in width, 8.25-3=5.25 inches in height --> <DrawImage image="C:\Users\Bill\Pictures\sony ericsson\DSC00013.JPG">1, 3, 8, 3, 1, 8.25</DrawImage> <!-- draw the same image with 45 degrees rotation --> <DrawImage image="C:\Users\Bill\Pictures\sony ericsson\DSC00013.JPG">1, 4.5, 4.5, 1, 3.62, 7.12</DrawImage> </Page> </ApoPantou>
bool new_page()
$pj = new cPRINTJOB(); if ($pj->err!==false) { echo "cPRINTJOB error: ".htmlentities($pj->err); return; } $pj->set_printer('Epson 760', array('color'=>true, 'landscape'=>false, 'papersize'=>'A4' ) ); $pj->draw_string('Hello', null, null, 1, 1); // print in 1st page $pj->new_page(); $pj->draw_string('world', null, null, 1, 1); // print in 2nd page
<?xml version="1.0" encoding="utf-8" ?> <ApoPantou creator="www.incahellas.com"> <Printer color="1" landscape="0" papersize="A4" >Epson 760</Printer> <Page> <!-- print in 1st page --> <DrawString x="1" y="1">Hello</DrawString> </Page> <Page> <!-- print in 2nd page --> <DrawString x="1" y="1">world</DrawString> </Page> </ApoPantou>
bool finalize()
Finalize printing. Optional: it will be called anyway upon
object destruction.
However, by calling the function you have the option to get
printing (job submission) result.
$pj = new cPRINTJOB(); if ($pj->err!==false) { echo "cPRINTJOB error: ".htmlentities($pj->err); return; } ... ... ... if (!$pj->finalize()) { echo "cPRINTJOB error: ".htmlentities($pj->err); }
No XML counterpart.
Printing will take place after object destruction, i.e.
script termination, or when you call optional function
finalize(). Actually, the php script will just initiate the
printing procedure and quit. It is the ApoPantou Windows
service, that will do the printout.
This allows for the php script, or other language you choose, to
disengage very quickly from the printout completion, even for
very big printouts.