http://www.idpf.org/epub/fxl/#property-defs
Author: A. Grandt (php@grandt.com)
Beispiel #1
0
$book->setDate(time());
// Strictly not needed as the book date defaults to time().
$book->setRights("Copyright and licence information specific for the book.");
// As this is generated, this _could_ contain the name or licence information of the user who purchased the book, if needed. If this is used that way, the identifier must also be made unique for the book.
$book->setSourceURL("http://JohnJaneDoePublications.com/books/TestBookEPub3.xhtml");
$book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP");
$book->setSubject("Test book");
$book->setSubject("keywords");
$book->setSubject("Chapter levels");
// Insert custom meta data to the book, in this case, Calibre series index information.
CalibreHelper::setCalibreMetadata($book, "PHPePub Test books", "3");
// FIXED-LAYOUT METADATA (ONLY AVAILABLE IN EPUB3)
RenditionHelper::addPrefix($book);
RenditionHelper::setLayout($book, RenditionHelper::LAYOUT_PRE_PAGINATED);
RenditionHelper::setOrientation($book, RenditionHelper::ORIENTATION_AUTO);
RenditionHelper::setSpread($book, RenditionHelper::SPREAD_AUTO);
// Setting rendition parameters for fixed layout requires the user to add a viewport to each html file.
// It is up to the user to do this, however the cover image and toc files are generated by the EPub class, and need the information.
// It can be set multiple times if different viewports are needed for the cover image page and toc.
$book->setViewport(720, 1280);
IBooksHelper::addPrefix($book);
IBooksHelper::setIPadOrientationLock($book, IBooksHelper::ORIENTATION_PORTRAIT_ONLY);
IBooksHelper::setIPhoneOrientationLock($book, IBooksHelper::ORIENTATION_PORTRAIT_ONLY);
IBooksHelper::setSpecifiedFonts($book, true);
IBooksHelper::setFixedLayout($book, true);
$log->logLine("Set up parameters");
// Example.
// Create a test book for download.
// ePub 3 uses a variant of HTML5 called XHTML5
$content_start = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . "<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\">\n" . "\t<head>" . "\t\t<meta http-equiv=\"Default-Style\" content=\"text/html; charset=utf-8\" />\n" . $book->getViewportMetaLine() . "\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\" />\n" . "\t\t<title>Test Book</title>\n" . "\t</head>\n" . "\t<body>\n";
$bookEnd = "\t</body>\n</html>\n";