本文介绍了如何使PDF响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要响应的pdf文件,以便在台式机和手机上查看它.响应性是指它不仅应根据设备大小适合页面,而且应包含内容(即pdf中的文本,pdf图像),并且在移动设备上查看时也应具有响应性.就像下图所示,pdf内容应根据设备进行对齐.有没有实现此目的的API或库.

先谢谢了.请帮助我实现这一目标.

解决方案

如其他答案所示,PDF的主要功能是内容的视觉表示,并且视觉表示通常在不同的平台/阅读器/设备之间应该是相同的.这是文件格式的目标,并且与诸如XML之类的完全与结构有关的文件格式截然相反.

但是,近年来,PDF确实获得了附加功能,可能对此有所帮助. PDF文件现在支持标记,标记的目的是为文件添加结构.经过适当标记的PDF文件确实知道文本的段落在哪里,什么是标题,什么是列表等...并且从理论上讲,该信息可以用于支持(有限的)响应性.

例如,请参见此处的链接( https: //helpx.adobe.com/acrobat/using/reading-pdfs-reflow-accessibility-features.html ),其中Adobe解释了Acrobat Pro中的重排视图是如何工作的.它指出,Acrobat可以使用PDF文件中的标记结构(甚至可以为未标记的文档自动动态地创建一些标记标签的外观),以便为您提供PDF文件的视图,从而将其自身调整为可用的显示尺寸. /p>

这是否奏效主要取决于您将在移动设备上使用的阅读器技术,并且您当然不应该将这种可能性与内容被隐藏,替换,调整,重新定位等的完全响应能力混为一谈. ..例如您可以在网站上使用HTML和CSS完成的操作.

但这是一个开始.

I have a pdf file that I want to make responsive so as to view it in desktops as well as mobiles. Responsive in the sense that it should not only fit the page based on the device size, but also the content i.e. text, images inside the pdf should also be responsive when viewing on a mobile. Just like the image shown below, pdf content should be aligned based on the device. Is there any API or library to achieve this.

Thanks in advance. Please help me to achieve this.

解决方案

As indicated by other answers, PDFs primary function was to be a visual representation of content and visual representation should typically be identical across different platforms / readers / devices. That was the goal of the file format and it's diametrically opposed to file formats such as XML that are all about structure.

However, in recent years PDF did get additional functionality that may help with this. PDF files now support tagging and the purpose of tagging is to add structure to the file. A PDF file that is properly tagged does know where paragraphs of text are, what are headers, what are lists etc... And that information in theory can be used to support (limited) responsiveness.

For example, see the link here (https://helpx.adobe.com/acrobat/using/reading-pdfs-reflow-accessibility-features.html) where Adobe explains how the reflow view in Acrobat Pro works. It states that Acrobat can use the tagging structure inside a PDF file (or even automatically create some semblance of tagging on the fly for documents that are not tagged) to give you a view of the PDF file adjusts itself to the available display size.

Whether or not this is going to work depends mostly on the reader technology you will be using on your mobile device and you should certainly not confuse the possibilities of this with full responsiveness where content is hidden, replaced, adjusted, repositioned etc... such as what you can accomplish with HTML and CSS on web sites.

But it is a start.

这篇关于如何使PDF响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 13:27