I would like to integrate a sanity test in my Makefile that builds multiple PDFs. I would like to count and compare the number of pages generated based on what xelatex outputs during/after the run, compare it an expected value and stop make to see if layout changes accidentally created too many / too few pages. What is the best/easiest way to do that?
I could grep for the usual page counter in the output, e.g. [1][2][3], but that is prone to errors and often this counter is 1 page higher than the resulting PDF - in above example it counts to [3], but the PDF contains only 2 pages.
I would like to avoid to check the PDF itself in a separate step so I don't have to "guess" its filename (which is generated in my case). In case that makes a difference, I need a solution for xelatex.
TeXrelated content in this question yet. You could write the number of pages at the end of the document to a normal ASCII file and analyze this. – Dec 27 '15 at 07:47TeXoutput (console / log) and/or return codes ... I tried to make that clearer in the OP. – TeXter Dec 27 '15 at 07:52Output written on filename.pdf (x pages).in filename.log? – touhami Dec 27 '15 at 08:42[]values. I would gladly accept "grep for that" as an answer. – TeXter Dec 27 '15 at 08:56pdfinfo filename.pdf | grep Pages:? – egreg Dec 27 '15 at 10:02texloganalyserI can gettexloganalyser -q test.logto outputOutput written on test.pdf (9 pages, 48492 bytes).It could be a nice feature request. – egreg Dec 27 '15 at 12:13pdfinfo, I mean. – cfr Dec 27 '15 at 12:22