开发者

getting number of pages in a fax tiff?

How can I get a page count from a tiff file fo开发者_开发知识库r faxes? using "g4" format. Language preferred is c++


Two options that come to mind.

  1. Have a look at LibTIFF. www.libtiff.org

This library is used by many other open source libraries and can be used for much more than just getting a page count from a Group4 Multi-page TIFF file. This is probably the easiest, quickest and cheapest approach. I noticed there is a section of code in tiff2pdf program that counts the tiff pages. You can probably adapt this code to suit your needs. There are versions suitable for Linux and Windows.

  1. Download the full TIFF specification at http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf and write your own code.

Basically a multipage tiff is a whole lot of singe page tiffs merged together. There are headers that include offsets to the next page. To get the pagecount you need to traverse the headers and keep count until you hit then end of the chain. The code should be quite simple once you have the correct header structures and use fread() and fseek() to traverse the chain.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜