OfficeIMO.Html.Pdf
1.0.4
Prefix Reserved
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
.NET Framework 4.7.2
This package targets .NET Framework 4.7.2. The package is compatible with this framework or higher.
dotnet add package OfficeIMO.Html.Pdf --version 1.0.4
NuGet\Install-Package OfficeIMO.Html.Pdf -Version 1.0.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OfficeIMO.Html.Pdf" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OfficeIMO.Html.Pdf" Version="1.0.4" />
<PackageReference Include="OfficeIMO.Html.Pdf" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OfficeIMO.Html.Pdf --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: OfficeIMO.Html.Pdf, 1.0.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package OfficeIMO.Html.Pdf@1.0.4
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OfficeIMO.Html.Pdf&version=1.0.4
#tool nuget:?package=OfficeIMO.Html.Pdf&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
OfficeIMO.Html.Pdf - HTML and PDF bridge
OfficeIMO.Html.Pdf provides first-party HTML-to-PDF and PDF-to-HTML bridge workflows for OfficeIMO. It does not introduce a browser-grade HTML/CSS renderer or a second PDF parser; it composes the existing OfficeIMO engines.
Install
dotnet add package OfficeIMO.Html.Pdf
Quick start
using OfficeIMO.Html.Pdf;
string html = """
<h1>Quarterly update</h1>
<p>Generated by OfficeIMO.</p>
<table>
<tr><th>Area</th><th>Status</th></tr>
<tr><td>PDF bridge</td><td>Green</td></tr>
</table>
""";
html.SaveAsPdf("quarterly-update.pdf", new HtmlPdfSaveOptions {
Profile = HtmlPdfProfile.Semantic
});
Examples
Use the document profile for print-oriented HTML
using OfficeIMO.Html.Pdf;
using OfficeIMO.Word.Html;
using OfficeIMO.Word.Pdf;
string html = File.ReadAllText("invoice.html");
var options = HtmlPdfSaveOptions.CreateDocumentProfile();
options.WordHtmlOptions = HtmlToWordOptions.CreateOfficeIMOProfile();
options.WordPdfOptions = new PdfSaveOptions {
Title = "Invoice 2026-001",
Author = "Evotec",
IncludePageNumbers = true
};
html.SaveAsPdf("invoice.pdf", options);
Use the semantic profile for Markdown-like HTML
using OfficeIMO.Html.Pdf;
using OfficeIMO.Markdown.Pdf;
string html = """
<h1>Release notes</h1>
<p>This release includes <strong>PDF</strong> improvements.</p>
<ul><li>Split</li><li>Merge</li><li>Readback</li></ul>
""";
var options = HtmlPdfSaveOptions.CreateSemanticProfile();
options.MarkdownPdfOptions = new MarkdownPdfSaveOptions {
VisualTheme = MarkdownPdfVisualTheme.TechnicalDocument()
};
byte[] pdfBytes = html.SaveAsPdf(options);
File.WriteAllBytes("release-notes.pdf", pdfBytes);
Capture HTML import and PDF export diagnostics
using OfficeIMO.Html.Pdf;
string html = File.ReadAllText("complex.html");
var options = HtmlPdfSaveOptions.CreateDocumentProfile();
var result = html.TrySaveAsPdf("complex.pdf", options);
if (!result.Succeeded) {
foreach (string diagnostic in result.Diagnostics) {
Console.WriteLine(diagnostic);
}
}
foreach (var warning in options.ConversionReport.Warnings) {
Console.WriteLine($"{warning.Source}: {warning.Message}");
}
Convert PDF to HTML
using OfficeIMO.Html.Pdf;
string html = PdfHtmlConverter.ToHtml("quarterly-update.pdf", new PdfHtmlSaveOptions {
Profile = PdfHtmlProfile.Semantic
});
PdfHtmlConverter.SaveAsHtml("quarterly-update.pdf", "quarterly-update-review.html", new PdfHtmlSaveOptions {
Profile = PdfHtmlProfile.PositionedReview,
IncludeLinkAnnotations = true,
IncludeFormWidgets = true,
ImageExportMode = PdfHtmlImageExportMode.EmbeddedDataUri
});
Export only selected pages
using OfficeIMO.Html.Pdf;
using OfficeIMO.Pdf;
var options = new PdfHtmlSaveOptions {
Profile = PdfHtmlProfile.PositionedReview,
PageRanges = new[] { new PdfPageRange(1, 2), new PdfPageRange(5, 5) },
IncludeLinkAnnotations = true,
IncludeFormWidgets = true,
ImageExportMode = PdfHtmlImageExportMode.PlaceholderOnly
};
PdfHtmlConversionResult result = PdfHtmlConverter.ToHtmlResult("packet.pdf", options);
File.WriteAllText("packet-review.html", result.Html);
Console.WriteLine($"Rendered {result.Summary.RenderedPageCount} page(s)");
Console.WriteLine($"Tables: {result.Summary.TableCount}");
Console.WriteLine($"Links: {result.Summary.LinkCount}");
Convert an already-loaded logical PDF
using OfficeIMO.Html.Pdf;
using OfficeIMO.Pdf;
PdfLogicalDocument logical = PdfDocument.Open("statement.pdf").Read.Logical("1-3");
string html = logical.ToHtml(new PdfHtmlSaveOptions {
Profile = PdfHtmlProfile.Semantic,
IncludeMetadata = true,
IncludePageContainers = true
});
File.WriteAllText("statement.html", html);
Profiles
- Semantic HTML to PDF: HTML →
OfficeIMO.Markdown.Html→MarkdownDoc→OfficeIMO.Markdown.Pdf→OfficeIMO.Pdf. - Document HTML to PDF: HTML →
OfficeIMO.Word.Html→WordDocument→OfficeIMO.Word.Pdf→OfficeIMO.Pdf. - Semantic PDF to HTML: PDF →
OfficeIMO.Pdflogical model → structured HTML. - Positioned review PDF to HTML: PDF →
OfficeIMO.Pdflogical model → page wrappers with positioned text/table/link/form hints.
Profile contract APIs expose stable identifiers, intended use, fidelity guarantees, diagnostics, and unsupported scope for wrappers, manifests, UI selectors, and product docs.
Boundaries
- HTML ingestion belongs in
OfficeIMO.Markdown.HtmlorOfficeIMO.Word.Html. - PDF layout, reading, and logical extraction belong in
OfficeIMO.Pdf. - This package chooses and composes the bridge profile.
- Browser-grade CSS layout and pixel-perfect PDF rendering are out of scope for this package.
Related packages
Targets and license
- Targets:
netstandard2.0,net8.0,net10.0. - License: MIT.
- Repository: EvotecIT/OfficeIMO
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.7.2
- OfficeIMO.Markdown.Html (>= 0.1.33)
- OfficeIMO.Markdown.Pdf (>= 1.0.6)
- OfficeIMO.Pdf (>= 0.1.41)
- OfficeIMO.Word.Html (>= 1.0.40)
- OfficeIMO.Word.Pdf (>= 1.0.40)
-
.NETStandard 2.0
- OfficeIMO.Markdown.Html (>= 0.1.33)
- OfficeIMO.Markdown.Pdf (>= 1.0.6)
- OfficeIMO.Pdf (>= 0.1.41)
- OfficeIMO.Word.Html (>= 1.0.40)
- OfficeIMO.Word.Pdf (>= 1.0.40)
-
net10.0
- OfficeIMO.Markdown.Html (>= 0.1.33)
- OfficeIMO.Markdown.Pdf (>= 1.0.6)
- OfficeIMO.Pdf (>= 0.1.41)
- OfficeIMO.Word.Html (>= 1.0.40)
- OfficeIMO.Word.Pdf (>= 1.0.40)
-
net8.0
- OfficeIMO.Markdown.Html (>= 0.1.33)
- OfficeIMO.Markdown.Pdf (>= 1.0.6)
- OfficeIMO.Pdf (>= 0.1.41)
- OfficeIMO.Word.Html (>= 1.0.40)
- OfficeIMO.Word.Pdf (>= 1.0.40)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.