OfficeIMO.Markdown.Pdf
3.6.1
Prefix Reserved
dotnet add package OfficeIMO.Markdown.Pdf --version 3.6.1
NuGet\Install-Package OfficeIMO.Markdown.Pdf -Version 3.6.1
<PackageReference Include="OfficeIMO.Markdown.Pdf" Version="3.6.1" />
<PackageVersion Include="OfficeIMO.Markdown.Pdf" Version="3.6.1" />
<PackageReference Include="OfficeIMO.Markdown.Pdf" />
paket add OfficeIMO.Markdown.Pdf --version 3.6.1
#r "nuget: OfficeIMO.Markdown.Pdf, 3.6.1"
#:package OfficeIMO.Markdown.Pdf@3.6.1
#addin nuget:?package=OfficeIMO.Markdown.Pdf&version=3.6.1
#tool nuget:?package=OfficeIMO.Markdown.Pdf&version=3.6.1
OfficeIMO.Markdown.Pdf - Markdown to PDF export
OfficeIMO.Markdown.Pdf exports OfficeIMO.Markdown documents to PDF through the first-party OfficeIMO.Pdf engine. It is a thin adapter: Markdown parsing stays in OfficeIMO.Markdown, and PDF layout/writing stays in OfficeIMO.Pdf.
Internal links resolve heading anchors, generic block identifiers and supported inline anchor carriers. Destinations follow the rendered block; identifiers inside flattened table or list-item content target that render unit. Missing targets retain visible link text and add an UnresolvedInternalLink warning to the conversion report.
Install
dotnet add package OfficeIMO.Markdown.Pdf
Quick start
using OfficeIMO.Markdown;
using OfficeIMO.Markdown.Pdf;
MarkdownDocument document = MarkdownDocument.Parse("""
# Status
This is **important** and includes [OfficeIMO](https://github.com/EvotecIT/OfficeIMO).
| Area | State |
| --- | --- |
| PDF | Native |
""");
document.SaveAsPdf("status.pdf");
Raw Markdown text uses source-explicit names so it cannot be confused with HTML or RTF strings:
using OfficeIMO.Markdown.Pdf;
using var document = OfficeIMO.Markdown.MarkdownDocument.Parse("# Hello\n\nGenerated by OfficeIMO.");
document.SaveAsPdf("hello.pdf");
File-based conversion uses the native Markdown lifecycle so a string path is not confused with Markdown text:
MarkdownDocument.Load("README.md").SaveAsPdf("README.pdf");
Code, notes, and multilingual text
Fenced code retains leading and repeated spaces and tabs. Inline code and fenced code select Courier and share the configured monospace fallbacks. Footnote references are superscript links to definitions collected at the end of the document.
Default text fallbacks include installed multilingual fonts. Their availability and ResourcePolicy.AllowSystemFontEmbedding govern character coverage; TextFallbacks = PdfTextFallbackFeatures.None selects exact standard-font output.
Page images
Export PNG, JPEG, or SVG from the converted PDF document so images use its pagination, fonts, and layout:
using OfficeIMO.Pdf;
using var pdf = document.ToPdf(null, out OfficeIMO.OfficeConversionReport conversionReport);
pdf.SaveAsImages("pages");
pdf.SaveAsImages("jpeg-pages", new PdfImageExportOptions { Format = OfficeIMO.Drawing.OfficeImageExportFormat.Jpeg });
pdf.SaveAsImages("svg-pages", new PdfImageExportOptions { Format = OfficeIMO.Drawing.OfficeImageExportFormat.Svg });
SVG follows the PDF page renderer's vector and embedded-raster contract. Inspect the conversion report before rendering pages; each image export report contains rendering diagnostics.
Examples
Use front matter for metadata and theme selection
using OfficeIMO.Markdown.Pdf;
string markdown = """
---
title: Incident review
author: Operations
pdfTheme: TechnicalDocument
tags:
- incident
- review
---
# Incident review
## Summary
- Detection was automatic.
- Customer impact was limited.
- Follow-up tasks are tracked below.
| Task | Owner |
| --- | --- |
| Update monitor | Platform |
| Review runbook | Operations |
""";
OfficeIMO.Markdown.MarkdownDocument.Parse(markdown).SaveAsPdf("incident-review.pdf", new MarkdownPdfExportOptions {
UseFrontMatterMetadata = true,
UseFrontMatterTheme = true,
FrontMatterRenderMode = MarkdownPdfFrontMatterRenderMode.DocumentHeader
});
Convert a Markdown file with local images
using OfficeIMO.Markdown.Pdf;
using OfficeIMO.Pdf;
var options = new MarkdownPdfExportOptions {
BaseDirectory = Path.GetDirectoryName(Path.GetFullPath("Docs/status.md")),
IncludeImages = true,
ResourcePolicy = PdfResourcePolicy.CreateTrustedHost(),
DefaultImageWidth = OfficeIMO.OfficeLength.Points(420),
DefaultImageHeight = OfficeIMO.OfficeLength.Points(240),
Theme = OfficeIMO.Markdown.MarkdownVisualTheme.Report()
};
MarkdownDocument.Load("Docs/status.md").SaveAsPdf("Artifacts/status.pdf", options);
Reuse one visual theme across HTML, PDF, and Word
using OfficeIMO;
using OfficeIMO.Markdown;
using OfficeIMO.Markdown.Pdf;
using OfficeIMO.Word.Markdown;
MarkdownVisualTheme theme = MarkdownVisualTheme.FromOfficeTheme(OfficeTheme.Boardroom)
.WithColorScheme(MarkdownColorSchemeKind.Emerald)
.WithColors(accent: "SeaGreen", heading: "#064e3b")
.WithTable(table => {
table.BorderWidth = OfficeLength.Points(0.9);
table.CellPaddingX = OfficeLength.Points(8);
table.UseRowStripes = true;
});
using MarkdownDocument document = MarkdownDocument.Parse(markdown);
document.SaveAsHtml("report.html", new MarkdownHtmlExportOptions { Theme = theme });
document.SaveAsPdf("report.pdf", new MarkdownPdfExportOptions { Theme = theme });
using var word = document.ToWord(new MarkdownWordExportOptions { Theme = theme });
word.Save("report.docx");
FromOfficeTheme carries the shared fonts, type scale, colors, spacing, page margins and table defaults into each adapter. Format-specific options and authored emphasis, code and links retain their supported meaning. Plain conversion keeps its existing defaults until a theme is selected. Arbitrary inline CSS in Markdown is handled by the HTML engine rather than the direct Word and PDF adapters.
Write to bytes or streams
using OfficeIMO.Markdown;
using OfficeIMO.Markdown.Pdf;
MarkdownDocument document = MarkdownDocument.Parse("# Invoice notes\n\nGenerated by OfficeIMO.");
using var pdf = document.ToPdf();
byte[] pdfBytes = pdf.ToBytes(new OfficeIMO.Pdf.PdfSaveOptions { AllowLoss = true });
using var stream = File.Create("invoice-notes.pdf");
document.SaveAsPdf(stream);
Keep warnings visible
using OfficeIMO.Markdown.Pdf;
using OfficeIMO.Pdf;
var options = new MarkdownPdfExportOptions {
RemoteImageResolver = null,
IncludeImages = true
}.UseProfile(PdfExportProfile.Faithful);
options.TextFallbacks = PdfTextFallbackFeatures.Default;
MarkdownDocument document = MarkdownDocument.Load("README.md");
OfficeIMO.OfficeConversionReport report = document.SaveAsPdf("README.pdf", options);
foreach (OfficeIMO.OfficeDiagnostic diagnostic in report.Diagnostics) {
Console.WriteLine($"{diagnostic.Code}: {diagnostic.Message}");
}
report.ThrowIfLoss();
What it maps
- Headings with bookmark anchors and PDF outlines.
- PDF metadata from options, YAML front matter, or the first heading.
- Paragraphs, rich inline formatting, links, lists, task lists, tables, code blocks, semantic fenced blocks, callouts, details, definition lists, block quotes, footnotes, and generated table-of-contents blocks.
- Visual themes for readable document rhythm, page treatment, links, code blocks, panels, tables, and checklist rows.
- Profile presets through
MarkdownPdfExportOptions.UseProfile(...), plus sharedTextFallbacksandResourcePolicycontrols. Profiles may disable images for lightweight/text-only output but never grant local, remote, or host-font access. IncludeImagescontrols whether images participate at all.PdfResourcePolicyis the only trust gate for local files, data URIs, remote resolvers, and installed host fonts. Local-image containment resolves symlinks and junctions before reading.PdfTextFallbackFeatures.MultilingualFonts, included inDefault, selects multilingual fallback families. The balanced default permits installed-font discovery without granting local-file or remote-resource access; usePdfResourcePolicy.CreatePortableDeterministic()when host fonts must not be inspected.- Per-operation diagnostics through
OfficeConversionReport.
Visual themes
Conversion uses plain table formatting and authored column alignment by default.
Pass Theme, set ApplyDefaultTheme = true, or select a styled export profile
to add presentation styling. An explicit Style.TableStyle.RightAlignNumeric
can infer numeric alignment when that is wanted.
var options = new MarkdownPdfExportOptions {
Theme = OfficeIMO.Markdown.MarkdownVisualTheme.TechnicalDocument()
};
MarkdownDocument.Load("README.md").SaveAsPdf("README.pdf", options);
Built-in themes include Plain, WordLike, TechnicalDocument, GitHubLike, Compact, and Report. Front matter can select a theme with pdfTheme or pdf-theme.
MarkdownVisualTheme is the shared cross-format theme object. It accepts color schemes plus individual color overrides using either hex values such as #064e3b or OfficeIMO-style named colors such as SeaGreen and CornflowerBlue. MarkdownPdfStyle remains available when PDF-only details such as page decoration or low-level panel styles need to diverge.
Boundaries
- Markdown parsing and writing stay in
OfficeIMO.Markdown. - PDF layout and primitives stay in
OfficeIMO.Pdf. - This package maps Markdown structure to PDF structure and visual themes.
- Large visual-state inventories belong in deeper docs and tests, not this README.
Related packages
- OfficeIMO.Markdown - Markdown document model.
- OfficeIMO.Pdf - PDF engine.
- OfficeIMO.Html.Pdf - HTML/PDF bridge.
Targets and license
- Targets:
netstandard2.0,net8.0,net10.0. - License: MIT.
- Repository: EvotecIT/OfficeIMO
Dependency footprint
- External: None beyond the dependencies of its OfficeIMO format packages.
- OfficeIMO:
OfficeIMO.Markdown,OfficeIMO.Pdf, andOfficeIMO.Coreown parsing, themes, layout, rendering, and reports.
See the complete OfficeIMO package map for related formats and conversion paths.
Generated capability summary
This table is generated from the package-neutral OfficeIMO operation catalog. The detailed source contracts remain authoritative for feature-level behavior and limitations.
| Operation | Supported | Partial | Preserved | Rejected | Unsupported | Not applicable |
|---|---|---|---|---|---|---|
| Convert | 1 | 0 | 0 | 0 | 0 | 0 |
The complete rows for OfficeIMO.Markdown.Pdf are published in the generated operation contract.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- OfficeIMO.Core (>= 3.6.1)
- OfficeIMO.Markdown (>= 3.6.1)
- OfficeIMO.Pdf (>= 3.6.1)
-
.NETStandard 2.0
- OfficeIMO.Core (>= 3.6.1)
- OfficeIMO.Markdown (>= 3.6.1)
- OfficeIMO.Pdf (>= 3.6.1)
-
net10.0
- OfficeIMO.Core (>= 3.6.1)
- OfficeIMO.Markdown (>= 3.6.1)
- OfficeIMO.Pdf (>= 3.6.1)
-
net8.0
- OfficeIMO.Core (>= 3.6.1)
- OfficeIMO.Markdown (>= 3.6.1)
- OfficeIMO.Pdf (>= 3.6.1)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on OfficeIMO.Markdown.Pdf:
| Package | Downloads |
|---|---|
|
OfficeIMO.OneNote.Pdf
First-party offline OneNote to PDF conversion for OfficeIMO. |
|
|
OfficeIMO.Latex.Pdf
Loss-aware LaTeX to PDF adapter over the first-party OfficeIMO Markdown and PDF engines. |
|
|
OfficeIMO.AsciiDoc.Pdf
Loss-aware AsciiDoc to PDF adapter over the first-party OfficeIMO Markdown and PDF engines. |
|
|
OfficeIMO
Document conversion and resumable batches over the OfficeIMO format libraries. |
|
|
OfficeIMO.Workflows
Typed local document workflows that compose first-party OfficeIMO conversion, PDF, and provenance capabilities. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.6.1 | 189 | 11/10/2026 |
| 3.6.0 | 308 | 11/6/2026 |
| 3.5.3 | 296 | 10/31/2026 |
| 3.5.2 | 241 | 10/24/2026 |
| 3.5.1 | 565 | 10/16/2026 |
| 3.4.5 | 746 | 10/10/2026 |
| 3.4.4 | 368 | 9/27/2026 |
| 3.4.3 | 369 | 9/12/2026 |
| 3.4.2 | 292 | 9/9/2026 |
| 3.4.1 | 314 | 9/7/2026 |
| 3.4.0 | 255 | 9/6/2026 |
| 3.3.0 | 52,330 | 9/2/2026 |
| 3.2.7 | 225 | 8/29/2026 |
| 3.2.6 | 338 | 8/22/2026 |
| 3.2.5 | 325 | 8/21/2026 |
| 3.2.4 | 327 | 8/19/2026 |
| 3.2.3 | 240 | 8/17/2026 |
| 3.2.2 | 434 | 8/13/2026 |
| 3.2.1 | 359 | 8/11/2026 |
| 3.2.0 | 504 | 8/7/2026 |