Last page of CHM incompletly rendered or missing

Bug #896692 reported by Reto Knaak on 2011-11-26
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
chm2pdf
Unknown
Unknown
chm2pdf (Ubuntu)
Undecided
Unassigned

Bug Description

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

Reto Knaak (reto-knaak) wrote :

...and here the patch for it!

The attachment "Flush file before closing to avoi trouble on last page of document" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Reto Knaak (reto-knaak) on 2011-11-27
Changed in chm2pdf (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.