views:

37

answers:

1

Hello,

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.

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:

  • opening the file
  • reading different file information (header, footer, etc.)
  • "translate" pixel positions

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?

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

Regards,

inno

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.: It should work without an already installed pdf-/viewing-application.

A: 

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.

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

Zippit