2

My code,

\documentclass[a4paper,11pt]{book}

\begin{document}

\IfFileExists{\jobname.pdf}
{\edef\Size{\pdffilesize{\jobname.pdf}}}
{\def\Size{0}} The file size is \Size~Byte\\

\edef\jobsize{\pdffilesize{\jobname.pdf}}
The file size is \jobsize~(\the\numexpr(\jobsize+512)/1024\relax~kB)\\

\end{document}

Mouse Right Click File Size >>> 14,3 kB (14.342 bytes)

Generated Log File Written >>> Output written on 2.pdf (1 page, 14342 bytes).

PDF file Written >>> The file size is 14433 (15 kB)

My 6 try picture

enter image description here

Very interesting result.

Why is not the same? I didn't find duplicate another question. Does anyone know how to fix it?

Related to: Include the file size of the generated pdf

closed as unclear what you're asking by Mensch, user11232, user31729, Svend Tveskæg, Paul Gaborit Sep 18 '15 at 14:37

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • I ran your code on my system. The file size printed on the pdf file changes when I do it again and again... what's the reason? – Enthusiastic Engineer Oct 23 '14 at 10:06
  • 2
    @EnthusiasticStudent: Because the current file size is used to calculate something, the result is shipped out and this changes again the file size, it's a vicious circle, but after some runs, it should stabilize, since the number of digits remains fixed then. – user31729 Oct 23 '14 at 10:15
  • @Özgür: After three or four runs (without changing the document additionally), all three numbers are equal. – user31729 Oct 23 '14 at 10:19
  • 2
    @ChristianHupfer so long as the time doesn't change sufficiently that compression is altered by a byte or two – David Carlisle Oct 23 '14 at 10:20
  • @DavidCarlisle: I know that there is compression involved, but I noticed, that the numbers differ only in three runs in the range of about 30 byte, afterwards they are stable – user31729 Oct 23 '14 at 10:21

Browse other questions tagged or ask your own question.