Skip to content

Step: Markdown to PDF

  • Key: markdown-to-pdf
  • Category: Utilities
  • Description: Convert Markdown content from the flow context into a PDF and return it as base64.

Inputs

  • markdownKey (select, required): Context key containing Markdown content. If the value is an object, the runtime uses markdown, then content, then a JSON string representation.
  • fileName (text, optional): Suggested file name. Defaults to document.pdf; .pdf is appended when missing.
  • title (text, optional): PDF document title metadata.

Outputs

  • base64 (text): Generated PDF file content as a base64 string.
  • mimeType (text): MIME type of the generated file.
  • fileName (text): Suggested PDF file name.
  • size (number): Generated file size in bytes.

Notes

  • The runtime renders GitHub-flavored Markdown, sanitizes the generated HTML, and prints it to A4 PDF.
  • External network requests from the generated document are blocked during rendering.
  • Use save-file after this step when you need a downloadable file link.

Example Use Case

  1. Use ask-to-llm or agent to generate Markdown and store it as report.markdown.
  2. Use markdown-to-pdf with markdownKey = "report.markdown" and fileName = "weekly-report.pdf".
  3. Return the base64 directly or save it with a file step.

Built with VitePress