# Converting pdf with table of content to Kindle format

To convert the pdf using Calbre I use :
Save To Disk -> Save Only MOBI format to disk
-Once saved the folder location of converted file should open.
Send converted file to kindle via email


When I convert the pdf file using Calibre this an .opf is generated, what is use of this file ?

The file I'm trying to convert is http://doc.akka.io/docs/akka/2.4.2/AkkaScala.pdf and does contain a table of contents that are navigable.

I've also tried converting using :http://ebook.online-convert.com/convert-to-mobi

But in both cases the table of contents navigate is not functional, clicking an item in TOC redirects to beginning of TOC.

How to convert pdf file to kindle format and maintain shortcut links to each of the file sections ?

• OP, you can read a PDF on a Kindle but the content of the PDF just won't reflow to fit the screen. Do you want to just read the PDF, or have the content reflow too? – Bulrush Jun 28 '16 at 14:49
• I have not found a reliable PDF to EPUB/MOBI convertor yet. So I usually convert the PDF to text, then put it in a Markdown file, and clean it up by hand. Then convert the Markdown files to EPUB. My MD2EPUB convertor already puts in a TOC based on <hN> headers. – Bulrush Jun 28 '16 at 14:51

A few quick thoughts.

First, if you are using a Kindle Fire tablet, there is no need to do a conversion. just download a PDF Reader app from the app store and read the file that way.

If you are using an eink Kindle, I would suggest sending the PDF to the Kindle Personal Document Service which will do the conversion for you. (It's free and a cool feature in your kindle account):

https://www.amazon.com/gp/help/customer/display.html/ref=hp_pdoc_main_short_us?nodeId=200767340

I haven't really looked at PDF conversions from the PDS; I'm guessing it will look really ugly. But I suspect the Kindle conversions to PDF are better than calibre's (although calibre might let you fine tune it). Using Kindle eink to read PDFs is usually a disappointing experience unless the document is short and very simple.

I glanced at the document. (I have made similar kinds of documents using Docbook XML). This document was optimized for PDF; you will lose a lot of formatting by trying to convert it -- though ironically it's pretty easy to convert it from Docbook XML to epub files.

To answer your question, the .opf is a file that stores epub metadata; apparently calibre needs to convert the PDF first to epub, and then reconvert it to the kindle .mobi format. That's why the end result is so horrifying.

• I'm using kindle paper white and have updated question with this tag. The 'Kindle Personal Document Service' is automatically invoked when sending a pdf to kindle email associated with device ? – blue-sky Jun 14 '16 at 18:27
• Yes, if you email to the kindle device, KPDS will handle it. amazon.com/gp/help/customer/display.html/… . – idiotprogrammer Jun 14 '16 at 19:19
• thanks but converting the pdf to mobi prior to e-mail to device instead of e-mailing the pdf has yielded much better results for me. – blue-sky Jun 14 '16 at 19:35

To answer your first question. The .opf file holds the metadata that Calibre extracts from the (PDF) file when adding it to Calibre, as well as that metadata that you decide to edit on (author, title, series, etc).

For some formats like ePub this metadata is almost taken verbatim and inserted in one of the files that are zipped into the ePub container. For other files like PDF this cannot all be stored in the original file and hence has to be stored separately.

Try this approach:

1. Convert the PDF to Latex
2. Modify the code (if necessary).
3. Change the paper size (probably A5) in the code and export it to Kindle or PDF format.