Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 01-18-2011, 12:01 PM   #1
yelloguy
Enthusiast
yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.
 
Posts: 30
Karma: 4698
Join Date: Jan 2011
Device: none
Converting PDF with code samples - losing battle?

I just downloaded the latest Calibre update released today. And I have tried converting some programming books in PDF format with this new version as well the previous version before this. The problem I have is that the sample code listings are mangled or re-flown during conversion to epub.

I even downloaded Sigil to see if it was something I could fix manually. But it seems like Calibre is outputting the code in a <p> tag with "calibre2" style applied just like the rest of the book. Meaning it is too late for Sigil to do anything.

I also noticed that the page headers are not being removed correctly so I have unnecessary page breaks (and page numbers and text). However, there are options in Calibre to specify a regex. So it's only a matter of (!) learning the right regex and putting it in there. But if there is no way to fix the code listing problem then I'd rather not waste my time on this.

I noticed that every listing in the PDF begins with a header with text "Listing 1.1". I am not sure if there is a way to specify the regex for inserting a <Pre> tag at these places.

Save for these two issues with PDF's, the tool works like a charm. So a grateful thanks to the author kovid. I used it to convert a .CHM with code listings and all to epub. So if it understood that, there's gotta be a way to make it understand this.
yelloguy is offline   Reply With Quote
Old 01-18-2011, 12:17 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
See http://calibre-ebook.com/user_manual...-pdf-documents
kovidgoyal is offline   Reply With Quote
Advert
Old 01-18-2011, 03:48 PM   #3
yelloguy
Enthusiast
yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.
 
Posts: 30
Karma: 4698
Join Date: Jan 2011
Device: none
Thanks kovid. I saw it already from another thread. Did not help.
yelloguy is offline   Reply With Quote
Old 01-18-2011, 04:22 PM   #4
yelloguy
Enthusiast
yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.yelloguy is fluent in JavaScript as well as Klingon.
 
Posts: 30
Karma: 4698
Join Date: Jan 2011
Device: none
Interesting... I just found pdfonline.com and gave it my PDF. It butchered the TOC and did some slightly funky formatting but kept the code samples intact. The conversion timed out so it only gave me a partial document back. I did not bother to check the length as I was more interested in the formatting anyway.

I then gave the rtf to Calibre and it kept the code formatted correctly!

The funky formatting got funkier and headers were shown as text too. Overall, its unusable, but the code was transferred correctly.

Just sharing!
yelloguy is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
losing line spacing when converting with Calibre Stensie4JC Conversion 9 01-23-2011 03:47 PM
Amazon losing the e-book pricing battle: Will content trump distribution? kjk News 0 02-05-2010 11:32 AM
Losing formatting when converting PDB Edwin Fong Calibre 5 10-25-2009 07:20 PM
PDF samples kovidgoyal Calibre 13 09-23-2009 06:40 AM
Losing chapter information when converting pars_andy Calibre 3 04-25-2009 02:55 PM


All times are GMT -4. The time now is 03:47 PM.


MobileRead.com is a privately owned, operated and funded community.