sarabitcom/fpdf-barcode

用于生成带有条码支持的PDF文档的库

1.0.1 2021-10-24 11:05 UTC

This package is auto-updated.

Last update: 2024-09-24 17:27:17 UTC


README

用于生成带有条码支持的PDF文档的库

创建对象

 $pdf = new \Sarabitcom\Fpdf\FpdfCode39('P', 'mm', 'A4');          

设置边距

  $pdf->SetLeftMargin(68);
  $pdf->SetRightMargin(1);
  $pdf->SetTopMargin(90);

添加页面

  $pdf->AddPage();
 

设置标题(可选)

$pdf->SetAuthor('You Name');
$pdf->SetCreator('Sarabit PDF Barcode');
$pdf->SetTitle('Document Title');
$pdf->SetSubject('Document Subject');

添加条码

 $pdf->Code39(138, 160, "1234567890", 1, 10);

设置图片

$imagePath = "/home/user/yourimage.jpeg"; // Absolute Path
$pdf->Image($imagePath, 0, 0, 210, 297);

设置字体

// Normal
$pdf->SetFont('Times', '', 12);
// Bold
$pdf->SetFont('Times', 'B', 11);
// Italic
$pdf->SetFont('Times', 'I', 11);

创建单元格

$pdf->Text(68, 164, "Your Text Here");

输出

$pdf->Output('file.pdf', 'I');