以编程方式启用 Adobe PDF 使用权限
有没有办法以编程方式从 .net 代码启用 Adobe PDF 使用权限? 我正在使用 ITextSharp 库用 XML 数据(从应用程序生成)填充 XFA 表单, 但输出的 PDF 没有启用使用权限,因此用户无法与其交互(这通常不会成为问题,但原始 PDF 是政府提供的,并且 用户必须单击一些验证按钮,并且该过程是特定于用户/公司的)
这可以通过 Adobe Reader 手动完成,但您必须拥有 adobe acrobat 专业许可证。Google
表示“只有 Adobe 产品可以做到这一点”。 。 (http://old.nabble.com/Enable-Adobe -读者使用权-td14276927.html)
string pathPDF = @"C:\original.pdf";
string pathCreated = @"C:\created.pdf";
string pathXml = @"C:\data.xml";
using (PdfStamper stamper = new PdfStamper(new PdfReader(pathPDF), System.IO.File.OpenWrite(pathCreated)))
{
stamper.FormFlattening = false;
stamper.AcroFields.Xfa.FillXfaForm(pathXml);
stamper.Close();
}
Is there any way to programmatically enable Adobe PDF usage rights from .net code ?
I'm using ITextSharp library to fill an XFA Form with XML Data (generated from app),
but the output PDF does not have usage rights enabled, thus the users cannot interact with it (that wouldn't normally be a problem, BUT the original PDF is gov supplied, and
the user must click some validation buttons, and that process is user/company specific)
This could be manually accomplished from Adobe Reader but you have to have an adobe acrobat professional licence..
Google is saying that "Only Adobe products can do that" ..
(http://old.nabble.com/Enable-Adobe-Reader-usage-rights-td14276927.html)
string pathPDF = @"C:\original.pdf";
string pathCreated = @"C:\created.pdf";
string pathXml = @"C:\data.xml";
using (PdfStamper stamper = new PdfStamper(new PdfReader(pathPDF), System.IO.File.OpenWrite(pathCreated)))
{
stamper.FormFlattening = false;
stamper.AcroFields.Xfa.FillXfaForm(pathXml);
stamper.Close();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
以编程方式执行此操作的唯一方法是使用 Adobe Reader Extension Server。您可以在此处查看 Adobe 白皮书:http://www.adobe。 com/sea/products/server/readerextensions/pdfs/readerextensionsserver_ds.pdf
在上面的例子中,您将使用 iTextSharp 创建 Pdf 文档,然后使用 Adobe Reader Extension Server 来允许 Pdf 文档在 Adobe Reader 中具有扩展功能。
但是,有一个小窗口可让您使用 iTextSharp 并填写已启用 Reader 的 PDF 文档。如果您有这样的Pdf文档(Reader Enabled),那么您可以使用iText/iTextSharp来填写XFA数据。您可以在此处查看示例:
http://itextpdf.com/examples/iia.php?id=166
祝你好运!
The only way to do it programitically is to use Adobe Reader Extension Server. You can review Adobe whitepaper here: http://www.adobe.com/sea/products/server/readerextensions/pdfs/readerextensionsserver_ds.pdf
In the case above you would use iTextSharp to create Pdf document and then use Adobe Reader Extension Server to allow Pdf document to have extended functionality in Adobe Reader.
However, there is a small window that allows you to work with iTextSharp and fill-in already Reader-enabled PDF documents. If you have such Pdf document (Reader Enabled), then you can use iText/iTextSharp to fill in XFA data. You can check example here:
http://itextpdf.com/examples/iia.php?id=166
Good luck!
目前只有 2 个产品可以启用使用权限:
有关此功能的一些发现 此处。
Currently only 2 products can enable usage rights:
There have been some findings regarding this feature here.
不。Adobe 使用强加密来确保它......我相信 PPK。
这是因为只有 Adobe 产品可以做到这一点。您可以支付某些 Acrobat 服务器产品或其他... $$$... 但仅此而已。
No. Adobe uses Strong Crypto to ensure it... PPK I believe.
That's because only Adobe products can do that. You can pay for some Acrobat server product or other... $$$... but that's it.
这对我有用:
This worked for me:
您可以使用 PdfStamper 完成它
使用此代码,它将起作用
使用 PdfStamper 时,如果表单启用了阅读器扩展,则
you can complete it using PdfStamper
when using PdfStamper use thi code
if the form is Reader Extension enabled it will work