Esempio n. 1
0
<?php

require 'alphapdf.php';
$pdf = new AlphaPDF();
$pdf->AddPage();
$pdf->SetLineWidth(1.5);
// draw opaque red square
$pdf->SetFillColor(255, 0, 0);
$pdf->Rect(10, 10, 40, 40, 'DF');
// set alpha to semi-transparency
$pdf->SetAlpha(0.5);
// draw green square
$pdf->SetFillColor(0, 255, 0);
$pdf->Rect(20, 20, 40, 40, 'DF');
// draw jpeg image
$pdf->Image('lena.jpg', 30, 30, 40);
// restore full opacity
$pdf->SetAlpha(1);
// print name
$pdf->SetFont('Arial', '', 12);
$pdf->Text(46, 68, 'Lena');
$pdf->Output();
Esempio n. 2
0
include '../scat.php';
include '../lib/item.php';
include '../lib/fpdf/alphapdf.php';
include '../lib/fpdf/ean13.php';
$a = array();
$in = $_REQUEST['in'];
$ex = $_REQUEST['ex'];
if ($ex) {
    $exa = preg_split('/\\s+/', $ex);
    $in .= ' -' . join(' -', $exa);
}
$items = item_find($db, $in, FIND_OR);
$default_height = $height = 1;
$cols = 3;
$pdf = new AlphaPDF('P', 'in', 'Letter');
$pdf->SetCompression(true);
$pdf->SetMargins(0, 0);
$pdf->SetAutoPageBreak(false);
$x = $y = 0;
$light = 96;
$basefontsize = 6;
$label_width = 2.625;
foreach ($items as $item) {
    $bx = 0.25 + $x * ($label_width + 0.125);
    $by = 0.5 + $y * $height;
    $vmargin = 0.125;
    if ($x == 0 && $y == 0) {
        $pdf->AddPage();
        if ($_REQUEST['debug']) {
            $pdf->SetDrawColor($light);
Esempio n. 3
0
    }
} else {
    $id = (int) $_REQUEST['id'];
    $items = array(item_load($db, $id));
    if (!$items[0]) {
        die_json("No such item.");
    }
}
$trim = $_REQUEST['trim'];
$left_margin = 0.2;
$label_width = 2.0;
$label_height = 0.75;
$basefontsize = 9;
$vmargin = 0.1;
$dummy = new AlphaPDF('P', 'in', array($label_width, $label_height));
$pdf = new AlphaPDF('P', 'in', array($label_width, $label_height));
foreach ($items as $item) {
    $pdf->AddPage();
    $pdf->Rotate(270);
    $pdf->SetFont('Helvetica', '');
    $pdf->SetFontSize($size = $basefontsize);
    $pdf->SetTextColor(0);
    // write the name
    $name = utf8_decode($item['name']);
    if ($trim) {
        $name = preg_replace("/{$trim}/i", '', $name);
    }
    $width = $pdf->GetStringWidth($name);
    while ($width > $label_width - $left_margin * 2 && $size) {
        $pdf->SetFontSize(--$size);
        $width = $pdf->GetStringWidth($name);