Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know similar questions have been asked before, but before marking it as duplicate, let me explain.

I just bought a .pdf ebook online and would like to have it as a .epub instead. I usually use calibre (v1.0.0) to this sort of tasks with great success. This time, a large proportions of lines just seems to get messed up during the conversion.

Jérôme disait aimer le rouge. Sa marotte
FRQVLVWDLW VXUWRXW ¡ O#HQOHYHU 'ªJUDIHU OD
dentelle était un geste qu'il effectuait avec la

Even if you don't speak french, you'll notice that the middle line is garbage. And it's not only a useless line, it does replace actual content.

The calibre ebook viewer displays the initial pdf with the garbage, while it displays just fine with my default pdf viewer. I tried converting to mobi, txt, mkd, to no avail.

I tried pdftotext, and the online tool http://www.zamzar.com/ and got the same output.

I then converted the pdf to .pbm files and tried running gocr and ocrad on it. The OCR results were quite interesting, but not good enough to be used as-is.

Jérôme _sȧit aimer le rouge. Sa marotte
consistait surTout à l'enlever. Dégrafer la
dentelle était un geste qu_l effectuait avec la

Would you have any idea of other tools that could help in the process or options to fine-tune calibre or OCR programs ?

Note: I'm running ubuntu 13.10.

share|improve this question
1  
Looks like the PDF contains encrypted lines. Probably as anti-copy protection. The PDF also contains a macro which automatically decrypts the lines when viewing, as long as you use a reader that can handle the embedded macro's. Calibre, zamzar and most other software will use the same method as pdftotext to extract the pure text, without going through the decryption macro. You may have some luck be loading the pdf in Adobe reader (I know, that piece of ***) and exporting it as html. From there you can go to epub. I would try the PDF import from LibreOffice as well. –  Tonny Nov 19 '13 at 23:05
    
@Tonny Thanks for the pointer. I tried LibreOffice, but text is still messed up. I'll try to get my hands on a Windows machine to test the official Adobe reader. –  pixelastic Nov 19 '13 at 23:51
    
Something my brother in law suggested: Try ghostscript to convert the PDF from one layout to another (e.g A4 pages to A3 or something like that). The convert might undo the encryption (if you are lucky). –  Tonny Nov 20 '13 at 15:54
    
@Tonny I tried to convert to ghostscript, but it still contains the garbage text in the final output. I'll also try to see if I can a good output from pdfjs. –  pixelastic Nov 21 '13 at 16:16

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.