PHP Classes

Long HTML problem

Recommend this page to a friend!

      EPub  >  All threads  >  Long HTML problem  >  (Un) Subscribe thread alerts  
Subject:Long HTML problem
Summary:Long HTML problem
Messages:3
Author:Petr ?muchálek
Date:2014-02-07 13:20:50
Update:2014-02-07 13:45:50
 

  1. Long HTML problem   Reply   Report abuse  
Picture of Petr ?muchálek Petr ?muchálek - 2014-02-07 13:20:50
Hello, I have book in HTML (in docx it have about 400 pages). There is only one capter. Epub convert some part of this long text, there are only 4 html about 256kB - is it some limitation of capter in ePub? Thank you

  2. Re: Long HTML problem   Reply   Report abuse  
Picture of Asbjorn Grandt Asbjorn Grandt - 2014-02-07 13:40:06 - In reply to message 1 from Petr ?muchálek
Especially older readers, and dedicated readers had/have limited memory, and the rule of thumb is to limit individual HTML pages to at most 256 kb each.

EPub split on this boundary by default, however you can override this with
$book->setSplitSize($newSplitSize);

The newSplitSize is in bytes.
You could just say $newSplitSize = strlen($data) * 2;

The *2 is simply because EPub may replace links, if the EXTERNAL_REF options are included, exceeding twice the original length will obviously never happen, and it costs nothing to set it that high.

Cheers

  3. Re: Long HTML problem   Reply   Report abuse  
Picture of Asbjorn Grandt Asbjorn Grandt - 2014-02-07 13:45:50 - In reply to message 1 from Petr ?muchálek
While docx have no real concept of chapters, you can use the HTMLChapterSplitter included in the EPub package, to split the html into chapters, looking for a common string, for instance "<h1" or similar.

See the EPub.Example1.php from about line 205 for an example usage.