Problem/Motivation

on the printed version of pdf, is anyone else noticing duplicated H1/H2/H3 (titles?)

Steps to reproduce

TBD

Proposed resolution

TBD

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

N/A

Issue fork book_pdf-3474072

Command icon Show commands

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

joseph.olstad created an issue. See original summary.

joseph.olstad’s picture

Assigned: Unassigned » joseph.olstad
joseph.olstad’s picture

Component: Miscellaneous » Documentation
Assigned: joseph.olstad » Unassigned
Status: Active » Fixed

This 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.

joseph.olstad’s picture

Status: Fixed » Needs review

actually, could add a little snippet about this in the README

joseph.olstad’s picture

To get more control of the PDF generated html start by enabling your theme debug in your sites/default/services.yml

Add this code:

echo print_r($bookHtml, TRUE);
die;

in modules/contrib/book_pdf/src/EventSubscriber/BookPdfPreGenerateSubscriber.php
just 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.twig comming from a parent theme

There's several theming suggestions.
One of them is : node--book--print.html.twig

I 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.twig

There 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.

joseph.olstad’s picture

Title: Duplicated H1/H2/H3s » Improve documentation - Duplicated H1/H2
Assigned: Unassigned » joseph.olstad

joseph.olstad’s picture

Assigned: joseph.olstad » Unassigned
Category: Support request » Task
Status: Needs review » Reviewed & tested by the community
joseph.olstad’s picture

Assigned: Unassigned » joseph.olstad
Category: Task » Support request
Status: Reviewed & tested by the community » Needs review
joseph.olstad’s picture

Assigned: joseph.olstad » Unassigned
Status: Needs review » Reviewed & tested by the community

This README.md is ready

joseph.olstad’s picture

Category: Support request » Task

rattusrattus made their first commit to this issue’s fork.

rattusrattus’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.