Monday, February 14, 2011

EPUB Straight to the Point - in other languages

EPUB Straight to the Point in GermanI just got a note from a reader in Germany who bought EPUB für iPad & Co:Ebooks erstellen und optimieren von Text bis Multimedia, the German translation of my EPUB Straight to the Point, published by Addison-Wesley Buch with an ISBN of 978-3-8273-3051-2. He wanted a copy of my new Fixed Layout miniguide. After I sent it to him (it's free to anyone who's bought a copy of my book, from any store, in any language), I went to find the German edition, which I didn't realize was already for sale. It's for sale on Amazon.de, among other places.

Martijn with Dutch EPUB Straight to the PointThere's also a Dutch edition. I know this because the Dutch translator sent me a photo! It's published by Pearson Education Uitgeverij and is called Aan de slag met ePub. Its ISBN is 9789043022163.

EPUB Straight to the Point, in FrenchThe prize for first translation, however, goes to Pearson in France for the French edition, Créez des documents ePub: Concevoir des livres électroniques pour iPad et autres liseuses, both in print and in EPUB, without DRM! Awesome!


Do you have a foreign language edition of EPUB Straight to the Point? I'd love to hear about it, and what you think of it.

Thursday, February 10, 2011

Page Breaks, Turning off Hyphenation, and Horizontal Bolding Bug in iBooks

Apple came out with version 1.2.1 of the iBooks app yesterday and though I haven't had a chance to look at it carefully, I have been hearing from Twitter that the page-break bug that I mentioned in Page Breaks in iBooks 1.2 —in which the CSS page-break properties had to be in a local stylesheet within the XHTML file instead of in an external CSS file—has been fixed. External CSS now works as it should. Yay.

The second thing that I wanted to mention was that iBooks 1.2 is a bit bossy with its new hyphenation feature and applies it automatically to every paragraph in your document. But, you probably don't want to have hyphenations in your headers.

Bad hyphens

To suppress hyphenation, you can use the -webkit-hyphens property (Thanks, Rick!) just on your header elements:

h1, h2, h3 {-webkit-hyphens:none;}

Finally, I've just noticed something very strange in iBooks. When I hold a book vertically, my headers are in a normal weight.



But when I hold it horizontally, the headers are suddenly displayed in boldface.

Horizontal = bold

I can't quite figure out why this might be. There is no font-weight assigned to the header elements at all. Seems like a bug to me. Lord knows I've certainly tried to achieve different layouts in different orientations!

Wednesday, February 9, 2011

Fixed Layout EPUBs for iPad and iPhone

In December, Apple released version 1.2 of iBooks, their ereader app for iPad, iPhone, and iPod Touch. There were a number of interesting features added, including support for hyphenation and page breaks, but the feature that caught most eyes was the ability to create “fixed layout” books in which text and images could be precisely positioned in horizontal two-page spreads in order to approximate a children's book or other image-heavy non-fiction book.

I'm not completely convinced by the idea of fixed layout books. I find them complicated to lay out and not much more useful than a PDF for reading the content. They lack EPUBs most important feature: the ability to reflow when the size and font of the text are changed.

On the other hand, they do let you make really beautiful pages in an EPUB-format file!

Two Page Spread in Fixed Layout EPUB in iBooks on iPad

And since people have repeatedly asked me to explain how to create these fixed-layout books, I took advantage of the opportunity to do something I've been wanting to try for a while: publish a miniguide companion to my EPUB Straight to the Point book. This miniguide explains everything you need to know in order to created fixed layout EPUB files with spreads, images, and embedded fonts.

If you already own a copy of my EPUB Straight to the Point book, I'll email you the miniguide free of charge. In fact, it may already be in your inbox. If you don't receive it automatically, just drop me a line, with your name, email, and proof of purchase, and I'll get you a copy.

If you haven't bought my book, you can buy the Fixed Layouts miniguide separately for $4. As a bonus, you will receive a $4 coupon toward the purchase of my EPUB Straight to the Point book. The only catch is I can currently only offer you the $4 coupon if you buy the EPUB version of the book from my site. The coupon won't be valid anywhere else (but I'm working on it).

Got any questions? Let me know. As always, I'd love to hear what you think.

Friday, January 14, 2011

Expandable Photo Blocks in iBooks on iPad

I am working on a project for a photographer that has a lot of beautiful photographs set up in tables. I've been trying to figure out how to get them to display all on the same iBooks page, AND shrink to a smaller width page, AND expand when I double-click them, all while not messing up the surrounding flowable text, so that the book can still be read.

I thought about using non-linear objects, and it almost works. And I also copied the use of maps and areas from the Discover travel series, but I realized that they only work when the iPad is held vertically. The map rectangles don't work when held horizontally. So that, while clever, was out.

But a combination of iBooks' new appreciation for page breaks along with the display:inline-block property, and a careful application of image sizing did the trick. If I do say so myself, it's quite lovely and I think would be an asset to any image-heavy ebook on the iPad, iPhone, or iTouch.

Here's what a block of photos looks like, both in vertical, and horizontal orientations of the iPad:
photo table - horizontal orientation

Photo table - vertical orientation iBooks 1.2

Then, the reader just has to double-click a photo to view the full size:
Expanded photo from photo table in iBooks

A second double-click returns them to the regular page.

The cool thing is that thanks to iBooks' support for page-break-inside, the photos stay together, and form a coherent and attractive block.

There are a number of things to keep in mind while coding.

1. Because iBooks doesn't support changing the size of an image directly, you have to enclose each img tag in a separate div. I gave each of these divs the class of "imgshrinker" since that's what they do.

The HTML code looks like this:
<div class="tablephoto">
    <div class="imgshrinker"><img src="images/sign.jpg" alt="" /></div><div class="imgshrinker"><img src="images/sitemarkers.jpg" alt="" /></div><br /><div class="imgshrinker"><img src="images/moreview.jpg" alt="" /></div><div class="imgshrinker"><img src="images/stones.jpg" alt="" /></div><br /><div class="imgshrinker"><img src="images/stone.jpg" alt="" /></div><div class="imgshrinker"><img src="images/housesite.jpg" alt="" /></div><br /><div class="imgshrinker"><img src="images/viewfromsite.jpg" alt=""/></div><div class="imgshrinker"><img src="images/wenttowoods.jpg" alt="" /></div>
</div>


Note that because I'm creating a grid of two columns and four rows I have nothing between the first two divs and a line break between the second and third. Nothing between photos three and four. Line break between four and five. And so on.

There is also a wrapper div for the entire table, with a class of "tablephoto". I'll use this to keep the photos together on the same page. (See step 3.)

2. Next, I use CSS to reduce the size of each img-containing div (the ones with class imgshrinker) to 47% of the width of the page (so that two photos will fit on each row). I add !important just in case. I then set the width of the img tags themselves to be 100% (of their parent element, which is the div set to 47%. The code looks like this:
 .imgshrinker {width:46% !important;
display:inline-block;padding: 1px}
.imgshrinker img {width: 100% !important}

3. I then add a bit of code to the CSS to keep the table together. I'll use the page-break-inside property, which iBooks 1.2 supports, despite its omission from Apple's guidelines.

.tablephoto {page-break-inside: avoid}

4. Also note that I cropped the photos to 1600 x 1200.This might seem excessive since in a table of two by four in a screen area about 600 pixels x 860 the largest width the image might need is about 300 pixels (half of 600) by 215 pixels (a quarter of 860). However, you want to use a larger image so that when the reader double-clicks it, it will fill the iPad screen. It's also important to choose a proportion that fits nicely in the table you create. For example, if you crop your photos to a portrait orientation, they won't work as well in a table shaped like mine.

Finally, Apple's guidelines suggest that photos be no larger than 2 million pixels (multiply height times width to get this figure).1600 x 1200 = 1,920,000 so I'm OK on that account. I also compressed them with JPEG low for this example so they wouldn't take up so much space, but that's up to you. (Apple suggests no more than 10mb of uncompressed image data per chapter.)

You can download the EPUB file to see the code for yourself. The photos are in chapter 2 on the third or fourth page. I have not epubchecked the file, so don't expect it to be totally clean!

Wednesday, January 12, 2011

Printing Notes from iBooks on iPad

One of iBooks 1.2 new features is the ability to print or email notes that you've made. There was a bit of interest in notes on Quora this morning (with which I've been experimenting) so I thought I'd talk a bit more about them here.

First, how do you insert a note? Simple. Just select some text with your finger, and then click Note in the pop-up menu that appears.

Create Note in iBooks 1.2 on iPad

If you're reading a non-DRM protected book, you'll also have the option of copying the text. I like to copy the referenced text first and copy it into the note so that when I email or print the note, I can remember where the note came from. I have found that if you first copy the highlighted text and then press very close to the beginning of the selection, you'll be offered the opportunity to create a note as well, where you can then paste the copied selection. (Click anywhere else and you'll have to select the text again.)

Creating a note in iBooks 1.2 on iPad

Click outside of the note to close it. The referenced text is highlighted and a little post-it note with the date appears in the margin. If you click the note, you can change the highlight color or delete the note entirely.

Note created in iBooks 1.2 on iPad


To email or print notes, go to the table of contents by clicking the bulleted list icon next to the Library button in the upper-left corner.



You can preview the notes (and bookmarks) by clicking the Bookmarks tab, but it's not required.

And then click the "Away" button in the upper-right corner. You'll have the choice to either email or print the notes.



But what if you have an oldish printer like me? Can you really print? I was under the impression that you could share a printer with any computer on your network, simply by choosing the appropriate option in Print Preferences. But that doesn't work automatically from an iPad.

And Apple has released a technology called Airprint, but it only works with a select few HP printers. I talked to Epson and they just have a little app that lets you print photos from the iPad, and only if you have a wifi-enabled printer, which I don't.

Then I asked on Twitter, and within minutes, Gabriele Alese quickly pointed me to a tool called Airprint Activator. It somehow links up the printer sharing and Airprint capabilities and gave me access to my oldish Epson R200 from the iPad. Absolutely brilliant!

Printing from iPad

Thanks so much to Gabriele and to the folks at Netputing for making this possible!

More of my books