从PDF剥离Adobe Reader和版本要求,然后再将其输出到浏览器 [英] Strip Adobe Reader and Version requirements from PDF before outputting it to browser

查看:109
本文介绍了从PDF剥离Adobe Reader和版本要求,然后再将其输出到浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计划使用 pdf.js 通过带有Javascript的浏览器获取PDF上下文.问题是我正在使用的某些PDF需要具有特定版本的Adobe Reader.pdf.js尚不(永远?)支持这些欺骗.我需要知道的是,在C#中是否有一种方法可以打开PDF并删除这些Reader和Version要求以及如何做到这一点.我打算使用 itextsharp 来进行其他PDF操作服务器端,因此使用该示例的示例将是最多的乐于助人.我打算通过MVC 4从ajax请求中将它们作为 ActionResult 来使用,因此在此操作结束时, MemoryStream 会最有帮助.

I am planning on using pdf.js to have PDF context via the browser with Javascript. The problem is that some PDFs, the ones I am using, require Adobe's Reader with a specific Version. pdf.js does does not yet(ever?) support spoofing of these. What I need to know is if there's a way in C# to open the PDF and remove these Reader and Version requirements and how to do it. I was planning on using itextsharp to do other PDF manipulation server-side so an example using this would be most helpful. I plan on serving these as an ActionResult from an ajax request via MVC 4, so a MemoryStream would be most helpful at the end of this manipulation.

推荐答案

您的PDF文件 n-400.pdf 使用 XFA 的查看器,该文件似乎是pdf.js的没有.

Your PDF file n-400.pdf uses the Adobe XML Forms Architecture (XFA). This means you require a viewer that also supports XFA which pdf.js seemingly does not.

此类PDF通常包含一些标准PDF内容,这表明PDF需要某些支持XFA的查看器.就您而言,内容包含

Such a PDF normally contains some standard PDF content which indicates that the PDF requires some viewer that supports XFA. In your case the content contains

如果此消息最终没有被文档的正确内容替代,则您的PDF查看器可能无法显示此类文档.

If this message is not eventually replaced by the proper contents of the document, your PDF viewer may not be able to display this type of document.

这实际上表明启用了XFA的查看器的作用,它基于XFA XML数据中的信息呈现某些页面,并显示它而不是PDF样式页面描述.

This actually indicates what a XFA enabled viewer does, it renders some pages based upon information in the XFA XML data and displays it instead of the PDF style page descriptions.

虽然由Adobe专有定义,但PDF规范ISO 32000-1 描述了如何将XFA数据嵌入到PDF文档中,请参见.第12.7.8节 XFA表单.

While being defined proprietarily by Adobe, the PDF specification ISO 32000-1 describes how XFA data is to be embedded in a PDF document, cf. section 12.7.8 XFA Forms.

如果只需要处于展平状态的表单,则可能需要查看 iText演示:PDF中的动态XFA表单.

If you only need those forms in a flattened state, you might want to have a look at iText Demo: Dynamic XFA forms in PDF.

这篇关于从PDF剥离Adobe Reader和版本要求,然后再将其输出到浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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