$book->addChapter("Chapter 2: Vivamus bibendum massa", "Chapter002.html", $content_start . "<h1>Chapter 2</h1>\n" . $chapter2);
// Chapter 2 contains an image reference "demo/DemoInlineImage.jpg" which we didn't get it to import
// automatically. So we will do that manually.
$log->logLine("Add referenced image from Chapter 2");
$book->addLargeFile("demo/DemoInlineImage.jpg", "DemoInlineImage", "demo/DemoInlineImage.jpg", "image/jpeg");
$log->logLine("Add Chapter 3");
$book->addChapter("Chapter 3: Vivamus bibendum massa again", "Chapter003.html", $chapter3);
// Autosplit a chapter:
$log->logLine("Add Chapter 4");
$book->setSplitSize(15000);
// For this test, we split at approx 15k. Default is 250000 had we left it alone.
$book->addChapter("Chapter 4: Vivamus bibendum massa split", "Chapter004.html", $chapter4, true);
$book->setSplitSize(250000);
$book->subLevel();
$book->addChapter("Chapter 4B: test inlined chapter", "Chapter004.html#sub01");
$book->backLevel();
// More advanced use of the splitter:
// Still using Chapter 4, but as you can see, "Chapter 4" also contains a header for Chapter 5.
require_once 'EPubChapterSplitter.php';
$log->logLine("include EPubChapterSplitter.php");
$splitter = new EPubChapterSplitter();
$splitter->setSplitSize(15000);
// For this test, we split at approx 15k. Default is 250000 had we left it alone.
$log->logLine("new EPubChapterSplitter()");
/* Using the # as regexp delimiter here, it makes writing the regexp easier.
 *  in this case we could have just searched for "Chapter ", or if we were using regexp '#^<h1>Chapter #i',
 *  using regular text (no regexp delimiters) will look for the text after the first tag. Meaning had we used
 *  "Chapter ", any paragraph or header starting with "Chapter " would have matched. The regexp equivalent of
 *  "Chapter " is '#^<.+?>Chapter #'
 * Essentially, the search strnig is looking for lines starting with...
 */