Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

The error is:

ERR011: Unable to parse HTML element on line 13!
PAGES: 2854
BYTES: 9759142
Something wrong happened when launching htmldoc.
exit value:  256
Check if output exists or if it is good.
Done.

Which I received from running chm2pdf --webpage '/home/brentonhorne/Drugs/CHM/Goodman and gillman.chm'

I looked in the pdf generated and it had

ÿØÿàJFIFÿÛC  
$$$$$'--'7;7LLPÿÛC  
"$"'--'7;7LLfÿÀXÎ"ÿÄÿÄ^!1"A2Qaq#BRTbr¡²³Ò36CSst¢±Ñ$%45U´ÁÂÓ¿Dcd£âÃãðEáñ&euòÿÄ?ÓÉ,ãÍé:«+ÜcÃ#ÿJ¦sñÒñ´VУ¹æè ÿÒ5Fk»ÁO'ôÚÜC ÷ <
¦Ôð³NÀ·8¡»ºhA2ÉÃ4SLkæ;¤vȱ¬õ«xJì9þ-ÿf··¢gz«åMìê Ǻ³²Ü\ËÞ: Ê qê

for the first page (book cover). It also failed to render many images and equations, with a lot of text formatting lost (many things that are bold in the original CHM file aren't bold anymore). How do I overcome this problem? I am running 32 bit 12.10 if it helps.

CHM2PDF_TEMP_WORK_DIR=tempfile.mkdtemp()
CHM2PDF_TEMP_ORIG_DIR=tempfile.mkdtemp()

is located in the /usr/bin/chm2pdf python script.

share|improve this question
    
Instead of adding a picture of your tmp I would have expected you to check the optionsCHM2PDF_TEMP_WORK_DIR and CHM2PDF_TEMP_ORIG_DIR and see if you are using a different directory. –  Rinzwind Feb 15 '13 at 9:05
    
where do I find this? I should probably tell you now I am a complete and utter noob when it comes to programming, ubuntu, etc. aside from the stuff you pick up from using it for 8 months. –  Brenton Horne Feb 15 '13 at 9:07
    
Read this: karakas-online.de/forum/viewtopic.php?t=10275 Bullit point 4 and 5 in the 1st post. Has nothing to do with Ubuntu btw; I use this script mainly with Windows and the same applies there: you need to look in the script with a text editor ;) –  Rinzwind Feb 15 '13 at 9:11
    
I have added those lies to my question –  Brenton Horne Feb 15 '13 at 9:20

1 Answer 1

This is a normal error when the HTML contains other languages (like javascript) or contains formatting errors.

Use --extract-only to extract the HTML files from the CHM, change the HTML files to something that is valid HTML and then use --dontextract to convert the new files into a single PDF (--extract-only and --dontextract options were created just to overcome these kind of errors).

Some pointers regarding extracting and manipulating a file can be found here:

-- The first link of these 3 show that 2 options CHM2PDF_TEMP_WORK_DIR and CHM2PDF_TEMP_ORIG_DIR are used to store the temporary files om disc. From the link:

This is the only changeable variables in the script. The user can change them to whatever he likes - no other changes are needed. From CHM2PDF_TEMP_WORK_DIR and CHM2PDF_TEMP_ORIG_DIR, the chm2pdf computes its orig and work dirs by adding the basename of the CHM file (without the .chm ending). So if you give it /home/chris/my-file.chm to convert, it will use /tmp/chm2pdf/work/my-file as work directory and /tmp/chm2pdf/orig/my-file as orig directory. It expands the files contained in the CHM file into the orig directory, then copies the ones it needs into its work dir and continues there. The original TEMP_DIR and TEMP_OUT simply did not work out of the box.

share|improve this answer
    
Where will the html files be placed? –  Brenton Horne Feb 15 '13 at 8:47
    
I have checked the directory containing the CHM files and it's not there –  Brenton Horne Feb 15 '13 at 8:49
    
There's heaps of directories inside /tmp and no singular html files are in /tmp –  Brenton Horne Feb 15 '13 at 8:51
    
I have added a screenshot of my /tmp directory to my question. –  Brenton Horne Feb 15 '13 at 8:54
    
I ran a search of the /tmp directory for the keywords "chm2pdf" and I received no hits. –  Brenton Horne Feb 15 '13 at 8:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.