Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 06-18-2013, 06: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 06:48 PM. Reason: PS
jwa is offline   Reply With Quote
Old 06-18-2013, 10: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: 43,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
calibre does not use XSLT.
kovidgoyal is offline   Reply With Quote
Advert
Old 06-19-2013, 07:36 AM   #3
jackie_w
Grand Sorcerer
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: 6,208
Karma: 16228558
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
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, 04: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, 06: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: 73,897
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
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 offline   Reply With Quote
Advert
Old 06-20-2013, 11:01 PM   #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, 07: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, 07:27 PM   #8
PeterT
Grand Sorcerer
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: 12,159
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
I did find an HTML version of the book at the authors website, albeit not the current version.
PeterT is offline   Reply With Quote
Reply

Tags
calibre conversion, epub, pdf, sony


Forum Jump

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


All times are GMT -4. The time now is 02:38 PM.


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