- I've hooked luatex's
stop_runcallback so I can do some processing on the output pdf after it is generated. - To process the pdf I need to call os.execute. When doing so I an error saying "All command executes disabled" but otherwise everything works normal execute os.execute doesn't execute the command I want.
- I use
-shell-escapeto try and get os.execute to work I then get an error that that the
Failed to open PDF file: Main.pdf Errors encountered. No output created. Done. Input errors, so no output created. Error: Failed to open PDF file: Main.pdf Errors encountered. No output created. Done. Input errors, so no output created.
yet Main.pdf is clearly created but os.execute still does not execute(note that adding -shell-execute to the command line is the only change that creates this error). I get a different error from my os.execute too. It is no 1 instead.
ALSO! If I simply use 'copy ...' to try and copy the main.pdf file to a tmp location(thinking maybe it was locked) I get a new pdf but it is not complete as if the buffers were not fully flushed. (if that were the case then I would just get that annoying error message but otherwise everything else would be ok)
To recap:
- Trying to get os.excute to work. I use
shell-escapebut this cases other problems - My callback is suppose to be called after the pdf is generated BUT when I simply try to copy it, it seems to not copy all of the file. Either the pdf is not being flushed or something is adding additional stuff to the end of the pdf(although I wouldn't expect this and at the very least would expect the original pdf to be valid).
I've tried writing several minutes and the copy still doesn't get the whole file(it's missing about 1kb at the end after some hyperref stuff).
Anyone have any ideas whats going on?
(if I can get this to work I should have the ability to make \include precompilable(so it will not compile the included file unless the tex file changed but will import a precompiled version))
finish_pdffilewas it but it's actually beforestop_run. It would not be hard to add a callback to be called after the pdf. I guess all the work I've put into making a precompiled version ofincludeis worthless now ;/ (well, less I do it in batch or make file which I don't really want to do) – Uiy May 14 '12 at 07:59} else if (callback_id > 0) { res = run_callback(callback_id, "->"); } } libpdffinish(pdf); if (pdf->draftmode == 0) close_file(pdf->file);... 00452 void libpdffinish(void) 00453 { 00454 xfree(fb_array); 00455 xfree(char_array); 00456 xfree(job_id_string); 00457 fm_free(); 00458 t1_free(); 00459 enc_free(); 00460 img_free(); 00461 vf_free(); 00462 epdf_free(); 00463 ttf_free(); 00464 sfd_free(); 00465 glyph_unicode_free(); 00466 zip_free(); 00467 } – Uiy May 14 '12 at 08:19stop_runto be before close.file and a flush should definitely take care of the issue. – Uiy May 14 '12 at 08:20