ebook - create and manipulate e-books from the command line
ebook COMMAND arg1 arg2 --opt1 --opt2
See also "EXAMPLES".
adddoc
Adds a documents to both the book manifest and spine.
--opffile
--opf
The OPF file to modify. If not specified one will be searched for in the current directory.
--id
The ID attribute to use for the added manifest item. This is required, and ebook will abort if it is not specified.
--mimetype
--mtype
The mime type string to use for the added manifest item. If not specified, it will be autodetected via File::Mimeinfo::Magic. This may not result in an optimal string.
ebook adddoc --opf mybook.opf --id 'text-ch1' chapter1.html
additem
Add an item to the book manifest, but not the spine.
Note that the "fix" command will automatically insert manifest items for any local files referenced by existing manifest items.
ebook additem --opf mybook.opf --id 'illus-ch1' chapter1-illus.jpg
blank
Create a blank e-book structure.
--opffile filename.opf
--opf filename.opf
Use the specified OPF file. This can also be specified as the first non-option argument, which will override this option if it exists. If no file is specified, the program will abort with an error. =item --author "Author Name"
--author
The author of the book. If not specified, defaults to "Unknown Author".
--title
The title of the book. If not specified, defaults to "Unknown Title".
--dir directory
-d directory
Output the OPF file in this directory, creating it if necessary.
ebook blank newfile.opf --author "Me Myself" --title "New File" ebook blank --opffile newfile.opf --author "Me Myself" --title "New File"
Both of those commands have the same effect.
fix
Find and fix problems with an e-book, including enforcing a standard specification and ensuring that all linked objects are present in the manifest.
Use the specified OPF file. This can also be specified as the first non-option argument, which will override this option if it exists. If no file is specified, one will be searched for.
--oeb12
Force the OPF to conform to the OEB 1.2 standard. This is the default.
--opf20
Force the OPF to conform to the OPF 2.0 standard. If both this and --oeb12 are specified, the program will abort with an error.
--mobi
Correct Mobipocket-specific elements, creating an output element to force UTF-8 output if one does not yet exist.
Save the fixed output into the specified directory. The default is to write all output in the current working directory. Note that this only affects the output, and not where the OPF file is found.
genepub
Generate a .epub book from existing OPF data.
--filename bookname.epub
--file bookname.epub
-f bookname.epub
Use the specified name for the final output file. If not specified, the bok will have the same filename as the OPF file, with the extension changed to .epub.
.epub
Output the final .epub book into the specified directory. The default is to use the current working directory.
ebook genepub mybook.opf -f my_special_book.epub -d ../epubbooks
or in the simplest case:
ebook genepub
setmeta
Set specific metadata values on existing OPF data, creating a new element only if none exists.
Both the element to set and the value are specified as additional arguments, not as options.
The elements that can be set are currently 'author', 'title', 'publisher', and 'rights'.
--opffile =item * --opf
Specifies the OPF file to modify. If not specified, the script will attempt to find one in the current directory.
--fileas
Specifies the 'file-as' attribute when setting an author. Has no effect on other elements.
Specifies the ID to assign to the element
ebook setmeta title 'My Great Title' ebook --opf newfile.opf setmeta author 'John Smith' --fileas 'Smith, John' --id mainauthor
splitmeta
Split the <metadata>...</metadata> block out of a pseudo-HTML file that contains one.
splitpre
Split <pre>...</pre> blocks out of an existing HTML file, wrapping each one found into a separate HTML file.
tidyxhtml
Run tidy on a HTML file to enforce valid XHTML output (required by the OPF 2.0 specification).
tidyxml
Run tidy an a XML file (for neatness).
unpack
Unpacks an ebook into its component parts, creating an OPF for them if necessary.
--filename
--file
-f
The filename of the ebook to unpack. This can also be specified as the first non-option argument, in which case it will override the option if it exists.
--dir
-d
The directory to unpack into, which will be created if it does not exist, defaulting to the filename with the extension removed. This can also be specified as the second non-option argument, in which case it will override the option if it exists.
--format
The unpacking routines should autodetect the type of book under normal conditions. If autodetection fails, a format can be forced here. See EBook::Tools::Unpack for a list of available formats.
--raw
This causes a lot of raw, unparsed, unmodified data to be dumped into the directory along with everything else. It's useful for debugging exactly what was in the file being unpacked, but not for much else.
Set the primary author of the unpacked e-book, overriding what is detected. Not all e-book formats contain author metadata, and if none is found and this is not specified the primary author will be set to 'Unknown Author'.
Set the title of the unpacked e-book, overriding what is detected. A title will always be detected in some form from the e-book, but the exact text can be overridden here.
The filename of the OPF metadata file that will be generated. If not specified, defaults to the title with a .opf extension.
--tidy
Run tidy on any HTML output files to convert them to valid XHTML. Be warned that this can occasionally change the formatting, as Tidy isn't very forgiving on certain common tricks (such as empty <pre> elements with style elements) that abuse the standard.
--tidycmd
The tidy executable name. This has to be a fully qualified pathname if tidy isn't on the path. Defaults to 'tidy'.
--tidysafety
The safety level to use when running tidy (default is 1). Potential values are:
$tidysafety < 1
No checks performed, no error files kept, works like a clean tidy -m
This setting is DANGEROUS!
$tidysafety == 1
Overwrites original file if there were no errors, but even if there were warnings. Keeps a log of errors, but not warnings.
$tidysafety == 2
Overwrites original file if there were no errors, but even if there were warnings. Keeps a log of both errors and warnings.
$tidysafety == 3
Overwrites original file only if there were no errors or warnings. Keeps a log of both errors and warnings.
$tidysafety
Never overwrites original file. Keeps a log of both errors and warnings.
ebook unpack mybook.pdb My_Book --author "By Me" ebook unpack -f mybook.pdb -d My_Book --author "By Me"
Both of the above commands do the same thing
ebook splitmeta book.html mybook.opf ebook tidyxhtml book.html ebook tidyxml mybook.opf ebook fix mybook.opf --oeb12 --mobi ebook genepub ebook blank newbook.opf --title "My Title" --author "My Name" ebook adddoc myfile.html ebook fix newbook.opf --opf20 -v ebook genepub ebook unpack mybook.pdb my_book cd my_book ebook addoc new_document.html ebook fix ebook genepub
documentation is incomplete
Copyright 2008 Zed Pobre
Licensed to the public under the terms of the GNU GPL, version 2.
2 POD Errors
The following errors were encountered while parsing the POD:
'=item' outside of any '=over'
You forgot a '=back' before '=head3'
To install EBook::Tools, copy and paste the appropriate command in to your terminal.
cpanm
cpanm EBook::Tools
CPAN shell
perl -MCPAN -e shell install EBook::Tools
For more information on module installation, please visit the detailed CPAN module installation guide.