![]() |
#1 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Aug 2023
Device: reMarkable 2, Kobo Libra 2, kindle oasis, kindle 3/keyboard, nook
|
Disable H1 page breaks when converting Markdown to PDF
I'm trying to use the "ebook-convert" command to convert markdown files to PDF. I've got most of the details figured out, however something is forcing a page break in front of every H1 element.
Using the command with the output going to a directory instead of a file, shows me the files which would be sent to the PDF output plugin, and in the "stylesheet.css" file I see "page-break-before: always;" in the block for each element which was an "#" line in the input file. My first thought was to use the "--extra-css" option to add a custom stylesheet containing "h1 { page-break-before : auto ; }", however this doesn't appear to affect anything, either in the output directory, or in the generated PDF. In fact, I don't see this new line anywhere in the output directory at all. How can I disable the automatic page breaks before every H1 element? If it helps, under https://jms1.pub/reMarkable2/, "introduction.md" is a copy of the markdown file I'm trying to convert, and "introduction.pdf" (produced by Marked 2) is more or less what I'm trying to get "ebook-convert" to produce. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,337
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
--chapter=/
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Aug 2023
Device: reMarkable 2, Kobo Libra 2, kindle oasis, kindle 3/keyboard, nook
|
I just tried that ... still no change.
Under https://jms1.pub/calibre/ ... "go" is the actual script I'm running. I'm assuming you've done this once or twice before ![]() |
![]() |
![]() |
![]() |
#4 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,712
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Why do you want PDF? What's wrong with an ePub?
|
![]() |
![]() |
![]() |
#5 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Aug 2023
Device: reMarkable 2, Kobo Libra 2, kindle oasis, kindle 3/keyboard, nook
|
I'm creating files to read on a reMarkable 2 tablet, which allows EPUB files to be uploaded, but it converts them to PDF internally and the PDF is what it shows on the screen. The PDFs it produces look ... "less than great"?
This page explains that if you manually convert the EPUB to PDF before uploading it to the tablet, you'll be able to control things like fonts and sizes, line spacing, and margins, and be able to see exactly what the file is going to look like before you upload it ... since you won't be able to control those things from the tablet itself. Also, I'm a command line guy. Writing documentation which says "click this link, at the top right corner click this, enter this value, click this, on the next page find the text box labeled XXX, enter this value" and so forth is very tedious to me. My first thought was using "pandoc" to convert the files - this did work, however the PDF it produced looked even worse than what the tablet generates internally, so I gave in and wrote what you see on the page now. But then I remembered reading somewhere that Calibre has a command line tool to convert files between formats, so I found it, and now I'm trying to write a script that I can use to convert EPUBs to PDF, with consistent formatting options every time (and then add that script to the site for others to use, and to modify if they want their files to look different from what I like). With all that said (hey, you did ask ![]() |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,337
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
--page-breaks-before=/ --chapter=/
|
![]() |
![]() |
![]() |
#7 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Aug 2023
Device: reMarkable 2, Kobo Libra 2, kindle oasis, kindle 3/keyboard, nook
|
BEAUTIFUL. Thanks Kovid.
I'd like to think I would have eventually found that on my own, but it was after 1am here at the time, I probably wasn't thinking straight. Now I've had some sleep and some coffee, I see it right there in the "ebook-convert x.md x.pdf -h" output... |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Paragraph breaks become page breaks when converting to mobi | Allreader | Conversion | 6 | 07-19-2021 01:08 AM |
Help with assigning correct page breaks and page numbers to a textbook [converting fr | cateroseg | Calibre | 0 | 02-14-2018 10:32 PM |
Too many page breaks when converting from .azw3 to epub | Kaetrin | Conversion | 15 | 08-10-2016 03:00 AM |
Converting to PDF help? Bad page breaks and no TOC produced. | Jokerfwb | Conversion | 6 | 07-24-2012 10:36 PM |
Any way to force page breaks when converting HTML to EPUB | Bierkonig | Calibre | 23 | 10-31-2009 01:51 PM |