Skip to content

New: Add Markdown (.md) to Pdf conversion support#776

Open
huseyincancalti wants to merge 2 commits into
Tichau:integrationfrom
huseyincancalti:feature/md-to-pdf
Open

New: Add Markdown (.md) to Pdf conversion support#776
huseyincancalti wants to merge 2 commits into
Tichau:integrationfrom
huseyincancalti:feature/md-to-pdf

Conversation

@huseyincancalti

Copy link
Copy Markdown

Adds .md.pdf conversion, following the existing ConversionJob
pattern (modeled on ConversionJob_ImageMagick).

No matching upstream issue was found — searched Tichau/FileConverter for
markdown/.md-related requests; the closest hit (#773) asks for the
opposite direction (Excel/Docs/Text/PDF → Markdown), so it isn't
referenced here.

Pipeline: Markdig parses the Markdown into a syntax tree; that tree
is walked directly into QuestPDF's fluent document-composition API. No
HTML is generated or parsed as an intermediate step, since QuestPDF has
no HTML input — it exposes only its own C# composition API, so going
through HTML would mean parsing HTML back out for no benefit.

Why not a headless browser (Puppeteer/Chromium)? This project
bundles all its runtime dependencies at install time (see
ffmpeg/ghostscript under Middleware/) and works fully offline. A
headless-Chromium-based renderer downloads a ~300MB browser binary at
runtime, which breaks both of those properties. QuestPDF is a small,
pure-C# NuGet dependency resolved at build time like every other
package this project already uses — no extra runtime footprint, no
network access ever required.

Dependencies added:

  • Markdig 1.3.2 — BSD-2-Clause
  • QuestPDF 2026.7.0 — Community license (free for OSI-licensed
    open-source projects; this project is GPL-3.0, which qualifies).
    Used here under that Community license for this open-source
    contribution.

Testing: built with zero new warnings; manually converted a
Markdown file covering headings, nested lists, an ordered list, a
fenced code block, a table, and inline formatting, and confirmed the
output PDF renders correctly.

Parse Markdown with Markdig and compose the PDF directly from its
syntax tree via QuestPDF, avoiding an HTML round-trip and a headless
browser dependency.
Product.wxs enumerates every shipped DLL manually; the new NuGet
dependencies were missing from that list, so the installed app threw
a TypeInitializationException on ConversionJob_Markdown despite
working fine when run from the raw build output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant