setIPhoneOrientationLock() public static method

public static setIPhoneOrientationLock ( EPub $book, string $value )
$book PHPePub\Core\EPub
$value string "portrait-only", "landscape-only"
Beispiel #1
0
$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("720p");
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";
$cssData = "body {\n  margin-left: .5em;\n  margin-right: .5em;\n  text-align: justify;\n}\n\np {\n  font-family: serif;\n  font-size: 10pt;\n  text-align: justify;\n  text-indent: 1em;\n  margin-top: 0px;\n  margin-bottom: 1ex;\n}\n\nh1, h2 {\n  font-family: sans-serif;\n  font-style: italic;\n  text-align: center;\n  background-color: #6b879c;\n  color: white;\n  width: 100%;\n}\n\nh1 {\n    margin-bottom: 2px;\n}\n\nh2 {\n    margin-top: -2px;\n    margin-bottom: 2px;\n}\n";
$log->logLine("Add css");
$book->addCSSFile("styles.css", "css1", $cssData);
// This test requires you have an image, change "demo/cover-image.jpg" to match your location.
$log->logLine("Add Cover Image");
$book->setCoverImage("Cover.jpg", file_get_contents("demo/cover-image.jpg"), "image/jpeg");
// A better way is to let EPub handle the image itself, as it may need resizing. Most e-books are only about 600x800