davideuler / chm2pdf

Automatically exported from code.google.com/p/chm2pdf
GNU General Public License v2.0
0 stars 0 forks source link

Last page of CHM incompletly rendered or missing #41

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have some trouble with the last pages of my documents.

In one case, i get some ERR011: Unable to parse HTML element on line 49! from 
htmldoc on the last pages.
The strange thing is, that if I re-run the very same htmldoc command dipalyed 
with the --verose --verbosity high level (obviosly not deleting the temporary 
files), the pdf will be complete and no error ERR011 is rised.
It's like the last file written by the conversion before invoking HTMLDOC is 
still open or not completely written!

In an other case, the last page is simply completly missing, without any error 
message.

But the code look just fine to me:

            pf=open(filename,'w')
            pf.write(page)
            pf.close

What could be wrong??

Writing a dummy file afterwards before invoking HTMLDOC resolves the problem, 
but this seems quite a ugly hack to me (I am not a programmer).

Then I found the command
           pf.flush()

This also solves the problem. But why is this necessary??

Original issue reported on code.google.com by reto.kn...@gmail.com on 26 Nov 2011 at 9:27

Attachments: