Answered
by
dosubot
bot
Return to top
-
Is there a way to render a PDF file based on editor's value on the server? I found no documentation on it, only a client-side example by rendering canvas first and then using pdf-lib, which is not the best UX |
Beta Was this translation helpful? Give feedback.
Answered by
dosubot[bot]
Jun 20, 2025
Replies: 1 comment 1 reply
-
And if there is no built-in way to do this at the moment, what will be a better way to do this? Using headless browser for this feels like an overkill |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's no built-in way to do server-side PDF rendering in the open-source Plate codebase. The recommended open approach is to use Plate's static rendering (PlateStatic/serializeHtml) to generate HTML on the server, then convert that HTML to PDF using a tool like Puppeteer or Playwright. This does require a headless browser, but it's the most reliable way to preserve layout and styles for complex content. Direct PDF libraries (like pdf-lib or jsPDF) can't match the fidelity for rich documents. If you want to avoid a headless browser entirely, you could try libraries like pdfmake or node-html-pdf, but they often struggle with advanced HTML/CSS and may not give good results for Plate content.