04-04-2021, 12:52 PM | #1 |
Zealot
Posts: 110
Karma: 16268
Join Date: Apr 2020
Device: none
|
Please Help Me Clean Up This Code
Hi,
Recently re-installed Windows on my PC. For converting to PDF...before I used some code to get custom headers. I lost the code I had used and I'm trying to re-create it now. In the PDF output dialog box there are two fields for custom headers and footers. Please can you help me to clean up this code I found so I can enter it correctly? I used to have the terms to enter there exactly as they should be entered, but since the Windows reinstall the only code left I could find is below - but it seems mixed with HTML. If I want to clean up the terms so that the unnecessary HTML is excised, what would it look like? HEADER: pdf_header_template: u'<header style="justify-content: flex-end; color: gray; font-size: x-small">\n <div class="even-page">_AUTHOR_</div>\n <div class="odd-page"><i>_SECTION_</i></div>\n</header>' pdf_footer_template: u'<p style="text-align:center; color: gray; font-size: x-small"> _PAGENUM_</p>' Going in these two fields here: ibb.co/3k40sdg I'm working with 3.48 on 64 bit Windows machine. Thanks! Blaine Last edited by Blaineoreski; 04-05-2021 at 08:12 AM. |
04-04-2021, 12:55 PM | #2 |
Zealot
Posts: 110
Karma: 16268
Join Date: Apr 2020
Device: none
|
Got the answer! Just read the documentation.
|
Advert | |
|
04-04-2021, 01:14 PM | #3 |
Zealot
Posts: 110
Karma: 16268
Join Date: Apr 2020
Device: none
|
Ah! But...something's wrong - according to the documentation:
You can even put different content on even and odd pages, for example the following header template will show the title on odd pages and the author on even pages: <header style="justify-content: flex-end"> <div class="even-page">_AUTHOR_</div> <div class="odd-page"><i>_TITLE_</i></div> </header> calibre will automatically replace _TITLE_ and _AUTHOR_ with the title and author of the document being converted. Setting justify-content to flex-end will cause the text to be right aligned. BUT! Using that very code there put everything at the left? So! Please if I could re-request my request. Below was a SWEET kind of header that worked once for me, and for a long time. How can I apply it again? What should the code look like? pdf_header_template: u'<header style="justify-content: flex-end; color: gray; font-size: x-small">\n <div class="even-page">_AUTHOR_</div>\n <div class="odd-page"><i>_SECTION_</i></div>\n</header>' pdf_footer_template: u'<p style="text-align:center; color: gray; font-size: x-small"> _PAGENUM_</p>' |
04-04-2021, 01:32 PM | #4 |
Zealot
Posts: 110
Karma: 16268
Join Date: Apr 2020
Device: none
|
Also, please how can I set the distance from the edge of the page?
For the footer - using this code - it has like a half inch of blank space below the page number. Just like a printed book. <p style="text-align:center; color: gray; font-size: x-small"> _PAGENUM_</p> Using this code for the header, <header style="justify-content: flex-end; color: gray; font-size: x-small"><div class="odd-page"><i>_SECTION_</i></div></header> The text it right at the very edge of the top of the page. And, sadly on EVERY page, not just the odd pages as described. So, question is expanded: How to make the headers behave as described here: You can even put different content on even and odd pages, for example the following header template will show the title on odd pages and the author on even pages: <header style="justify-content: flex-end"> <div class="even-page">_AUTHOR_</div> <div class="odd-page"><i>_TITLE_</i></div> </header> calibre will automatically replace _TITLE_ and _AUTHOR_ with the title and author of the document being converted. Setting justify-content to flex-end will cause the text to be right aligned. Then, how to get the header, once it is working, to sit more in the center of the top margin. I tried to post images, but the BB code didn't work. And, direct links are stripped out. Sincerely, Blaine |
04-04-2021, 05:12 PM | #5 |
the rook, bossing Never.
Posts: 10,421
Karma: 82723493
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
export to RTF, docx, doc etc, something a wordprocessor understands.
Then set the page size in a Wordprocessor. You'll want at least two or three styles of page. Front matter, body, rear matter. Setup headers and footers etc. Check all the styles, fonts and layout suit paper. Export / Save As PDF. Older versions of Word need a plugin. LibreOffice from 5.x and later produce very good PDFs BTW, the ONLY use for a PDF of a novel is for Print on Demand. The epub is far superior as an eBook. PDFs are not eBooks, but either preview for print or a file for someone else to print. Portable Document Format. Note that paper prints and paper publishing need typically 300 dpi images at an actual size for the size of book. Traditionally ebooks use lower resolution and smaller images. Last edited by Quoth; 04-04-2021 at 05:15 PM. |
Advert | |
|
04-06-2021, 09:52 AM | #6 |
Zealot
Posts: 110
Karma: 16268
Join Date: Apr 2020
Device: none
|
Hi Quoth,
I need to use PDF. Can you see any reason for the error, or a way to fix it? Sincerely, Blaine |
04-06-2021, 09:57 AM | #7 |
creator of calibre
Posts: 43,662
Karma: 22446730
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The documentation doesnt work for calibre 3.x. The PDF output engine was re-written for calibre 4. I'm afraid that calibre 3 is too old, its going to be difficult to get support for it.
|
04-06-2021, 10:00 AM | #8 |
creator of calibre
Posts: 43,662
Karma: 22446730
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
04-06-2021, 10:20 AM | #9 |
the rook, bossing Never.
Posts: 10,421
Karma: 82723493
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word macro for clean HTML code | Toxaris | ePub | 135 | 02-28-2015 03:21 AM |
Saving/Opening without code clean-up | rpspringuel | Editor | 5 | 11-21-2014 06:49 PM |
Short Fiction Martinez, Brian: A Good Clean, A Harsh Clean. v1. PDF, 13th Dec 2010 | BrianMartinez | Other Books | 0 | 12-13-2010 10:27 PM |
Short Fiction Martinez, Brian: A Good Clean, A Harsh Clean. v1. 13th Dec 2010 | BrianMartinez | Kindle Books | 0 | 12-13-2010 10:25 PM |
Short Fiction Martinez, Brian: A Good Clean, A Harsh Clean. v1. 13th Dec 2010 | BrianMartinez | ePub Books | 0 | 12-13-2010 10:23 PM |