I am using linenum command in PE to add line number information into an XML file. The following is what I am doing:
1. add_hook for formatcontinuehook and formatcompletehook.
2. Call e3::convert to start a conversion to convert XML to PDF
3. formatcontinuehook is called durring the conversion. I made a copy of the doc and save it into a file (1). And return 0.
4. formatcompletehook is called when format complete.
a) I set the saved file (1) as current document and do a layout::apply("layout::linenum()"); or compose_lnr(); to add line number information into this file.
b). I do some post process to extract information I need and save to another file (2).
I got pubtex.exe crash error in some of my files when run through this program. There is no extra error information for me to know what the problem is and it just crashed. I think the error is happened in step 4.a) described above.