On 2/9/2018 3:44 AM, Br. Samuel Springuel wrote:
I noticed in the docs that LuaTeX has a `finish_pdffile` callback whose
short description is "Called when all pages have been written to the PDF
file." Does this mean that LuaTeX has closed the pdf file when this
callback is executed (and thus it is safe for the callback to instruct
other tools to manipulate the pdf file)?
No. If you want to manipulate the pdf file you have to do that after a
run (no big deal as normally a multi-pass run is managed anyway).
Writing pages to a file is one thing, finishing the file i.e. wrapping
up fonts and resources and an xref happens at the end and in different
spots. The finish_pdf_file callback can be used to add stuff to a file
as part of that process. If the file had been closed it would be a
useless callback.
We could add an extra callback but it would probably be a fragile one as
at that stage all files are closed so for instance a print to a log file
or doing something tex might crash the machinery (and adding safeguards
all over the place would mess up the code as well give a performance
hit). We can of course state that with such a callback 'no one can
complain about side effects'. Anyway, something like that cannot happen
for the upcoming release (we're close to texlive freeze state).
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------