How can I get a page count from a tiff file for faxes? using “g4” format. Language preferred is c++
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Two options that come to mind.
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.
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.