Am 11.12.2017 um 15:56 schrieb David Shourabi Porcel:
Hi!
If it's possible to carry out the postprocessing you need from within
LuaTeX instead of with ghostscript, the callback finish_pdffile might
be an option.
finish_pdffile is called very early.
Unfortunately even the stop_run callback is executed before the complete pdf
has been written and closed:
\directlua {
function my_stop_run()
os.execute("stat lyInLatex.pdf")
end
luatexbase.add_to_callback('stop_run', my_stop_run, 'TEST')
}
A "stat lyInLatex.pdf" after luatex finished shows that 40 bytes are not
written at the time of callback execution.
Let's have a look at the source code:
void finish_pdf_file(PDF pdf, int luatexversion, str_number luatexrevision)
{
[...]
if (total_pages == 0) {
[...]
} else {
if (pdf->draftmode == 0) {
[...]
} else {
if (callback_id > 0) {
run_callback(callback_id, "->");
}
}
libpdffinish(pdf);
if (pdf->draftmode == 0)
close_file(pdf->file);
*%**
** % I think that pdf_closed callback called at this place would
be a good idea!**
** %*
else
normal_warning("pdf backend","draftmode enabled, not changing output
pdf");
}
Knut