0

我正在为父亲的业务提供一些技术方面的帮助,但似乎无法为看似简单的任务找到答案。他给了我几张打印出来的表格,他想把它们放在他的网站上供客户填写,而不是让他们亲自填写,然后每次都将表格扫描成 PDF。

我已经想出了如何在 Dreamweaver 中创建表单并提交到电子邮件,但我正在尝试找出一种通过电子邮件将表单作为附件 PDF 文件提交的方法,该文件显示表单的内容与它看起来完全一样网站(徽标、字段等),同时使用唯一名称(例如表单上的姓氏或日期)保存。

我对 PHP 有一点经验,但还不足以弄清楚如何为此目的编写脚本,甚至不知道从哪里开始这样的任务。任何建议或意见,将不胜感激!

谢谢!

4

1 回答 1

0

Consider using PDFlib as a PHP library to do this. Refer to This guide to install it. All of the functions I will mention are from php.net

First, you'll need to call PDF_begin_document to begin the document under a specified filename. You may then use PDF_setfont() to set the font to use(Refer to http://www.php.net/manual/en/function.pdf-setfont.php#10254 for the core fonts you don't need to embed, it looks as if they may not support size>12)

Create a page with PDF_begin_page_ext()

You can then use PDF_add_textflow() to add text from strings(Use string manipulation as it is easier then groping 5-subroutine-deep with textflows, I think \n is supported)

End the page after adding your textflows with PDF_end_page_ext()

Be sure to use PDF_end_document() to end the document. When you began the document, it took a filename. You will find the PDF there.

于 2012-06-11T23:40:23.650 回答