PDF Export Unknown Error Occurred (font missing?) #897

Closed
opened 2026-02-04 22:45:49 +03:00 by OVERLORD · 7 comments
Owner

Originally created by @boxcomrob on GitHub (Nov 8, 2018).

Describe the bug
When I try to export a page as a PDF, it shows "Unknown error occurred"
ErrorException (E_WARNING) fopen(/home/[redacted]/BookStack/app/vendor/dompdf/dompdf/lib/fonts//73a648e04197eba26eb65837ab386447.ufm): failed to open stream: No such file or directory

Steps To Reproduce
Steps to reproduce the behavior:

  1. Create a page (can be blank)
  2. Click Export > PDF
  3. See error

Expected behavior
Export a PDF file of the current page

Your Configuration (please complete the following information):

  • Exact BookStack Version (Found in settings): BookStack v0.24.1
  • PHP Version: 7.0
  • Hosting Method (Nginx/Apache/Docker): LiteSpeed

Additional context
The content of this install was migrated from another testing server to this production one (same version) following the guides here: https://www.bookstackapp.com/docs/admin/backup-restore/
Only the URL has changed (I updated it in the database and .env where needed), but remains in the same format, This was otherwise a clean fresh install from Git.

From browsing my folder structure, the location reported in the error message is the wrong location. My folder structure does not seem to include the /app/ section at the beginning. The fonts (not one by the referenced name though) exist in: BookStack/vendor/dompdf/dompdf/lib/fonts
Where should I update this path?

Originally created by @boxcomrob on GitHub (Nov 8, 2018). **Describe the bug** When I try to export a page as a PDF, it shows "Unknown error occurred" `ErrorException (E_WARNING) fopen(/home/[redacted]/BookStack/app/vendor/dompdf/dompdf/lib/fonts//73a648e04197eba26eb65837ab386447.ufm): failed to open stream: No such file or directory` **Steps To Reproduce** Steps to reproduce the behavior: 1. Create a page (can be blank) 2. Click Export > PDF 3. See error **Expected behavior** Export a PDF file of the current page **Your Configuration (please complete the following information):** - Exact BookStack Version (Found in settings): BookStack v0.24.1 - PHP Version: 7.0 - Hosting Method (Nginx/Apache/Docker): LiteSpeed **Additional context** The content of this install was migrated from another testing server to this production one (same version) following the guides here: https://www.bookstackapp.com/docs/admin/backup-restore/ Only the URL has changed (I updated it in the database and .env where needed), but remains in the same format, This was otherwise a clean fresh install from Git. From browsing my folder structure, the location reported in the error message is the wrong location. My folder structure does not seem to include the /app/ section at the beginning. The fonts (not one by the referenced name though) exist in: BookStack/vendor/dompdf/dompdf/lib/fonts Where should I update this path?
OVERLORD added the 🐛 Bug🚚 Export System labels 2026-02-04 22:45:49 +03:00
Author
Owner

@boxcomrob commented on GitHub (Nov 9, 2018):

Apologies I had missed #1097 when I posted this. Appears to be the same problem. Hopefully my additional info here about the paths will help both of us

@boxcomrob commented on GitHub (Nov 9, 2018): Apologies I had missed #1097 when I posted this. Appears to be the same problem. Hopefully my additional info here about the paths will help both of us
Author
Owner

@boxcomrob commented on GitHub (Nov 22, 2018):

I just noticed a comment from "Derek" that I want to reply to, but I think he's deleted it?

He mentions using custom fonts with his issue which is the same as mine. It may be worth noting that I also use Google Fonts on my installation, however this has never been a problem in our test environment, only since moving to production. For what it's worth, the PDF export didn't seem to use the Google font, but something generic like Arial. My Google Font presumably is only applied to the front end using the following code so I don't think it would be related to this issue, but I'll post anyway:

<link href="https://fonts.googleapis.com/css?family=Roboto:300" rel="stylesheet">
<style>
body, button, input, select, label, textarea {
  font-family: 'Roboto', sans-serif;
}
.Codemirror, pre, #markdown-editor-input, .editor-toolbar, .code-base {
  font-family: monospace;
}
</style>
@boxcomrob commented on GitHub (Nov 22, 2018): I just noticed a comment from "Derek" that I want to reply to, but I think he's deleted it? He mentions using custom fonts with his issue which is the same as mine. It may be worth noting that I also use Google Fonts on my installation, however this has never been a problem in our test environment, only since moving to production. For what it's worth, the PDF export didn't seem to use the Google font, but something generic like Arial. My Google Font presumably is only applied to the front end using the following code so I don't think it would be related to this issue, but I'll post anyway: ``` <link href="https://fonts.googleapis.com/css?family=Roboto:300" rel="stylesheet"> <style> body, button, input, select, label, textarea { font-family: 'Roboto', sans-serif; } .Codemirror, pre, #markdown-editor-input, .editor-toolbar, .code-base { font-family: monospace; } </style> ```
Author
Owner

@aljawaid commented on GitHub (Nov 22, 2018):

#1097 #1107

@aljawaid commented on GitHub (Nov 22, 2018): #1097 #1107
Author
Owner

@derek-shnosh commented on GitHub (Nov 22, 2018):

@boxcomrob I did delete my post because I worked through the error I had posted about (regarding the PDF export failing because it couldn't locate the font resource).

I was calling on my custom fonts as follows;

<style>
  @font-face {
    font-family: 'FontName';
    src: url('../../../uploads/images/fonts/FontName.woff2') format('woff2'),
         url('../../../uploads/images/fonts/FontName.woff') format('woff'),
         url('../../../uploads/images/fonts/FontName.ttf') format('truetype');
    font-weight: bold;
    font-style: italic, oblique;
  }
</style>

To resolve, I changed the url entries as follows;

<style>
  @font-face {
    font-family: 'FontName';
    src: url('https://docs.domain.local/uploads/images/fonts/FontName.woff2') format('woff2'),
         url('https://docs.domain.local/uploads/images/fonts/FontName.woff') format('woff'),
         url('https://docs.domain.local/uploads/images/fonts/FontName.ttf') format('truetype');
    font-weight: bold;
    font-style: italic, oblique;
  }
</style>

However, as you stated, I am noticing that my custom (self-hosted) font is not embedded/exported properly during the PDF export. My issue differs from yours a bit, as custom fonts that I import from googleapi are exported just fine.

Try removing the link href to the stylesheet and import it within the <style></style> section, example;

<style>
  @import url(https://fonts.googleapis.com/css?family=Roboto);

  body, button, input, select, label, textarea {
    font-family: 'Roboto', sans-serif;
  }
  .Codemirror, pre, #markdown-editor-input, .editor-toolbar, .code-base {
    font-family: monospace;
  }
</style>
@derek-shnosh commented on GitHub (Nov 22, 2018): @boxcomrob I did delete my post because I worked through the error I had posted about (regarding the PDF export failing because it couldn't locate the font resource). I was calling on my custom fonts as follows; ```html <style> @font-face { font-family: 'FontName'; src: url('../../../uploads/images/fonts/FontName.woff2') format('woff2'), url('../../../uploads/images/fonts/FontName.woff') format('woff'), url('../../../uploads/images/fonts/FontName.ttf') format('truetype'); font-weight: bold; font-style: italic, oblique; } </style> ``` To resolve, I changed the `url` entries as follows; ```html <style> @font-face { font-family: 'FontName'; src: url('https://docs.domain.local/uploads/images/fonts/FontName.woff2') format('woff2'), url('https://docs.domain.local/uploads/images/fonts/FontName.woff') format('woff'), url('https://docs.domain.local/uploads/images/fonts/FontName.ttf') format('truetype'); font-weight: bold; font-style: italic, oblique; } </style> ``` However, as you stated, **I am noticing that my custom (self-hosted) font is not embedded/exported properly during the PDF export**. My issue differs from yours a bit, as custom fonts that I import from googleapi are exported just fine. Try removing the `link href` to the stylesheet and `import` it within the `<style></style>` section, example; ```html <style> @import url(https://fonts.googleapis.com/css?family=Roboto); body, button, input, select, label, textarea { font-family: 'Roboto', sans-serif; } .Codemirror, pre, #markdown-editor-input, .editor-toolbar, .code-base { font-family: monospace; } </style> ```
Author
Owner

@derek-shnosh commented on GitHub (Nov 29, 2018):

@boxcomrob did you give my suggestion a shot? I'm curious if it works for you.

@derek-shnosh commented on GitHub (Nov 29, 2018): @boxcomrob did you give my suggestion a shot? I'm curious if it works for you.
Author
Owner

@jkeyes commented on GitHub (May 17, 2020):

@derek-shnosh Your suggestion re @import worked for me, when I was faced with this exact issue.

@jkeyes commented on GitHub (May 17, 2020): @derek-shnosh Your suggestion re `@import` worked for me, when I was faced with this exact issue.
Author
Owner

@ssddanbrown commented on GitHub (Oct 19, 2022):

I'm going to close this off since handling of exports, and specifically the directories used for PDF generation, have changed since this was raised. Feel free to raise any new issues if needed, referencing this issue if relevant.

@ssddanbrown commented on GitHub (Oct 19, 2022): I'm going to close this off since handling of exports, and specifically the directories used for PDF generation, have changed since this was raised. Feel free to raise any new issues if needed, referencing this issue if relevant.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#897