Code gets truncated when exporting to PDF #1379

Open
opened 2026-02-05 00:44:18 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @janaelliott on GitHub (Sep 24, 2019).

Describe the bug
When exporting a page to PDF, code that is too long to fit in one line gets truncated.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Go to page
  2. Select Export > PDF File

Code in BookStack
Bookstack page

Code in Export
Bookstack page export

Expected behavior
The text should break into the next line.

Your Configuration (please complete the following information):

  • Exact BookStack Version (Found in settings): v0.27.4
  • PHP Version: 7.2
  • Hosting Method (Nginx/Apache/Docker): Apache
Originally created by @janaelliott on GitHub (Sep 24, 2019). **Describe the bug** When exporting a page to PDF, code that is too long to fit in one line gets truncated. **Steps To Reproduce** Steps to reproduce the behavior: 1. Go to page 2. Select Export > PDF File **Code in BookStack** ![Bookstack page](https://user-images.githubusercontent.com/54837407/65514688-b7872b00-ded5-11e9-993e-e7f232eece12.png) **Code in Export** ![Bookstack page export](https://user-images.githubusercontent.com/54837407/65514703-bb1ab200-ded5-11e9-8711-dee40c5a8c62.png) **Expected behavior** The text should break into the next line. **Your Configuration (please complete the following information):** - Exact BookStack Version (Found in settings): v0.27.4 - PHP Version: 7.2 - Hosting Method (Nginx/Apache/Docker): Apache
OVERLORD added the 🐛 Bug🎨 Design🚚 Export System labels 2026-02-05 00:44:18 +03:00
Author
Owner

@thesugarat commented on GitHub (Apr 22, 2020):

Can I "second" this issue? I'm on the latest version and found this just now. Was hoping for any easy way to export and PDF looked to be the best option but this truncating will push me towards .html option. Which is cool too. Just like PDF option to work for code. Thanks

@thesugarat commented on GitHub (Apr 22, 2020): Can I "second" this issue? I'm on the latest version and found this just now. Was hoping for any easy way to export and PDF looked to be the best option but this truncating will push me towards .html option. Which is cool too. Just like PDF option to work for code. Thanks
Author
Owner

@ssddanbrown commented on GitHub (Apr 26, 2020):

Just been testing this,
From my testing I found, On the current BookStack version (v0.29) that:

When using the default PDF renderer (DomPDF):

  • Code becomes wrapped if there are spaces in the content.
  • Code gets cut-off if there are no spaces and the line exceeds the page width.

When using the WKHTMLtoPDF render:

  • Code is wrapped if there are spaces or even if there are no spaces.

I've tried quite a few things to get it fully working via the default DomPDF render but it's tricky, it does not seem to support the word-break rule unless it's applied inline on the element, which is a level of content parsing/conversion I don't want to get into.

If you wish for better PDF output in general, I'd advise using the wkhtmltopdf render instead:
https://www.bookstackapp.com/docs/admin/pdf-rendering/

@ssddanbrown commented on GitHub (Apr 26, 2020): Just been testing this, From my testing I found, On the current BookStack version (v0.29) that: **When using the default PDF renderer (DomPDF):** * Code becomes wrapped if there are spaces in the content. * Code gets cut-off if there are no spaces and the line exceeds the page width. **When using the [WKHTMLtoPDF render](https://www.bookstackapp.com/docs/admin/pdf-rendering/):** * Code is wrapped if there are spaces or even if there are no spaces. --- I've tried quite a few things to get it fully working via the default DomPDF render but it's tricky, it does not seem to support the word-break rule unless it's applied inline on the element, which is a level of content parsing/conversion I don't want to get into. If you wish for better PDF output in general, I'd advise using the wkhtmltopdf render instead: https://www.bookstackapp.com/docs/admin/pdf-rendering/
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1379