include "../class/pImage.class.php";
/* Create the pChart object */
$myPicture = new pImage(700, 230);
/* Draw the background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
/* Overlay with a gradient */
$Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, $Settings);
$myPicture->drawGradientArea(0, 0, 700, 20, DIRECTION_VERTICAL, array("StartR" => 0, "StartG" => 0, "StartB" => 0, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 80));
/* Draw the picture border */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Write the title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Silkscreen.ttf", "FontSize" => 6));
$myPicture->drawText(10, 13, "Barcode 39 - Add barcode to your pictures", array("R" => 255, "G" => 255, "B" => 255));
/* Create the barcode 39 object */
$Barcode = new pBarcode39("../");
/* Draw a simple barcode */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
$Settings = array("ShowLegend" => TRUE, "DrawArea" => TRUE);
$Barcode->draw($myPicture, "pChart Rocks!", 50, 50, $Settings);
/* Draw a rotated barcode */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 12));
$Settings = array("ShowLegend" => TRUE, "DrawArea" => TRUE, "Angle" => 90);
$Barcode->draw($myPicture, "Turn me on", 650, 50, $Settings);
/* Draw a rotated barcode */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 12));
$Settings = array("R" => 255, "G" => 255, "B" => 255, "AreaR" => 150, "AreaG" => 30, "AreaB" => 27, "ShowLegend" => TRUE, "DrawArea" => TRUE, "Angle" => 350, "AreaBorderR" => 70, "AreaBorderG" => 20, "AreaBorderB" => 20);
$Barcode->draw($myPicture, "Do what you want !", 290, 140, $Settings);
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.barcode39.png");
<?php

/* CAT:Barcode */
/* pChart library inclusions */
include "../class/pDraw.class.php";
include "../class/pBarcode39.class.php";
include "../class/pImage.class.php";
/* Create the barcode 39 object */
$Barcode = new pBarcode39("../");
/* String to be written on the barcode */
$String = "This is a test";
/* Retrieve the barcode projected size */
$Settings = array("ShowLegend" => TRUE, "DrawArea" => TRUE);
$Size = $Barcode->getSize($String, $Settings);
/* Create the pChart object */
$myPicture = new pImage($Size["Width"], $Size["Height"]);
/* Set the font to use */
$myPicture->setFontProperties(array("FontName" => "../fonts/GeosansLight.ttf"));
/* Render the barcode */
$Barcode->draw($myPicture, $String, 10, 10, $Settings);
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.singlebarcode39.png");
Beispiel #3
0
$myPicture->drawText(330, 166, "SENDER CODE", $Settings);
$myPicture->drawText(410, 220, "MFG DATE", $Settings);
$myPicture->drawText(410, 260, "NET WEIGTH", $Settings);
/* Filling the fields values */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 16));
$myPicture->drawText(70, 20, "BEBEER INC\r\n342, MAIN STREET\r\n33000 BORDEAUX\r\nFRANCE", $Settings);
$myPicture->drawText(250, 20, "MUSTAFA'S BAR\r\n18, CAPITOL STREET\r\n31000 TOULOUSE\r\nFRANCE", $Settings);
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 35));
$myPicture->drawText(100, 120, "2342355552340", $Settings);
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 20));
$Settings = array("R" => 0, "G" => 0, "B" => 0, "Align" => TEXT_ALIGN_TOPRIGHT);
$myPicture->drawText(210, 180, "75 CANS", $Settings);
$myPicture->drawText(310, 180, "TLSE", $Settings);
$myPicture->drawText(580, 180, "WAREHOUSE#SLOT#B15", $Settings);
$Settings = array("R" => 0, "G" => 0, "B" => 0, "Align" => TEXT_ALIGN_TOPLEFT);
$myPicture->drawText(410, 236, "06/06/2010", $Settings);
$myPicture->drawText(410, 276, "12.340 Kg", $Settings);
/* Create the barcode 39 object */
$Barcode39 = new pBarcode39("../");
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
$Settings = array("ShowLegend" => TRUE, "Height" => 55, "DrawArea" => TRUE, "DrawArea" => FALSE);
$Barcode39->draw($myPicture, "12250000234502", 30, 220, $Settings);
$Settings = array("ShowLegend" => TRUE, "Height" => 14, "DrawArea" => TRUE, "DrawArea" => FALSE);
$Barcode39->draw($myPicture, "75 cans", 260, 220, $Settings);
$Barcode39->draw($myPicture, "06062010", 260, 260, $Settings);
/* Create the barcode 128 object */
$Barcode128 = new pBarcode128("../");
$Settings = array("ShowLegend" => TRUE, "Height" => 65, "DrawArea" => TRUE, "DrawArea" => FALSE);
$Barcode128->draw($myPicture, "TLSE", 450, 25, $Settings);
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.barcode.png");