Re: [luatex] finish_pdffile callback
On 2/9/2018 3:25 PM, Knut Petersen wrote: Am 09.02.2018 um 15:07 schrieb Br. Samuel Springuel: I almost always use synctex, so that's a personal possibility, but I'm also programming for others who might not. What about the `stop_run` callback? Are the files closed by the time the final message is being spit out? No, it is not. But everything really relevant is written at that point. It is possible to copy the file, complete it using some shell commands, and to process that copy. See: http://tug.org/pipermail/luatex/2017-December/006692.html for an example. Luatex 1.04 does not complain if you delete the output pdf during the stop_run callback, so it is possible to reuse the original filename. Be aware that the stop_run callback is not used in draftmode. In http://tug.org/pipermail/luatex/2017-December/006690.html I proposed a place for a pdf_closed callback. if there will be one it will be a final wrap up callback, unrelated to pdf i.e. pretty late, something wrapup_run 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 -
Re: [luatex] finish_pdffile callback
Am 09.02.2018 um 15:07 schrieb Br. Samuel Springuel: I almost always use synctex, so that's a personal possibility, but I'm also programming for others who might not. What about the `stop_run` callback? Are the files closed by the time the final message is being spit out? No, it is not. But everything really relevant is written at that point. It is possible to copy the file, complete it using some shell commands, and to process that copy. See: http://tug.org/pipermail/luatex/2017-December/006692.html for an example. Luatex 1.04 does not complain if you delete the output pdf during the stop_run callback, so it is possible to reuse the original filename. Be aware that the stop_run callback is not used in draftmode. In http://tug.org/pipermail/luatex/2017-December/006690.html I proposed a place for a pdf_closed callback. Knut
Re: [luatex] finish_pdffile callback
On 2/9/2018 3:07 PM, Br. Samuel Springuel wrote: I almost always use synctex, so that's a personal possibility, but I'm also programming for others who might not. you can just use that callback ... (if needed turn on synctex with the synctex variable and turn if off afterwards) What about the `stop_run` callback? Are the files closed by the time the final message is being spit out? comes too soon it really has to be a new one (i.e. after files get closed with the side effect of crashing luatex when one still messes with the log file or state of tex but that's then up to the user) 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 -
Re: [luatex] finish_pdffile callback
I almost always use synctex, so that's a personal possibility, but I'm also programming for others who might not. What about the `stop_run` callback? Are the files closed by the time the final message is being spit out? -- ✝ Br. Samuel, OSB St. Anselm’s Abbey Washington, DC (R. Padraic Springuel) PAX ☧ ΧΡΙΣΤΟΣ
Re: [luatex] finish_pdffile callback
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)? Unofficial answer: you can cheat as there's a finish_synctex_callback that you can abuse (but you then temporary need to enable synctex) and that callbacks kicks in after the pdf is closed. The log file is still open then. 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 -
Re: [luatex] finish_pdffile callback
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 -