1EBook::EPUB(3)        User Contributed Perl Documentation       EBook::EPUB(3)
2
3
4

NAME

6       EBook::EPUB - module for generating EPUB documents
7

VERSION

9       Version 0.6
10

SYNOPSIS

12           use EBook::EPUB;
13
14           # Create EPUB object
15           my $epub = EBook::EPUB->new;
16
17           # Set metadata: title/author/language/id
18           $epub->add_title('Three Men in a Boat');
19           $epub->add_author('Jerome K. Jerome');
20           $epub->add_language('en');
21           $epub->add_identifier('1440465908', 'ISBN');
22
23           # Add package content: stylesheet, font, xhtml and cover
24           $epub->copy_stylesheet('/path/to/style.css', 'style.css');
25           $epub->copy_file('/path/to/figure1.png',
26               'figure1.png', 'image/png');
27           $epub->encrypt_file('/path/to/CharisSILB.ttf',
28               'CharisSILB.ttf', 'application/x-font-ttf');
29           my $chapter_id = $epub->copy_xhtml('/path/to/page1.xhtml',
30               'page1.xhtml');
31           $epub->copy_xhtml('/path/to/notes.xhtml', 'notes.xhtml',
32               linear => 'no'
33           );
34
35           # Add top-level nav-point
36           my $navpoint = $epub->add_navpoint(
37                   label       => "Chapter 1",
38                   id          => $chapter_id,
39                   content     => 'page1.xhtml',
40                   play_order  => 1 # should always start with 1
41           );
42
43           # Add cover image
44           # Not actual epub standart but does the trick for iBooks
45           my $cover_id = $epub->copy_image('/path/to/cover.jpg', 'cover.jpg');
46           $epub->add_meta_item('cover', $cover_id);
47
48           # Generate resulting ebook
49           $epub->pack_zip('/path/to/three_men_in_a_boat.epub');
50

SUBROUTINES/METHODS

52       new([$params])
53           Create an EBook::EPUB object
54
55       add_title($title)
56           Set the title of the book
57
58       add_identifier($id, [$scheme])
59           Set a unique identifier for the book, such as its ISBN or a URL
60
61       add_author($name, [$formal_name])
62           Add author of the document. For details see add_contributor.
63
64       add_creator($name, [fileas => $formal_name, role => $role])
65           Add primary creator or author of the publication of the
66           publication. See add_contributor for details
67
68       add_contributor($name, [fileas => $formal_name, role =>])
69           Add person/organization that contributed to publication. $name is
70           the name in human-readable form, e.g. "Arthur Conan Doyle",
71           $formal_name is in form, suitable for machine processing, e.g.
72           "Doyle, Arthur Conan". $role reflects kind of contribution to
73           document. See Section 2.2.6 of OPF specification for list of
74           possible values
75           <http://www.idpf.org/2007/opf/OPF_2.0_final_spec.html#Section2.2.6>
76
77       add_coverage($coverage)
78           The extent or scope of the content of the resource.
79
80       add_date($date, [$event])
81           Date of publication, in the format defined by "Date and Time
82           Formats" at http://www.w3.org/TR/NOTE-datetime and by ISO 8601 on
83           which it is based. In particular, dates without times are
84           represented in the form YYYY[-MM[-DD]]: a required 4-digit year, an
85           optional 2-digit month, and if the month is given, an optional
86           2-digit day of month. $event is an optional description of event
87           that date refers to. Possible values may include: creation,
88           publication, and modification.
89
90       add_description($description)
91           Add description of the publication content
92
93       add_format($format)
94           The media type or dimensions of the resource. Best practice is to
95           use a value from a controlled vocabulary (e.g. MIME media types).
96
97       add_language($lang)
98           Add language of the content of the publication. $lang must comply
99           with RFC 3066 (see http://www.ietf.org/rfc/rfc3066.txt)
100
101       add_publisher($publisher)
102           An entity responsible for making the resource available
103
104       add_relation($relation)
105           An identifier of an auxiliary resource and its relationship to the
106           publication.
107
108       add_rights($rights)
109           A statement about rights, or a reference to one. In this
110           specification, the copyright notice and any further rights
111           description should appear directly.
112
113       add_source($source)
114           Information regarding a prior resource from which the publication
115           was derived
116
117       add_subject($subject)
118           Add subject of the publication
119
120       add_translator($name, [$formal_name])
121           Add translator of the document. $name is in human-readable form,
122           e.g. "Arthur Conan Doyle", $formal_name is in form, suitable for
123           machine processing, e.g.  "Doyle, Arthur Conan"
124
125       add_type($type)
126           type includes terms describing general categories, functions,
127           genres, or aggregation levels for content. The advised best
128           practice is to select a value from a controlled vocabulary.
129
130       add_navpoint(%opts)
131           Add refrence to an OPS Content Document that is a part of
132           publication. %opts is an anonymous hash, for possible key values
133           see EBook::EPUB::NCX::NavPoint.  Method returns created
134           EBook::EPUB::NCX::NavPoint object that could be used later for
135           adding subsections.
136
137       add_meta_item($name, $value)
138           Add non-standard item to metadata e.g. metadata from source
139           documetn that is not described in Doublin Core spec.
140
141       add_xhtml($filename, $data, %opts)
142           Add xhtml data $data to $filename in package. Returns id of newly
143           added entry.
144
145           %opts is an anonymous hash array of parameters:
146
147           linear  'yes' or 'no'
148
149       add_stylesheet($filename, $data)
150           Add stylesheet data $data as $filename in package. Returns id of
151           newly added entry.
152
153       add_image($filename, $data, $type)
154           Add image data $data as $filename in package with content type
155           $type (e.g. image/jpeg). Returns id of newly added entry.
156
157       copy_xhtml($source_file, $filename, %opts)
158           Add existing xhtml file $source_file as $filename in package.
159           Returns id of newly added entry.
160
161           %opts is an anonymous hash array of parameters:
162
163           linear  'yes' or 'no'
164
165       copy_stylesheet($source_file, $filename)
166           Add existing css file $source_file as $filename in package. Returns
167           id of newly added entry.
168
169       copy_image($source_file, $filename, $type)
170           Add existing image file $source_file as $filename in package and
171           set its content type to $type (e.g. image/jpeg). Returns id of
172           newly added entry.
173
174       copy_file($source_file, $filename, $type)
175           Add existing file $source_file as $filename in package and set its
176           content type to $type (e.g. text/plain). Returns id of newly
177           created entry. Returns id of newly added entry.
178
179       encrypt_file($source_file, $filename, $type)
180           Add existing file $source_file as $filename in package and set its
181           content type to $type (e.g. text/plain) Apply Adobe copy protection
182           scheme to this file using book UUID as a key. Function croaks if
183           key has not been set previously using. Returns id of newly added
184           entry.
185
186       pack_zip($filename)
187           Generate OCF Zip container with contents of current package
188

AUTHOR

190       Oleksandr Tymoshenko, <gonzo@bluezbox.com>
191

BUGS

193       Please report any bugs or feature requests to  <gonzo@bluezbox.com>
194
196       Copyright 2009, 2010 Oleksandr Tymoshenko.
197
198       <http://bluezbox.com>
199
200       This module is free software; you can redistribute it and/or modify it
201       under the terms of the BSD license. See the LICENSE file included with
202       this distribution.
203
204
205
206perl v5.38.0                      2023-07-20                    EBook::EPUB(3)
Impressum