# Lualatex after pdf is generated

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

\begin{document}
...
\end{document} % Assume this statement would cause the pdf to be generated and written to disk
\directlua{myfunc()}

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

\include{mypart}

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

• 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
• – Martin Scharrer May 14 '12 at 8:53