Fixed Layout
UNDER REVISION
Open Indesign File.
- Move type to its own layer
- export pages (backgrounds) to jpg (150 dpi)
- it is only technically necessary to export pages that are a) not full page or b) have more than one image. But it doesn't hurt to export all of them
- re-place new backgrounds in the InDesign file on their own layer
- Check back cover/drm from pdf. Add in additional pages if necessary
- Add in cover page at start (remember to unclick Allow Document Pages to Reshuffle)
- Note any rotated text. It is often better to straighten it and then re-rotate it in the epub using css
If longer and we want a ToC
- If Necessary: add page numbers to layer on master page -> style
- on pages palette, select all pages -> Overide All Parent Page Items
- Create ToC based on page number style
- tick Include Hidden Layers
- tick Create pdf Bookmarks
- place ToC on pasteboard
Export the publications as print pdf
- Export as Pages
- Tick Include: Bookmarks; Hyperlinks
Use script
-
Add cover image to pdf folder Run script.
- Copy fonts over to script folder
- Set options for page start
Re-Run script.
Open in Sigil
- Run its handy PageList plugin to generate the page list in nav.xhtml
- Open nav.xhtml and edit Landmarks and Contents if necessary
- Add in alt text (Usually by exporting the spreadsheet and reimporting)
- Edit content.opf to update title, author etc. metadata and accessibility metadata
- Reorder the
<p>s so their order marches the intended reading order - Add
<h1>s etc. if it is a non-fiction title (see below for css) - Change titles for Title page, Copyright, About the Author etc.
- add sections to above and put in aria roles.
- Thoroughly proof type to see if spans or italics etc. are causing any issues. For example occasionally type that is broken out of a sentence (italics, different font, coloured type etc.) will shift up a few pixels. Italics are moved to their own line and I usually delete the
`</p><p>to reintegrate the italics etc. using<i>or<em>
Notes and Issues
If the versos (odd number pages) are all streaky its because the recto has bled over onto that side of the spread. Sometimes by even the smallest amount...
Transparent type
(but still visible to screen readers) See Heading semantics
.visually-hidden {
position: absolute;
left: -9999px;
width: 1px;
height: 1px;
overflow: hidden;
white-space: nowrap
}
Hide from Screen readers
<div aria-hidden="true">
text
</div>
Obfuscated Fonts
If you export a TEMP epub from InDesign you can copy encrypted fonts over to your new file. This is necessary if the designer uses an exclusive Adobe font, but can be used for all the fonts unless you have to edit the text.
Version 1
This seems to work ok. It avoids having to edit the manifest and css.
- copy the encrypted fonts from the TEMP epub to the
fontfolder before running the script the second time - unzip the epub
- copy the
META-INF/encryption.xmlfile over- edit to remove the extra fonts (if necessary)
- copy the bookid identifier from the
content.opfof the original to the new file- e.g.
<dc:identifier id="bookid">urn:uuid:29d919dd-24f5-4384-be78-b447c9dc299b</dc:identifier>
- e.g.
- re-zip the file
Version 2
- unzip the epub
- copy the
META-INF/encryption.xmlfile over- edit to remove the extra fonts (if necessary)
- copy the bookid identifier from the
content.opfof the original to the new file- e.g.
<dc:identifier id="bookid">urn:uuid:29d919dd-24f5-4384-be78-b447c9dc299b</dc:identifier>
- e.g.
- copy the encrypted fonts over
- add them to manifest in the
content.opffile<item id="FONT_NAME.otf" href="font/FONT_NAME.otf" media-type="application/vnd.ms-opentype" />
- add css
@font-face { font-family: "FONT_NAME"; font-style: normal; font-weight: normal; src: url("../font/FONT_NAME.otf"); }
- re-zip the file
Build in a Fallback for kindle
See if you can get a similar font that is smaller to use in Kindle ebooks.
<p class="kindle">
@media amzn-kf8 {
.kindle {
font-family: supernett, serif;
font-style: normal;
}
}
Heading semantics
Note Apparently adding h1, h2 etc. DOES NOT WORK on kindle. Kindle will render the h1 using its defaults and override the styling.
Recommended:
Use a hidden heading and leave the styles text in the default <p> tags
Add aria-hidden="true" on the <div> to prevent teh title being read twice
<h1 class="visually-hidden">This_is_the_title</h1>
<div style="left:355.24px; top:58.32px; font-size:68.00px; font-family:'FONT_NAME'; color:#FFFFFF;" aria-hidden="true"><p>This is the title</p></div>
.visually-hidden {
position: absolute;
left: -9999px;
width: 1px;
height: 1px;
overflow: hidden;
white-space: nowrap
}
Rotated Text — Kindle
Like so many things Kindle does not always respect rotated text. This works ok most times but sometimes you have to move it just for kindle.
So I put a style in the div: <div class="rotated-element"> and transfer the rotation from the inline style to a style in the <head>
<style>
.rotated-element {
left: 210px;
top: -130px;
transform: rotate(12deg);
}
@media amzn-kf8, amzn-mobi {
.rotated-element {
left: 0;
top: 0;
transform: none;
}
}
</style>
DEPRECATED}
(Added automatically) If you add this to the styles.css it will neutralize the headings and then you can change internal heads, eg. <p> to <h2>:
div[style] p,
div[style] h1,
div[style] h2,
div[style] h3,
div[style] h4,
div[style] h5,
div[style] h6 {
all: unset;
display: inline;
}
Indesign script
move-to-layer.jsx - currently has ctrl-q as a shortcut.
//DESCRIPTION: Move Selection to Text Layer
// Moves selected items to a layer named "text"
// If the layer doesn't exist, it will be created
var doc = app.activeDocument;
var targetLayerName = "text";
var targetLayer;
// Check if the "text" layer exists
try {
targetLayer = doc.layers.item(targetLayerName);
// Try to access a property to confirm it exists
targetLayer.name;
} catch (e) {
// Layer doesn't exist, create it
targetLayer = doc.layers.add({name: targetLayerName});
}
// Make sure the target layer is visible and unlocked
// targetLayer.visible = true;
targetLayer.locked = false;
// Move all selected items to the text layer
for (var s = 0; s < app.selection.length; s++) {
app.selection[s].itemLayer = targetLayer;
}
OLD NOTES
- check metadata i.e. bookid
- NOTE Apple requires "Start of Content" as a landmark
- A Kindle fire’s largest screen is 1600 x 2560 pixels
- Note: CircularFlo moves the graphic frame below the text
Fixed Epub Code Fix
Get dimensions from page spread. Add to content.opf file:
<meta content="1304x1304" name="original-resolution" />
- Note it cannot have decimals i.e. content="1304.0x1304.0"
frame
Apple error:
"Invalid prefix attribute in root (package) element of the OPF file. Please supply a prefix attribute with valid rendition value in root package element of the OPF file" at Book/BookAssets" https://www.w3.org/TR/epub/#app-rendering-vocab
add rendition: http://www.idpf.org/vocab/rendition/# to prefix in package ???
see https://www.w3.org/TR/epub/#sec-metadata-reserved-prefixes
java error in epubcheck
Change url:
background-image:url('data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICR??AEAOw==');
to
background-image:('data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICR??AEAOw==');
Spreads
https://www.w3.org/TR/epub/#spread https://kdp.amazon.com/en_US/help/topic/GEGU359TQLKDJZZH
Kindle?
- Force landscape with spreads (both Render a synthetic spread regardless of device orientation.)
<meta property="rendition:layout">pre-paginated</meta>
<meta property="rendition:spread">both</meta>
<meta property="rendition:orientation">landscape</meta>
- For individual pages: in spine
<itemref idref="pg124" properties="rendition:spread-both"/>
Synthetic Spreads
Page 1
<body>
<img src="map-pt1.jpeg" alt="World Map (Page 1 of 2)" aria-details="map-desc" />
…
</body>
Page 2
<body>
<img src="map-pt2.jpeg" alt="World Map (Page 2 of 2). Refer to previous page for description." />
…
</body>
toc (TO CHECK)
<body>
<nav id="toc" epub:type="toc" role="doc-toc" aria-labelledby="nav_contents"><h1 id="nav_contents">Contents</h1>
<ol>
<li><a href="page_1.xhtml">Cover</a></li>
<li><a href="PAGE_XXX.xhtml">Digital Rights</a></li>
<li><a href="PAGE_XXX.xhtml">Title Page</a></li>
<li><a href="PAGE_XXX.xhtml">Start</a></li>
<li><a href="PAGE_XXX.xhtml">Copyright Page</a></li>
<li><a href="PAGE_XXX.xhtml">About the Author</a></li>
</ol></nav>
<nav epub:type="landmarks" id="landmarks"><h1>Landmarks</h1>
<ol>
<li><a epub:type="cover" href="page_1.xhtml">Cover</a></li>
<li><a epub:type="frontmatter" href="PAGE_XXX.xhtml">Statement of Digital Rights</a></li>
<li><a epub:type="bodymatter" href="PAGE_XXX.xhtml">The_TITLE</a></li>
<li><a epub:type="backmatter" href="PAGE_XXX.xhtml">About the Author</a></li>
</ol></nav>
</body>
opf Template (TO CHECK)
<dc:title id="title">The_TITLE</dc:title>
<meta property="file-as" refines="#title">TITLE, The</meta>
<meta property="title-type" refines="#title">main</meta>
<dc:title id="subtitle">THE_SUBTITLE</dc:title>
<meta property="title-type" refines="#subtitle">subtitle</meta>
<dc:title id="fulltitle">The_TITLE: THE_SUBTITLE</dc:title>
<meta property="file-as" refines="#fulltitle">TITLE: THE_SUBTITLE, The</meta>
<meta property="title-type" refines="#fulltitle">extended</meta>
<meta property="belongs-to-collection" id="id-1">Orca SERIES_TITLE</meta>
<meta refines="#id-1" property="collection-type">series</meta>
<meta refines="#id-1" property="group-position">1</meta>
<dc:creator id="creator1">AUTHOR_FIRST_AUTHOR_LAST</dc:creator>
<meta refines="#creator1" property="role" scheme="marc:relators">aut</meta>
<meta refines="#creator1" property="file-as">AUTHOR_LAST, AUTHOR_FIRST</meta>
<dc:creator id="illustrator1">ILLUS_FIRST_ILLUS_LAST</dc:creator>
<meta refines="#illustrator1" property="role" scheme="marc:relators">ill</meta>
<meta refines="#illustrator1" property="file-as">ILLUS_LAST, ILLUS_FIRST</meta>
<dc:identifier id="epubISBN">9780000000000</dc:identifier>
<dc:identifier id="bookid">urn:isbn:9780000000000</dc:identifier>
<dc:publisher>Orca Book Publishers</dc:publisher>
<dc:language>en-US</dc:language>
<dc:date>2024-MO-DA</dc:date>
<dc:rights>Copyright © Text INSERT_YEAR AUTHOR_NAME, Illustrations INSERT_YEAR ILLUS_NAME</dc:rights>
<dc:description>THIS_IS_THE_DESCRIPTION</dc:description>