如何实现图像或pdf查看器? [英] How to implement an image or pdf viewer?

查看:30
本文介绍了如何实现图像或pdf查看器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于学习目的,我想知道如何自己实现图像(和/或)pdf 查看器.

for learning purposes I would like to know how to implement an image (and/or) pdf viewer on my own.

我对实现这种事情的一般方法很感兴趣.

I'm interested in the general approach to implement such a thing.

我已经在网上 (tiff/pdf) 上阅读了不同的格式,所以我发现这些文件有一种特殊的格式,它描述了我必须在何处查找页眉、页脚所在的位置以及图像信息的位置(以解密形式)是.

I already read about the different formats on the net (tiff/pdf) so I found out that these files have a special format which describes where I have to look for a header, where the footer is and where the image information (in decrypted form) is.

因为我认为这样的查看器很有效.喜欢:

Because I think such a viewer works sth. like:

  • 打开文件
  • 读取不同的文件信息(页眉、页脚等)
  • 翻译"像素位置

我需要知道如何获取像素位置(如果是 tiff 文件).

I need to know, how to get the pixel positions (in case of a tiff file).

如何将其创建为控件?我必须把像素放在哪里?

How to create this as a control? Where do I have to put the pixels onto?

如果我错了,请随时纠正我,因为 ATM 我真的没有想法,一切都只是猜测.

Feel free to correct me if I'm wrong, because ATM I don't really have an idea and everything is just speculation.

问候,

创新

P.S.:我更喜欢 C# 中的解决方案,但如果它是另一种语言,也可以.平台应该是 Microsoft Windows(首先).

P.S.: I would prefer a solution in C#, but if it's in another language, it's ok, too. Platform should be Microsoft Windows (first of all).

P.P.S.:它应该可以在没有安装 pdf-/viewing-application 的情况下工作.

P.P.S.: It should work without an already installed pdf-/viewing-application.

推荐答案

对于任何类似的查看器,您必须查找要显示的每种文件类型的规范,并弄清楚其数据的编码方式.一些图像格式建立在其他格式之上,或使用类似的编码技术,而另一些则完全不同.PDF是另一种野兽.我已经用它做了一些工作,从我记得的情况来看(我可能是错的,已经有一段时间了)它基本上将自己表示为一系列对象,每个对象都有独特的位置、大小和各种属性,具体取决于对象类型.

For any viewer like that you will have to look up the specs for each file type you want to display and figure out how its data is encoded. Some image formats build on others, or use similar encoding techniques, while others are completely different from each other. PDF is another beast. I've done a bit of work with it and from what I remember (I could be wrong, it's been a while) it basically represents itself as a series of objects, each with unique position, size and assorted attributes dependent on the object type.

我会看看维基百科.它实际上有一些关于一些不同图像格式的非常好的文章.

I would take a look at Wikipedia. It actually has some really good articles on some of the different image formats.

http://en.wikipedia.org/wiki/JPEG

它肯定会指向您想要涵盖的每种格式的官方标准文档.

And it will definitely point you to the official standards documents for each format you want to cover.

最终,您可能不得不为每种格式阅读/实现 rfc:

Ultimately you will probably end up having to read/implement the rfc for each format:

JPEG - http://tools.ietf.org/html/rfc1341
PNG - http://www.faqs.org/rfcs/rfc2083.html
GIF - http://www.w3.org/Graphics/GIF/spec-gif89a.txt
BMP - http://www.faqs.org/rfcs/rfc797.html

HTH

这篇关于如何实现图像或pdf查看器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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