View Single Post
Old 01-23-2010, 05:27 PM   #20
soilwork
useR!
soilwork will become famous soon enoughsoilwork will become famous soon enoughsoilwork will become famous soon enoughsoilwork will become famous soon enoughsoilwork will become famous soon enoughsoilwork will become famous soon enough
 
soilwork's Avatar
 
Posts: 299
Karma: 651
Join Date: Nov 2007
Location: NY
Device: Onyx Boox Max 2, Kobo Libra H2O, iRiver Story HD
It also can be done by using ebook.convert.exe in command-line

Using ebook-convert.exe in command-line may be simpler than using GUI or opening CSS in epub file to modify it by hand. Since I almost never use calibre GUI, I am not sure whether or how this will affect the way GUI handles the database so please bear that in mind. Also, it may be useful only for those who are comfortable with command line.

I made a simple batch file named "2epub.bat" to convert files to epub with the setting I prefer.
Code:
REM 2epub.bat
ebook-convert %1 "%~n1%~x1.epub" --extra-css="C:\Program Files\calibre\fontin.css" --base-font-size 15 --no-default-epub-cover %2 %3 %4 %5 %6 %7 %8 %9
I put this batch file and the following "fontin.css" in Program Files\calibre directory. "fontin.css" is CSS file to support embedded fonts placed on PRS505. For more information, please refer to
https://www.mobileread.com/forums/showthread.php?t=36361
Code:
/* CSS for using Fontin fonts*/
/* Note that the Fontin fonts should be located in /fonts/ directory of Sony reader */
/* Modified: 2010 01 15 */
@font-face {
  font-family: "Fontin";
  font-weight: normal;
  font-style: normal;
  src: url(res:///Data/fonts/Fontin-Regular.ttf);
}
@font-face {
  font-family: "Fontin";
  font-weight: bold;
  font-style: normal;
  src: url(res:///Data/fonts/Fontin-Bold.ttf);
}
@font-face {
  font-family: "Fontin";
  font-weight: normal;
  font-style: italic;
  src: url(res:///Data/fonts/Fontin-Italic.ttf);
}

body {
  font-family: "Fontin", serif;
  line-height: 120%;
  widows: 0;
  orphans: 0;
}

Using these files, I can make "filename.ext.epub" from "filename.ext" without overwriting the original file.
Code:
2epub "filename.ext"
For example,
source file name -> output file name will look as follows.
--------------------------------------
filename.epub -> filename.epub.epub
filename.mobi -> filename.mobi.epub
filename.lrf -> filename.lrf.epub

This way, if the original source file is epub, the source file is not overwritten. Another reason is that I would like to track what is the source of the final epub file. For example, if I have multiple source files (e.g. freebies from Smashwords), I try converting from epub, mobi, lrf and leave the best one and it helps to know what is the best source file to use.

Last edited by soilwork; 03-11-2010 at 08:56 PM. Reason: Typo
soilwork is offline   Reply With Quote