Closed (fixed)
Project:
Book PDF
Version:
1.0.1
Component:
Documentation
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
13 Sep 2024 at 04:48 UTC
Updated:
21 Aug 2025 at 10:49 UTC
Jump to comment: Most recent
on the printed version of pdf, is anyone else noticing duplicated H1/H2/H3 (titles?)
TBD
TBD
TBD
TBD
TBD
N/A
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
joseph.olstadmight benot related to something I'm doing in#3443839: Fix two major PDF caching bugs and add Optional Book TOC, optional CSS styles
Comment #3
joseph.olstadThis was a theming issue.
I resolved by copying this twig from the book module:
book-node-export-html.html.twig
to my theme templates/ folder
and then overriding the twig, removing the H1 entry.
Then using theme debug, I created this twig from the suggestions
node--book--print.html.twig
and made my changes.
Comment #4
joseph.olstadactually, could add a little snippet about this in the README
Comment #5
joseph.olstadTo get more control of the PDF generated html start by enabling your theme debug in your
sites/default/services.ymlAdd this code:
in
modules/contrib/book_pdf/src/EventSubscriber/BookPdfPreGenerateSubscriber.phpjust after $bookHtml is instantiated in the code.
Rebuild caches
You'll have to search for theme debug in the rendered output
Mine was
node.html.twigcomming from a parent themeThere's several theming suggestions.
One of them is :
node--book--print.html.twigI modified the twig as desired.
There is another twig also that I modified, this one is provided by core.
core/modules/book/templates/book-node-export-html.html.twigThere were no theme suggestions available, however I simply copied this twig to my custom theme templates/book folder.
Then I modified this twig, in my case, I removed the H1 in this twig.
Adjust your twigs as desired.
Comment #6
joseph.olstadComment #8
joseph.olstadhttps://git.drupalcode.org/project/book_pdf/-/merge_requests/7.patch
Comment #9
joseph.olstadhttps://git.drupalcode.org/project/book_pdf/-/merge_requests/7.patch
Comment #10
joseph.olstadThis README.md is ready
Comment #11
joseph.olstadComment #14
rattusrattus commented