- Issue created by @joseph.olstad
- 🇨🇦Canada joseph.olstad
I found a module called booktree , might inspire this idea. Could possibly "borrow" some code from the booktree module
- 🇨🇦Canada joseph.olstad
this patch is by no means ready, it is just a beginning.
It requires the booktree module installed and configured (for now).
eventually won't need the booktree module at all.
- Assigned to joseph.olstad
- 🇨🇦Canada joseph.olstad
patch from comment #6 actually works, but requires booktree to have been configured prior.
Next, clean this up to remove reliance on the booktree module configuration.
- Status changed to Needs review
8 months ago 3:58am 8 May 2024 - Issue was unassigned.
- Status changed to Needs work
8 months ago 12:05am 9 May 2024 - Assigned to joseph.olstad
- Status changed to Active
8 months ago 8:46pm 9 May 2024 - Status changed to RTBC
8 months ago 3:12am 10 May 2024 - Merge request !6Issue #3443839 by joseph.olstad: Book TOC (Table of Contents) → (Open) created by joseph.olstad
- Issue was unassigned.
- 🇬🇧United Kingdom rattusrattus
Hi joseph.olstad. Thanks very much for all your work on this.
I've taken a quick look through the MR. From what I can see, the the inclusion of a ToC is not configurable? I.e. users can't choose whether the PDF includes a ToC?
- 🇨🇦Canada joseph.olstad
ya it would be nice to have a configuration on/off option for the TOC. With that said, I'd imagine that will want it.
Sorry I haven't had any more time to work on this, it's working with the latest Merge request 6.
- 🇨🇦Canada joseph.olstad
here's a new patch, I haven't tested it, the idea is an optional TOC, defaulted to disabled.
- 🇨🇦Canada joseph.olstad
patch 27 didn't fix the book translation issue, hoping this might help
new patch and interdiff.
- 🇨🇦Canada joseph.olstad
patch 30 was insufficient but did not regress.
Here's a new patch that should resolve it (knock on wood).
- 🇨🇦Canada joseph.olstad
patch 31 is a regression (crashes), knock on wood again this time
new interdiff - 🇨🇦Canada joseph.olstad
Ok so I made a few discoveries with book_pdf 1.0.x-dev@dev , something changed in the drupal.org release system and with the dev branch and likely the next tagged branch of book_pdf they'll probably start forcing the requirement of the contrib book module which currently with Drupal 10.2.7 crashes.
- 🇨🇦Canada joseph.olstad
Patch 34 works with 1.0.x-dev@dev
Patch 36 is for 1.0.1 , but incomplete.Testing these, hoping I get it this time.
- 🇨🇦Canada joseph.olstad
Ok so it took a while to figure this out.
If a PDF was already generated, the returned PDF was a filename as follows [bid].pdf
I have a solution to ensure the cache of a PDF works correctly, it should probably also have the revision id in the filename as well as the langcode for the language version.
So, for english should actually be [bid]-[vid]-en.pdf
example: 1001-9991-en.pdf
1001 is the bid/node id
9991 is the revision id.
en is the language code for english.New patch to follow shortly.
- Status changed to Needs review
4 months ago 3:34am 12 August 2024 - 🇨🇦Canada joseph.olstad
ok once I have tested this to solve the issue, some cleanup could be done, although that could happen later on also. The most important thing is ensuring this works for everyone.
- 🇨🇦Canada joseph.olstad
ok, 38 led me to 40.
I have tested this, have a good look at the interdiff, it makes more sense now.
- 🇨🇦Canada joseph.olstad
Multiple fixes in this Merge Request.
Improves the PDF caching algorithm which fixed the localization support
Add revision support for the PDF caching algorithm so that new PDFs are generated for future versions of books otherwise the cache served up the originally cached pdf based on the node id only.ToC is optional and disabled by default.
- 🇨🇦Canada joseph.olstad
This works well.
It would be good to get merging on this, otherwise, I suppose I can keep pushing more into this one.
- 🇨🇦Canada joseph.olstad
I'm going to add another feature to this:
I will add a "Delete PDF cache" button and the handler logic for it.
- 🇨🇦Canada joseph.olstad
Now for a user defined splash page
a user defined header
a user defined footer - 🇨🇦Canada joseph.olstad
Ok the Merge Request is in good shape.
With that said, I've forked book_pdf into a new module called book_pdfs
I swapped out wkhtmltopdf for dompdf in book_pdfs, this is the reason for the fork.
- 🇨🇦Canada joseph.olstad
Ok so the dompdf version of this module called book_pdfs is in good shape with rc5, with that said, I'm going to switch back to book_pdf for now because wkhtmltopdf works better for very large multipage tables that get otherwise mangled by dompdf.
Unfortunately my clients content includes large multipage tables . These tables are rendered nicely with wkhtmltopdf.
so I'll review the merge request a bit more yet.
- Assigned to joseph.olstad
- Status changed to Active
about 2 months ago 3:29am 31 October 2024 - 🇨🇦Canada joseph.olstad
Found a regression that occurs when the Table of Contents is enabled.
Viewing the book node results in a WSOD if creating a book node without choosing an option from the "Book" select dropdown in the node edit form.
I will fix this bug soon.
Error message is as follows which occurs when viewing the new "book node":
Error: Call to a member function id() on null in Drupal\book_pdf\Controller\BooktreeController->tree() (line 24 of modules/contrib/book_pdf/src/Controller/BooktreeController.php).
Workaround :
when creating a new book node make sure to select SOMETHING from the "Book" dropdown select list before saving.