Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 06-18-2013, 07:46 PM   #1
jwa
Master of Forgotten Zen
jwa began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jun 2013
Location: Newfoundland
Device: Sony PRS-T1
Customizing a PDF to EPUB

I am using a Sony PRS-T1 to read Bruce Eckel's Thinking in Java which is a PDF and is a pain in the butt to read on the Sony. I would like to read it as an EPUB but the standard conversion doesn't handle the embedded Java samples. These are nicely delimited by lines containing '//:' and '//:~'. Several of Bruce's books are available in PDF or HTML but EPUB would be nice.

This should be easily implemented in Calibre but the documentation is a bit confusing. I can do this myself if I can find my way around Calibre. Is there anything more informative than the 'manual'? I have found the code in the 'debug' data written to the 'input' directory. I have done a lot of XSLT (some years ago) and can this for myself but I want to minimize the 1st derivative of the learning curve. (I accept that it must be positive).

Where are the XSLT transformations that are applied and where can I insert some customization?

I know that PDF is nontrivial but most of the work is done. All I need is to tag certain parts of the XHTML for a monospaced font. I see how the existing stuff is marked for CSS, I just need to tailor my own.

Thanks in advance.

I have all ready cropped the PDF but it is still a pain to use in PDF.

Last edited by jwa; 06-18-2013 at 07:48 PM. Reason: PS
jwa is offline   Reply With Quote
Old 06-18-2013, 11:11 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: 26,433
Karma: 5383257
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
calibre does not use XSLT.
kovidgoyal is online now   Reply With Quote
Old 06-19-2013, 08:36 AM   #3
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 2,905
Karma: 4329385
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"/AuraH2O
If you can find your book as an html source I think it should convert to epub quite well. It can be perfected in Sigil afterwards if necessary.

I've done quite a lot of PDF to epub conversions, using various techniques, but I draw the line at technical manuals. Just too much manual effort IMO.
jackie_w is offline   Reply With Quote
Old 06-20-2013, 05:40 PM   #4
jwa
Master of Forgotten Zen
jwa began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jun 2013
Location: Newfoundland
Device: Sony PRS-T1
This is not a technical manual. It is a programming book and it is a very good one. It is readable as a PDF just painfully slow on the Sony reader. Bruce has several other books that contain samples of code and I would like to contribute by simplifying conversion of the books to EPUB.

I suppose I could save the INPUT files and fix them with a Perl program and feed them back into Calibre but that is not a solution that I would give back to the author. Hopefully, he might sell a few more books if they are available in EPUB format. He has given much away and I intend to buy some stuff from him but saving labour is also a way to say thanks.
jwa is offline   Reply With Quote
Old 06-20-2013, 07:07 PM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 38,471
Karma: 19300555
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2), Sony PRS-650, Sony PRS-T1, nook STR, iPad 1, iPhone 5
It cannot be converted without errors. You would have to pick a program to use to convert and then A/B compare to make sure it's correct. A single error in the code samples in the book and they won't work. To be honest, it's not worth the time/effort to do this.
JSWolf is online now   Reply With Quote
Old 06-21-2013, 12:01 AM   #6
jwa
Master of Forgotten Zen
jwa began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jun 2013
Location: Newfoundland
Device: Sony PRS-T1
Java code samples

The code fragments in these books are delimited with //: and //:- and there are no errors because these markers are used to verify that the code works using other production tools. I suspect that the C++ books use a similar technique.

There are other code fragments in-line but these do not concern me for now. I don't want to discuss the merits, I just want to be able to grok the calibre design enough to tinker on my own.

I thought that the use of XPath implied that there would be XSLT in the black box. I guess I was mistaken to assume that.

I am reading platform.py at the moment as the existing manual seems to suffer from being written by someone who understands the entire context all ready. That is not intended in a negative way as I hope to be constructive here. It is hard to distance yourself enough from internals to explain things succinctly. Good prose is very hard to write. Good technical prose is almost impossible. That is the thing I like most about Eckel's writing.
jwa is offline   Reply With Quote
Old 06-21-2013, 08:21 PM   #7
jwa
Master of Forgotten Zen
jwa began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jun 2013
Location: Newfoundland
Device: Sony PRS-T1
So I read through that code and established that calibre doesn't do the conversion. The conversion is done by pdftohtml.
jwa is offline   Reply With Quote
Old 06-21-2013, 08:27 PM   #8
PeterT
Taking a break; Fed up
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 7,354
Karma: 46281507
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
I did find an HTML version of the book at the authors website, albeit not the current version.
PeterT is online now   Reply With Quote
Reply

Tags
calibre conversion, epub, pdf, sony

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Customizing the library centuryx476 Library Management 3 05-09-2013 10:31 PM
customizing the toolbar rkillings Library Management 3 09-02-2011 05:37 AM
Customizing for a touchscreen sciurius Calibre 3 10-13-2010 01:55 PM
Customizing Calibre lunixer Calibre 5 08-23-2010 02:21 PM


All times are GMT -4. The time now is 11:18 PM.


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