[luatex] Is there a hook that could be used by a pdf postprocessor?

Hans Hagen pragma at wxs.nl
Mon Dec 11 21:27:39 CET 2017


On 12/11/2017 6:30 PM, Knut Petersen wrote:
> 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.

Which doesn't mean that there cannot be something written via lua 
scripts. Also, there is be more to be wrapped up: the log file, file 
recording, closing of the synctex file, etc.

Anyway, managing your workflow can best be done with a wrapper (make was 
already suggested but many other solutions are possible).

Also, as developers we want to have the freedom to change such aspects 
of the implementation any time we like if additions to the tex engine or 
backend demand it. Pre- or postprocessing as part of the run is not part 
of the concept. What works for you can fail for someone else as timing 
is very application specific.

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
-----------------------------------------------------------------


More information about the luatex mailing list