Monday, March 06, 2017

Print and eBook Compatable PDF Creation using LibreOffice

After discovering that PDF eBooks are popular, I set about creating PDF version of my two currently published books, with minimum of effort. The book chapters are HTML files which are imported into a LibreOffice master document. There are actually two master documents: one for the print edition with a table of contents and one for the ePub edition without. The master document for the print edition is exported as PDF and uploaded to LuLu for printing. The master document for the ePub edition is exported as an ODF Text document (ODT) and uploaded to Lulu for conversion to ePub.

The obvious thing to do was to export the Master document used for ePub as PDF. The conversion worked and there was an index included in the PDF file. However, the reader of a PDF file normally expects there to be a table of contents in the document, emulating a printed work. So I then tried exporting the master document used for the print PDF.

The print PDF document looked fine on screen, but the table of contents was not hypertext linked (unnecessary for the printed edition). The reader may have not realized PDF provides a separate table of contents. So I created a third master document with hypertext linked table of contents. But this would add an addition step and I realized I could simply include hypertext links in the table of contents of the master document intended for printed books. The hypertext links appear dark blue for on screen, so they can be seen. I decided not to include the usual underlining of hypertext links, so when rendered for the printed book, the reader can't see what was a link.
I have now implemented this for:

There is still a problem with some pages being blank
to allow correct pagination for print, which looks odd in an eBook.
There are ways to have a PDF reader ignore blank pages, but I have yet
to work out how.