Пример #1
0
     if ($_REQUEST['debug']) {
         $pdf->SetDrawColor($light);
         $pdf->SetLineWidth(1 / 72 / 2);
         for ($ly = 0; $ly < 11; $ly++) {
             $pdf->Line(0, 0.5 + $ly, 8.5, 0.5 + $ly);
         }
         $pdf->Line(0.1875, 0, 0.1875, 11);
         $pdf->Line(0.1875 + 2.625, 0, 0.1875 + 2.625, 11);
         $pdf->Line(0.1875 + 2.625 + 0.125, 0, 0.1875 + 2.625 + 0.125, 11);
         $pdf->Line(0.1875 + 2.625 + 0.125 + 2.625, 0, 0.1875 + 2.625 + 0.125 + 2.625, 11);
         $pdf->Line(0.1875 + 2.625 + 0.125 + 2.625 + 0.125, 0, 0.1875 + 2.625 + 0.125 + 2.625 + 0.125, 11);
         $pdf->Line(0.1875 + 2.625 + 0.125 + 2.625 + 0.125 + 2.625, 0, 0.1875 + 2.625 + 0.125 + 2.625 + 0.125 + 2.625, 11);
     }
 }
 # write the code
 $pdf->SetFont('Helvetica', '');
 $pdf->SetFontSize($basefontsize);
 $pdf->SetTextColor($light);
 $width = $pdf->GetStringWidth($item['code']);
 $pdf->Text($bx + $label_width - $width - $vmargin, $by + $height - $vmargin, $item['code']);
 # write the barcode
 if ($item['barcode']) {
     foreach ($item['barcode'] as $code => $quantity) {
         if ($quantity == 1) {
             Barcode($pdf, $bx + $vmargin, $by + $height - $vmargin - $basefontsize / 72, $code, $basefontsize / 72, 1 / 72, strlen($code));
             break;
         }
     }
 }
 # write the name
 $pdf->SetFontSize($size = $basefontsize * 2);
Пример #2
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();