I have one large .xhtml
file consisting of many chapters. There are div
tags with e.g. id="article2"
on some of them. I am now trying to make an ebook out of it. EBook::EPUB is a nice package that helps greatly.
And I have most of it working well. Alas, the following does not work:
for (my $cnt=1; $cnt<=$#chapters; ++$cnt) {
$epub->add_navpoint(
label => 'Chapter '.$cnt.": $memotitles[$cnt]",
id => 'article'.$cnt,
content => 'text.xhtml',
play_order => $cnt );
}
When I open the epub file in iBooks, it shows me the labels, but clicking on any of them does not move me to the right page in the epub file.
I know that it is possible to get ids from a book where each chapter is its own .xhtml
file. alas, is it possible to get ids to reference waypoints (chapters) from inside the same .xhtml
file? Or do I really have to break my large .xhtml
file into many smaller ones?
Advice appreciated.
"content" property should have id of the element in the xhtml page. So something like this should work:
for (my $cnt=1; $cnt<=$#chapters; ++$cnt) {
$epub->add_navpoint(
label => 'Chapter '.$cnt.": $memotitles[$cnt]",
id => 'article'.$cnt,
content => 'text.xhtml#article' . $cnt,
play_order => $cnt );
}