使用 PHP 从 Word 文档创建可编辑的 PDF
目前,我们正在与一位客户合作,该客户希望能够将大约 500 个表格放到网上供其客户下载和填写。它们目前保存为 Microsoft Word 文档。
客户是付费订阅的其他企业,因此他们希望能够下载带有自己公司品牌的这些表格。他们希望能够将这些表格下载为可编辑的 PDF,即客户可以在保存完成的副本之前填写 PDF 上的字段。
我见过许多转换器可以从 HTML 创建 PDF,例如 dompdf 或 mPDF,但没有任何东西可以可靠地创建可编辑的 PDF 或与 Word 文档一起使用。
有谁知道一种可以处理 Word 文档并在邮件合并类型场景中动态生成可使用 PHP 填充和保存的 PDF 的方法吗?
预先感谢您可以提供的任何帮助。
或者,如果您能想到更好的方法,我洗耳恭听!
编辑以添加更多信息:
他们想要使用 PDF,因为它允许人们下载一组他们无法编辑的表格,但仍然可以填写。
该公司出于健康和安全原因提供表格,例如事故报告,因此客户需要填写该表格,可能将其打印出来,然后重新上传回服务器。
我们希望使其尽可能自动化,就像我说的那样,他们有大约 500 个表格和几百个客户。手动创建这些品牌 PDF 不是一种选择!
We are doing some work with a customer at the moment who would like to be able to put online approximately 500 forms for their customers to download and fill in. They are currently saved as Microsoft Word documents.
Customers are other businesses who pay a subscription, so they would like to be able to download these forms with their own company branding. They would like to be able to download these forms as editable PDFs, i.e. the customers can fill in the fields on the PDF before saving their completed copy.
I have seen a number of converters that will create PDFs from HTML, like dompdf or mPDF, but nothing that will reliably create an editable PDF or that will work with a Word document.
Is anyone aware of a way that will work with a Word document, and dynamically generate PDFs in a mail-merge type scenario that will be fillable and save-able using PHP?
Thanks in advance for any assistance you can provide.
Or, if you can think of a better way to do it, I'm all ears!
Edit to add more info:
They wanted to go with PDFs as it will allow people to download a set form that they will not be able to edit, but will still be able to fill in.
The company provide forms for health and safety reasons, for example, an accident report, so the customer will need to fill this in, possibly print it off, and then re-upload it back to the server.
We want to make this as automated as possible, they have approx 500 forms, like I say, and a few hundred customers. Manual creation of these branded PDFs is not an option!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为如果您使用 Word 文档或 PDF,您将遇到的问题是您基本上需要客户手动上传表单,因为 PDF 和 PHP 不容易合并在一起。我认为 Google Docs 可以为您提供此功能,但从头开始实现会非常困难。
在我看来,使用 PHP 在网页上生成表单,然后根据用户输入生成 PDF 会容易得多?这样,您就可以将输入保存到数据库中以供将来参考,从长远来看,这可能会更容易一些。以这种方式生成表单将使徽标之类的定制变得非常容易实现。
然后,您还可以根据输入的数据生成 PDF,然后将其保存到服务器,以便日后访问。这对于Word文档来说可能是可能的,但我不知道该怎么做。
I think the problem you will have if you use Word Documents or PDFs is that you will basically need the customers to upload the forms manually as PDF and PHP don't easily merge together. I think Google Docs could provide this functionality for you but it would be very difficult to implement from scratch.
In my opinion it would be far easier to generate the forms on a webpage using PHP and then generate a PDF from the user input? This way you could then save the input to the database for future reference which would probably a bit easier in the long term. Generating the forms this way would make customization like the logo quite easy to achieve.
You could then also generate PDFs from the data entered which could then be saved to the server so that they can be accessed at a later date. This may be possible with word documents but i'm not aware of how to do it.