0

是否可以使用 PHP5 PDF 内置功能来编辑现有文件,类似于 Zend 的这种方法。

<?php
require_once 'Zend/Pdf.php';

$pdf = Zend_Pdf::load('blank.pdf');
$page = $pdf->pages[0];
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
$page->setFont($font, 12);
$page->drawText('Hello world!', 72, 720);
$pdf->save('zend.pdf');
?>

...但不使用 Zend?

(与PHP中的问题PDF 编辑有关? )

4

1 回答 1

2

There is no such thing as "built in PHP PDF", as the PHP pdflib wrappers are from PECL (and therefore not standard). However, if you'd like to run with pdflib... Have a read of the basic examples here. It isn't much harder than Zend, though slightly less intuitive (and probably less documented).

There are also a couple of PHP userland libraries (PHPPDF and similar) which might provide more features, at a cost: slower processing.

(To install pdflib: pecl install pdflib and then add it to extensions in your php.ini)

于 2013-04-12T16:23:24.863 回答