Saturday, December 21, 2013

calibre's ebook editor

calibre has been an excellent ebook managing and viewing software for sometime now. But we intend to live up to our slogan, making calibre the "one stop solution to all your ebook needs". To this end we have recently (since calibre 1.15) added ebook editing capabilities for ebooks in EPUB and AZW3 formats. The editor interface was made more user friendly in calibre 1.16. To avail of the features described below you will need calibre 1.16 or a newer version. To make a few small changes like highlighting, changing font colors, using bold or italics fonts, inserting images and underlining requires almost no knowledge of HTML coding. There are GUI buttons that insert the code for you when you click on them. calibre makes these things as simple as button pushing.

In spite of the top layer of simplicity, the editor is very powerful. Those of you who know HTML coding can do a lot more. This blog post is directed towards rather lay users and will explain how to do a few simple but very useful things in detail.


To edit an EPUB or AZW3 format ebook in calibre just select the ebook in the main calibre window and right click. As you can see in the picture below many options appear:




Click on "Edit book" (the second option from the bottom). A new window opens. It looks like



As it says on the center of the window "Double click on a file on the left to start editing it".

The ebook I am going to use as an example is a recipe book made using the "Recipe Reader" plugin in calibre. For more details about the plugin you can also check out the plugin's mobileread page. With the holidays coming up you may find this category of plugins useful. I like to make notes on recipes I have used for future reference and calibre's ebook editing feature allows me to do just that as I will demonstrate.

If you double click on the first file listed in the left column called titlepage.xhtml.You see the following:




The right column now shows the cover/title page and the middle column shows the HTML code for it. The right column is a live preview. That means that very time you make any changes to the HTML code in the middle column, the effect on the ebook itself will be visible in the right column. Don't be intimidated by the HTML code. calibre makes dealing with it really easy. If you still feeling nervous, note that the very first button in the toolbar in the middle column is an undo button. Also none of the changes you make will be saved till you explicitly tell calibre to save them by clicking the save icon


in the top toolbar.  Still feeling nervous, the first time you use this editor make a copy of the book in calibre and work on the copy.

Now getting down to the action. Let us start with editing some simple text. The following is a picture of the toolbar in the center column.

From left to right the buttons are "Insert image", "Bold", "Italics", "Strike through", "Subscript", "Superscript", "Font color" and "Background color".

Lets start with a demonstration of using the font color button. For this purpose I have selected the third file in the left column:


Now say you want to add a note in red next to "1 egg" in the first line of the ebook on the right. How do you go about finding it in the HTML code. Simple, click on "Search" to the left of "Help" in the topmost toolbar in the window. A number of options show up and I click the first one called "Find/Replace" and you see:


As you can see a "Find" section shows up at the bottom of the middle column. Enter the word "egg" to find the relevant part of the HTML code. If egg happens to appear in few different places in the recipe you could be more specific and enter "1 egg" for example. Now let us will add a little note in red. Put the cursor next to egg and click the font color button and choose the red color. Some additional code appears. Without changing the position of the cursor enter the text you want. This is what it looks like:


The live preview on the right shows what the changes you made will look like in the ebook.
To change the color of already existing text just select the text in the HTML code and click the font color button and choose the color. Similarly to make some text into bold just select it and click the bold button.


On doing so, as you can see from the picture above, the text in the HTML code as well as in the ebook are converted in to bold format. Same for italics.

To highlight a bit of text select the text in the HTML code  and click on the background color button and choose the highlight color. The following picture shows a bit of text highlighted purple. The code as in all previous cases is automatically inserted on clicking the appropriate button.



Now for inserting pictures. To insert a picture click on the insert picture button in the toolbar. The following window opens up:




the window shows the images that are already a part of the ebook. You can reinsert one of those images or you can click "Import image". If you click on "Import image" it lets you choose a picture from your file system. Once you choose an image this is what you see: (This picture is taken from Wikipedia and is not of pancakes that I made :). )




The required HTML code is automatically inserted by calibre. Only there is a little problem here. As you can see the paragraph starting with "Batter" begins right next to the picture and you may prefer that it start on the next line. To fix this just enter
</p> <p>
before the word "Batter" in the HTML code as shown in the picture below.


The calibre ebook editor also allows you do some simple image editing. Double click on an image you want to edit from the list of images in the left column and it will open in the middle column as shown below.


 The image editor lets you do simple things like trim, rotate and resize images. You can also select a small section of the image with your mouse as shown below:


Then you can paste another image into it. Just copy the image from else where and then click on the paste button in the editor toolbar. I have used this procedure to paste two images in to the cover image of this ebook. the result is:


These are some of the simple and most useful things the new ebook editor feature can do. We will be adding more features but if you want to edit ebooks this should help you get started. Dive in and enjoy yourself.

Happy Holidays everyone!

Thursday, August 22, 2013

Here it is calibre 1.0 in all it's glory

calibre 1.0 has just been released. It took us only 7 years to get here ;). Yes, we are only a little more than 2 months away from calibre's 7th birthday. This is a big moment, so allow us to indulge in a few lines of nostalgia before we go into all the cool stuff that calibre 1.0 brings.

calibre started life on 31 October, 2006, soon after the release of the SONY PRS-500, the first e-ink based reader to be sold commercially in the US. This was accomplished with the help of the fine folks over at mobileread.com (A big thank you to you guys for your support over the years). calibre was then called  libprs500. At the time there were no satisfactory tools to convert content into the LRF format, used by the SONY reader, so Kovid Goyal decided to implement a converter to convert the most popular e-book formats to LRF. This converter proved to be wildly popular. 

As Kovid's e-book collection grew, he realized that managing it was quickly becoming unwieldy, so he decided to write a graphical interface to libprs500. 
At this point (mid 2008) libprs500 was renamed to calibre (Converter And LIBRary for Ebooks) . The libre in calibre stands for freedom, indicating that calibre is a free and open source product, modifiable by all. Nonetheless, calibre should be pronounced as cali-ber, not ca-libre. People often ask why, so I'll clarify. It is because Kovid wanted a regular English word that most people would know. He grew up in India where we are taught English (UK) in schools and that is how calibre is spelled in English (UK). For more details on the choice of the name click here.

Ok enough with the speeches. Let's get to the exciting stuff. A comprehensive list of features added since 0.9.0 is here. Lets look at some of them in detail. 


  • Cover Grid : Judge ebooks by their covers ;)This the most recent feature to be introduced. It allows you to view your ebook collection as a grid of covers. This is what it looks like:To see the cover grid click the "grid of squares" icon at the bottom right corner of the main window (left of Jobs). As it is with most calibre features many aspects of the cover grid can be customized. Go to preferences -> Look and Feel and you will see a new tab labeled "Cover Grid". Click on it and this is what you see:


    As you can see in the figure above, you can choose:
    If the title should be displayed below the covers in the grid.


    Spacing between covers: calibre chooses the spacing between covers automatically based on       your screen size. However you can customize it by typing in a spacing of your choice as I have entered 0.5cm here. 


    Background color: The default is grey (see first figure) but you can change it to any color of your choice by clicking the "change color" button. I have chosen pink here, the effect of  which you can see in the next figure with a cover grid.


    Cover sizes: calibre chooses the cover sizes automatically based on your screen size, however you can customize that by clicking on "Larger" or "Smaller" covers. In the cover grid displayed in this post I clicked on  "Larger covers". You can also enter the size you like by typing it in.

  • A new, faster database backend 
    The database backend in calibre has been re-written from scratch. The new code is smaller, more robust and 2-3 times as fast as the old code. No pretty pictures for this, but those of you that have large book collections should appreciate the speed.

  • Allow adding images into the comments field, by clicking on the insert link button in the comments editor in the edit metadata dialog. [0.9.44]
    In the "Edit Metadata" window if you click on the comments section the following button in the rows of buttons above it becomes active: 
    Click on it and the following window opens:

    Now click on "Browse" to choose the image on your computer you wish to use.Then click OK. The caveat is that if you move the image on your computer to a new location then you will have to redo this. The image I chose is High Sunderland Hall. Here is how the second image will appear under "Book Details" (right most column of main window)  in the main calibre window when the book is selected:



    To be able to see the image in the book details you have to go to Preferences -> Look and Feel -> Book Details and make sure "Comments" is selected.

  • Conversion: Add option to embed all referenced fonts [0.9.37]
    Add an option to embed all fonts that are referenced in the input document but are not already embedded. This will search your system for the referenced font, and if found, the font will be embedded. Only works if the output format supports font embedding (for example: EPUB or AZW3). The option is under the Look & Feel section of the conversion dialog.


  • Conversion of Microsoft Word documents (.docx files generated by Word 2007 or newer) [0.9.34]
    DOCX files created with Microsoft Word 2007 or newer can now be converted by calibre. The converter has support for lists, tables, images, all types of text formatting, footnotes, endnotes and even dropcaps. A sample docx file showing the capabilities of the converter is available:
    http://calibre-ebook.com/downloads/demos/demo.docx

    Here is a picture of  a page from the demo document in docx format converted to epub by calibre:



    Notice how well it preserves the formatting.


  • Allow adding user specified icons to the main book list for books whose metadata matches specific criteria. [0.9.17]

     
    Go to Preferences -> Look & Feel  and you will see a tab called "Column icons". Click on it and the following window opens:

    Click on add a rule and you see:



    The rules work in the same way as the column coloring rules. After adding the rule shown in the image above the library looks like this:


    Notice the little pink heart next to the titles of the the two ebooks in the list that have the Romance tag.
  • Complete rewrite of the PDF Output engine, to support links and fix various bugs [0.9.13]

  • 64 bit build for windows [0.9.9]
    calibre now has a 64 bit version for windows, available at: http://calibre-ebook.com/download_windows64 . You can have both the 32 bit and the 64 bit build installed at the same time, they will use the same libraries, plugins and settings.
Hope you enjoy all the features calibre 1.0 offers :)

Wednesday, July 31, 2013

ebooks of web content and virtual libraries

This blog post will discuss a class of plugins that allow you to make ebooks of content from the web, like chosen Wikipedia pages and recipe pages from sites like cooks.com, bigoven.com, foodnetwork and allrecipes as well as the calibre virtual libraries feature.

make your own ebooks from web content


The internet makes a lot of information available at your fingertips. But sometimes it is too much to take in at once, or not in a form convenient to use.

recipe books

For example taking you laptop to the kitchen to follow recipes from websites like cooks.combigoven.comfoodnetwork and allrecipes is not always convenient. However if you could put together a number of recipes from these sites into an ebook and load it on to your ebook reader it would make life a lot easier. There are plugins in calibre that allow you to do exactly this. Plugins for these websites can be downloaded directly from calibre following the procedure described in the section "Getting the find duplicates plugin" of  the blog post  "calibre plugins: duplicate finder". They can also be obtained from the mobile read website. Just click on Recipe Reader, BigOven Recipe Reader, Food Network Recipe Reader and all recipes Recipe Reader to download the plugin from mobileread or to get details about it.

The gist is:
Create an ebook of recipes from from the particular recipe website whose plugin you have downloaded by entering the urls of interest

Main Features
  • Create ebook of recipes
  • Give the ebook a title of your choice
  • Use generated table of contents to go to particular recipe

Special Notes: Requires calibre version 0.8.58 or later.

Usage
  • Click plugin button
  • Enter a title for the ebook (optional)
  • If you do not enter a title, the title will be the same as that of the first recipe
  • Enter URL of recipe.
  • To enter another URL click "Add another URL" and enter the URL in the field that appears
  • Repeat till you have entered all the URLs you want
  • Click OK

ebooks of Wikipedia pages

Wikipedia has a lot of useful information to offer. Some of their articles are quite long and/or related to many other articles. A plugin exists for creating an ebook for multiple Wikipedia pages. For example you could create an an ebook of the biographies of British writers like Charles Dickens, Bernard Shaw, Agatha Christie and J. K. Rowling from their respective Wikipedia pages and put it on your ebook reader and read about them at leisure or even while travelling. Here is a link to the Wiki Reader plugin page on mobileread. The Ebook created by the plugin will have a table of contents with the main headings being the names of the pages chosen and a substructure same as the table of contents as on the Wikipedia page. The details are similar to the Recipe Reader plugins and available on the Wiki Reader plugin page on mobileread.



virtual libraries


Virtual libraries allow you to conveniently manage a subset of your library. The virtual library button has been available since calibre 0.9.28. It is at the top left corner of the main calibre window under the main toolbar.



This feature used to be called 'Search restriction'. The new virtual libraries are easier to use, but otherwise fulfill the same function. Lets consider an example to explore this feature.

In the following example I tag ebooks created by the user (say using the above mentioned plugins) as "Compiled". Say I want to manage my "compiled" ebooks today, fix their metadata etc. I can do that by isolating them in to a separate virtual library. How do I do this?



Click on the virtual library icon and in the drop down menu that shows up click on "Create Virtual Library". Now a new window opens that allows you to create a virtual library based on commonly used parameters like Authors, Tags, series etc by just clicking on the appropriate parameter. If you want to create a more unusual virtual library (like books added in last 50 days) you can type in the Virtual library name and Search expression. For details on how to enter search expressions and how powerful these searches can be see the user manual page on the subject.
In this example however I have already tagged the ebooks of interest as "compiled", so I just click on "Tags" and a smaller window with all the tags listed opens over the previous one.

Now I just select the "Compiled" tag from the list. You can choose multiple tags and create the virtual library with books containing either any or all the tags of choice. Just select the appropriate option. If using a single tag this choice does not matter.

So here is the virtual library of compiled ebooks that can now be managed in isolation.


The recipe ebooks compiled using the some of the 4 recipe reader plugins mentioned above are tagged in red using column coloring feature discussed here. As you can see there are 5 of them and the tag browser shows that too.

Now say that you had just used the compiled tag to isolate the compiled ebooks instead of using virtual libraries. Then you would see,


where while there are only 5 "compiled" recipes again, the tag browser shows 7. This is because the tag browser shows the number of ebooks tagged recipes in the entire library (compiled or otherwise) and not just those displayed with the "compiled" tag. So, a virtual library is different from a simple search. A search will only restrict the list of books shown in the book list. A virtual library does that, and in addition it also restricts the entries shown in the Tag Browser to the left. A virtual library thus behaves as though the actual library contains only the restricted set of books.

what else can you do?


  • You can edit a previously created virtual library or remove it, by clicking the Virtual Library and choosing the appropriate action.
  • You can tell calibre that you always want to apply a particular virtual library when the current library is opened, by going to Preferences->Behavior.
  • If you use the calibre Content Server, you can have it share a virtual library instead of the full library by going to Preferences->Sharing over the net.
  • You can quickly use the current search as a temporary virtual library by clicking the Virtual Library button and choosing the *current search entry.

Hope you found the article useful. See you again when we have big news. 

Sunday, April 7, 2013

magic with TOC: edit or create a TOC for your documents or ebooks

Hope you enjoyed polishing and shining your e-books. Now let's look at more heavy duty stuff. The last post already detailed how you can get the "Edit TOC" button on the main toolbar. It is the rightmost button on the main toolbar in the figure below.


Create TOC:

If you have an e-book without a  Table of Contents (TOC),  but it is well structured with headings calibre allows you to create a TOC in a few simple steps.Consider the following "Example Ebook":



As you can see the e-book has no TOC, although it has headings and sub headings. Select the e-book in the main calibre window and click the "Edit TOC" button. A new window opens with the following options in the right side menu.



Click on "Generate TOC from all headings. The following TOC shows up in the editor window:


It has a well constructed TOC. Sometimes the headings in the ebook file are not well marked and some may be missing. In that case you can edit the generated TOC as explained in the next section.

Here is what the above generated TOC looks like in the calibre viewer:



Edit TOC:
So here I will start with a book that has an unsatisfactory TOC and play around with some of the available tools to make it better. This is just an example to show you some of the things you can do.


The above figure is a snapshot of the calibre viewer with the TOC of the e-book displayed. This TOC is messy as some chapters are subsets of others and although the chapters have names in the book, the TOC only lists chapter numbers. So lets see what we can do to spruce it up.


Select the e-book in the main calibre window and click the "Edit TOC" button. Then the above window opens up. Now as you can see Chapter II to Chapter XI are a part of Chapter I. Now say you want to make them independent chapters not belonging to Chapter I then select Chapter I and click the "Flatten this entry" button on the right hand side menu. Once you do this you will see:


If you now click "OK" and view the ebook the TOC looks like


As you can see in the two above figures Chapter II to Chapter XI are in the same level as Chapter I and not a part of it. But now say you want to make Chapter I to Chapter XI all members of Part I of the book. That too can be done.

In the "Edit TOC" window shown two figures above select "Preface". Then on the menu on the right, click "New entry below this entry". This takes you to the following window:


Move the mouse and position it just above Chapter one and left click. On the right hand side replace "(Untitled)" with "Part I" and click "OK". Now this is what you see.



To make Chapter I to Chapter XI  members of Part one just drag and drop them in to part one in the correct order. Then this is what you see.


Now if you click "OK" and open the book in the viewer you will see:


You can also edit the text for any of the entries in the TOC by double clicking the entry in the TOC editor window. As you can see below I have edited "Chapter I" to the name of the chapter in the book.




The following figure shows the TOC in the viewer with all the chapters in Part I with their proper names.


This articles outlines some of the things you can do with "Edit TOC". There are a few other options too. This should help you get started. Then enjoy tweaking and playing around with all the options. Feel free to leave comments about other interesting things you tried.

Thursday, April 4, 2013

this is the way to polish your e-books

Hi
It has been a while but again calibre has some great new features. So let us take a look at them. Here I will discuss "Polish Ebooks" introduced in 0.9.23 and next time "Edit TOC" introduced in 0.9.25. Note that polishing is only supported for books in AZW3 and EPUB formats. Hopefully any bugs that were present to start with have been ironed out. Your feedback is always welcome and since this is a fairly new feature, click here to report any bugs.

Adding the buttons:
To start with lets get the "Polish" and "Edit TOC" buttons, so we can click on them.. Go to "Preferences", click on "Toolbar", click on the button that says "Click to choose toolbar or menu to customize". In this case I have chosen "Main Toolbar" because I want the icons for "Polish" and "Edit TOC" to appear in the main toolbar so I can access them easily. If you think you wont use them too often you can have them on a secondary optional toolbar or wherever is convenient for you.
So after I click main toolbar the following window opens up:




On the left menu of available actions you will see the "Polish" and "Edit TOC" buttons highlighted by red rectangles in the above figure. They are towards the bottom of the menu so you may have to scroll down. Select them both. then click the right pointing blue arrow (circled in red in the above figure). This will move these icons from the available actions list to the current actions list. Click "Apply" on the top left corner and close your Preferences window. Now the added buttons will be included in the toolbar you chose. In this case in the main toolbar as shown below:



Polishing Options:

Select all the e-books to be polished in the same way and then click the polish icon in the main toolbar. The following window opens up:



The available options are outlined here.
You can:
  • Subset all embedded fonts
  • Smarten punctuation
  • Update metadata
  • Update cover
  • Add a metadata page at the start of the book
  • Remove a previously inserted metadata page
Many of these options were available earlier too, but to implement them you would have to convert the book again which for some e-books can be slow and CPU intensive. Now you can just spruce them up quickly because  polishing, unlike conversion, does not change the internal structure/markup of your book, it performs only the minimal set of actions needed to achieve its goals.
The "About" button next to each action gives details about exactly what the particular polishing tool achieves.

Subset all embedded fonts and Smarten punctuation:
This is just copied from the about section of "Subset all embedded fonts". The information is quite clear and I had nothing to add to it:

Similarly smarten punctuation simply converts plain text dashes, ellipsis, quotes, multiple hyphens, etc. into their typographically correct equivalents.
Caveat: The algorithm for "Smarten punctuation" can occasionally generate incorrect output.

Update metadata and Update cover in book files:
When you click "Edit Metadata" in calibre and change the metadata or the cover of a book the information is saved in a file called metadata.db in your calibre library. This information is only transferred to the particular book file when you convert the book or export it. However now this information can be updated in the book files by simply choosing the appropriate options in "Polish". Note there are separate buttons for updating the cover and for updating the rest of the metadata. The metadata that is updated will depend on what metadata the e-book format supports. Unfortunately many e-book formats do not support all the metadata that calibre allows you to store.

The following is a screen shot of calibre before "Update cover in book files" was done:



The e-book had been downloaded from Project Gutenberg.  then the metadata was edited to add the cover you can see on the right information panel of the main calibre window. But the polishing was not done so the the cover displayed when viewed was the generic cover page Project Gutenberg uses for all books.

Next we ran the "Update cover in book files" under "Polish" and voila,


the chosen cover is now the first page in the viewer.

Add metadata as book jacket page:

This allows you to add a book jacket containing all the metadata you added under "Edit Metadata" in calibre, including title, author, publisher, tags, comments, rating, series information etc. The book jacket page is always the very first page and precedes the cover page if there is one.

The following shows the book jacket for the book we have been using as an example so far:


The last option in "polish" is to remove the previously added book jacket in case you did not like it.

Coming soon:
In a week or two I will discuss the "Edit TOC" feature added in 0.9.25. It may still have a few bugs so let's give it some time to be straightened out. Also I have to go learn about it.

Hope you enjoyed this post. Have fun polishing away.