arimac/fpdf
Composer 安装命令:
composer require arimac/fpdf
包简介
FPDF is a PHP class which allows to generate PDF files with pure PHP. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.
README 文档
README
This is a fork of official mirror of the FPDF library. We changed it to support streaming chunked data. You can avoid memory exceed errors by using this library.
Installation with Composer
If you're using Composer to manage dependencies, you can use
$ composer require arimac/fpdf:^1.8
or you can include the following in your composer.json file:
{
"require": {
"arimac/fpdf": "^1.8"
}
}
Usage
- To download a file as a stream
<?php
require('fpdf.php');
$pdf = new FPDF();
$pdf->StartDownload('sales_report.pdf');
for($i=0; $i<100000; $i++) {
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
}
$pdf->Close();
Now FPDF will sending the generated data to the browser without waiting to finish the loop.
- To present a preview of a file as stream
require('fpdf.php');
$pdf = new FPDF();
$pdf->StartPreview('sales_report.pdf');
for($i=0; $i<100000; $i++) {
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
}
$pdf->Close();
Same as above method. But it opening the generated PDF file insteed of downloading.
- To directly write to a file
require('fpdf.php');
$pdf = new FPDF();
$pdf->StartFile('sales_report.pdf');
for($i=0; $i<100000; $i++) {
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
}
$pdf->Close();
统计信息
- 总下载量: 453
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-12-30