![]() |
#1 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 126
Karma: 2167
Join Date: Oct 2005
Location: Houston, Texas
Device: ipad 1, Nook Simple Touch, Kindle 3, ebookwise 1150
|
EPUB --> PDF: problems adding custom headers
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 Code:
HEADER style DIV class=even P MY TEXT p DIV class = odd /HEADER 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 |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You need < and > in your templates like this <header><div>my text</div></header>
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 126
Karma: 2167
Join Date: Oct 2005
Location: Houston, Texas
Device: ipad 1, Nook Simple Touch, Kindle 3, ebookwise 1150
|
UPDATE: Yes, I removed the < and > from the forum comment -- I omitted it from the first post because I knew it gets mangled in forum posts.
With 3 different valid epubs, your simpler header code worked in the conversion. That tells me that the problem is not with calibre or the environment but with the specific file. After testing some more and adding the same file to calibre more than once, I see that a conversion failure will continue with the same file even if you correct or simplify the header code.. I.E., if I try a second time to convert after a failed conversion, it reliably continues to show errors (even if you correct the code snippet or leave it blank). The workaround is to add the epub again to calibre, and add correct header code again in the PDF OUTPUT. A fresh conversion always works. |
![]() |
![]() |
![]() |
#4 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,047
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
The forum will NOT mangle those if put into [code] tags (the # on the advanced screen. IMHO Calibre posters should hide the Quick reply and have the forums set to Advanced. It just offers MORE icons to use and still allows simple use elsewhen )
|
![]() |
![]() |
![]() |
Tags |
calibre, conversion from .pdf |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help adding a custom news source (PDF) needed. | inte | Recipes | 2 | 11-09-2017 04:22 AM |
Epub to PDF can't remove page breaks between headers | Vykan12 | Calibre | 11 | 07-25-2012 03:01 AM |
problems adding cover to epub | thaKing | Calibre | 5 | 07-06-2011 10:17 PM |
PDF to ePub conversion issue - headers getting left in | deadSkip | Calibre | 7 | 07-09-2010 02:07 AM |
Evading headers in PDF->EPUB conversion | davef | Calibre | 6 | 08-29-2009 03:26 PM |