Quantcast
Channel: MobileRead Forums - Conversion
Viewing all articles
Browse latest Browse all 3900

EPUB --> PDF: problems adding custom headers

$
0
0
I had a problem adding a header when converting from EPUB to PDF. I'm on Windows 10 version 4.8

I create my valid epubs via docbook/html, but I use Calibre (instead of Docbook) to create on the fly PDFs for Advance Reading Copies from my epubs. When doing the conversion, I have used Calibre to add a header that says "Pre-release Version" or "Advance Reading Copy".

In previous versions I just added text to the Headers field in the PDF Output configuration options. But apparently when I do so, it gives an error message (See below).

Looking at the manual for the headers/footers, I see that you need to include some HTML and variables such as _TITLE_ and _AUTHOR_

When I tried using the sample code on the calibre docs, everything converted cleanly. But if I substituted my personalized text it produces an error.

Code:

HEADER style
  DIV class=even
  MY TEXT
  DIV class = odd
/HEADER

or

Code:

HEADER style
  DIV class=even
    P
        MY TEXT
    p
  DIV class = odd
/HEADER

Is there documentation about how to edit code for headers/footers for PDF output in Calibre to include custom text?

PS, I never realized that this tool has an editor. I plan to try it!


*************************************

calibre 4.8 embedded-python: True is64bit: False
Windows-10-10.0.18362-SP0 Windows ('32bit', 'WindowsPE')
....
Trimming u'OEBPS/cover.xhtml' from manifest
Trimming u'OEBPS/toc.ncx' from manifest
Creating PDF Output...
Converting input as a text based book...
The cover image has an id != "cover". Renaming to work around bug in Nook Color
Python function terminated unexpectedly
list index out of range (Error Code: 1)
Traceback (most recent call last):
File "site.py", line 114, in main
File "site.py", line 88, in run_entry_point
File "site-packages\calibre\utils\ipc\worker.py", line 209, in main
File "site-packages\calibre\gui2\convert\gui_conversion.py", line 43, in gui_convert_override
File "site-packages\calibre\gui2\convert\gui_conversion.py", line 28, in gui_convert
File "site-packages\calibre\ebooks\conversion\plumber.py", line 1275, in run
File "site-packages\calibre\ebooks\conversion\plugins\pdf_out put.py", line 188, in convert
File "site-packages\calibre\ebooks\conversion\plugins\pdf_out put.py", line 255, in convert_text
File "site-packages\calibre\ebooks\pdf\html_writer.py", line 1211, in convert
File "site-packages\calibre\ebooks\pdf\html_writer.py", line 1093, in add_header_footer
File "site-packages\calibre\ebooks\pdf\html_writer.py", line 1074, in format_template
File "src/lxml/etree.pyx", line 1165, in lxml.etree._Element.__getitem__
IndexError: list index out of range

Viewing all articles
Browse latest Browse all 3900

Trending Articles