![]() |
From: Andrew Rinaldi <andrew.rinaldi@xxxxxxxxxxxx> Which HylaFAX version are you using ? The standard ubuntu one version: 2:4.4.0-2 which I take to mean 4.4.0. From: Lee Howard <faxguy@xxxxxxxxxxxxxxxx> Here is the reason why... # grep %%Pages: paper.ps %%Pages: 15 %%Pages: (atend) %%Pages: 1 %%Pages: (atend) %%Pages: 1 %%Pages: (atend) %%Pages: 1 %%Pages: (atend) %%Pages: 1 %%Pages: (atend) %%Pages: 1 %%Pages: (atend) %%Pages: 1 # grep %%Page: paper.ps %%Page: 1 1 %%Page: 2 2 %%Page: 3 3 %%Page: 1 1 %%Page: 1 1 %%Page: 4 4 %%Page: 5 5 %%Page: 6 6 %%Page: 7 7 %%Page: 8 8 %%Page: 9 9 %%Page: 10 10 %%Page: 11 11 %%Page: 12 12 %%Page: 1 1 %%Page: 1 1 %%Page: 13 13 %%Page: 1 1 %%Page: 1 1 %%Page: 14 14 %%Page: 15 15 Bingo. That looks like a smoking gun to me, too. So whether we sum up the %%Pages comments or count the instances of %%Page comments... we come up with the same count: 21. Obviously something isn't right, though - either with the Postscript document or with sendfax's page counting approach. The document seems to "go back" to page one 6 times in my read of things (but I'm no Postscript expert, either). How is this Postscript document being created? If you look at the actual document, you'll see it's a scientific research paper, which, like just about all such, is created using latex and a dvi->ps converter. The inserted %%Page: & %%Pages: comments are coming from the embedded figures (page through the document; it'll jump out at you -- when you get to a page where the page-comments get wonky, you'll suddenly notice that page has figures on it). Those figures were rendered as independent PS files by some other application, then included into the paper as a dvi special; the dvi->ps converter then just blindly dropped the entire contents of the figure files, page-count declarations & all, into the middle of the final PS document. Voila. I don't know enough about the rules for PostScript's structured-comments to know if this is right or wrong. If latex is doing it, though, then I am pretty sure there's a lot of it out there. At the end of the day, PostScript is a Turing-complete language. The only real way to know how many pages such a document comprises is to *execute it*, and count the number of times it performs a showpage while the PS program is running. Again, I wish I was enough of a ghostscript wizard to encapsulate that task using gs, but I'm not. One way to do it would be to execute ps2ps, which is basically just gs -q -sDEVICE=pswrite "-sOutputFile=$output-file" \ -dNOPAUSE -dBATCH "$input-file" to clean up the file -- this would produce a PS file that would contain only two page-count lines: %%Pages: (atend) %%Pages: <the right number here> I guess that for now I'll just avoid faxing PostScript files. If I may, I'd like to suggest that people actively hacking on hylafax consider shifting to a more robust page-counting technique for PostScript files than hylafax is currently using. Thanks for the help, Andrew, Lee. -Olin ____________________ HylaFAX(tm) Users Mailing List _______________________ To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*