TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to use lua functions after the pdf is generated or to force generation of the pdf at some point in the tex file and still use lua?

Basically I need to modify the pdf and do this from the tex file.

One way I understand what I want to do would be the hypothetical code

\end{document} % Assume this statement would cause the pdf to be generated and written to disk

where myfunc now could access the most recent version of the pdf

Alternatively is there a way to generate the pdf of an \include even if it is not a complete tex document(this is effectively what I'm trying to achieve)?

e.g., if I do


it will generate mypart.pdf which is just the pages of the mypart.tex and not the complete document.

share|improve this question
AFAIK no and no. But I see an XY problem here. What problem are you trying to solve? – Martin Schröder May 13 '12 at 22:28
@MartinSchröder luatex says it has a callback finish_pdffile but it doesn't seem to be working ;/ – Uiy May 13 '12 at 22:34
Seems like one has to use stop_run instead – Uiy May 13 '12 at 22:45
So that is your problem? :-) – Martin Schröder May 14 '12 at 6:56

As Martin Schröder writes: no there is no way to do processing after a file has been written. The finish_pdffile callback can be used to add information to the PDF file, the stop_run callback comes close, but not quite. It is used to replace the statistic information at the end of the run.

share|improve this answer
I have the feeling that I have given the same answer several times today. – topskip May 14 '12 at 8:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.