生成带有数字签名的PDF [英] Generate PDF with digital signature

查看:288
本文介绍了生成带有数字签名的PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在具有数字签名的PHP中生成PDF文件?首选开放源代码解决方案.

Is it possible to generate PDF file in PHP with digital signature? An open-source solution is preferred.

推荐答案

从5.5.001版本(2010-06-23发布)开始的TCPDF可以对生成的PDF文档进行签名.

TCPDF starting from version 5.5.001 (released 2010-06-23) can sign generated PDF documents.

它也可以在任何位图/文本上放置透明的签名矩形字段,因此单击签名字段会弹出签名面板-很酷的功能. seta-PDF签名者也是如此,但是您必须支付:-)

It can also place transparent signature rectangle field over any bitmap/text, so clicking on the signature field brings up signature panel - cool feature. That same does seta-PDF signer, however you have to pay:-)

如果使用FPDI桥扩展了TCPDF,它还可以解析PDF版本最大为1.7的现有文档,并使用X.509证书对其进行签名.它可以100%解析其自身生成的PDF文档或任何其他PHP PDF工具(例如FPDF,DOM PDF,mPDF等)创建的pdf文档,计算PDF签名并写回相同的签名PDF文档.

If TCPDF extended with FPDI bridge, it can also parse already existing documents with PDF version up to 1.7 and sign it with X.509 certificate. It can 100% parse PDF documents generated by itself or pdf document craeted by any other PHP PDF tool (e.g. FPDF, DOM PDF, mPDF, ..), calculate PDF signature and write back the same signed PDF document.

但是,如果您想解析由其他(例如二进制)PDF生成器(iText,..)创建的PDF文档,则它可能无法解析该文档.您可以尝试使用其他PDF解析器(我只知道Zend Framework PDF Parser值得尝试),但是由于PHP对PDF定义的实现有限(PHP是主要的文本脚本语言,无法处理二进制文件),因此它可能无法读取和反编译PDF文档的整个结构.东西很容易,所以这是限制的根源.

If, however, you want to parse PDF document created by other (e.g. binary) PDF generator (iText, ..), it may not be able to parse the document. You may try another PDF parser (I only know Zend Framework PDF Parser worth of trying), however it may not read and decompile whole structure of PDF document since PHP has limited implementation of PDF definitions (PHP is primary textual scripting language, cannot handle binary stuff easily, so this is the root of the limitation).

因此,如果您正在考虑在网站上生成PDF,请使用相同的工具来创建PDF文档和签名-最好在这里推荐的是TCPDF.在Google上寻找它(如果您尚未听说过(:-o)

So if you are thinking about generating PDF on your web site, use the same tool for creating PDF document and signing - best I can recommend here is TCPDF. Look for it over google, if you haven't heard of it yet (:-o)

目前,我不认为DOM PDF可以对PDF文档进行签名.

At the time being, I dont think DOM PDF can sign PDF documents.

VersyPDF是.dll/.so PHP扩展名,非常受支持,价格昂贵,而且记录的很差.您可能会遇到无提示信息的无提示崩溃...它也不支持256位AES证书,该证书现在是标准的.如果您在作为开发人员的32位计算机和生产中的64位计算机上运行,​​则必须获得不同的重新编译版本.我们用TCPDF替换了VersyPDF. Performanceace的损失几乎没有引起注意,我们能够动态生成300-600 kB PDF签名的文件.遗憾的是,否则如果您使用VersyPDF并拥有出色的性能,它的API就会有些不错.根据我的经验,这是一个单人表演...

VersyPDF is .dll/.so PHP extension and is VERY BADLY supported, is expensive, and really POORLY documented. You may experience silent crashes without error messages... It also does not support 256-bit AES certificates, which are now standard. And you have to get different recompiled version if you are running on 32bit machines as developer and 64bit machines in production. We replaced VersyPDF with TCPDF. Performace penalty is hardly notable, we are able to generate dynamically 300 - 600 kB PDF signed documents. It's a pity, coz otherwise VersyPDF has somewhat nice API if you play with it and good performance. It's a one-man show I guess from my experience...

欢呼 Lubos

这篇关于生成带有数字签名的PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆