OfficeIMO.Pdf
3.6.1
Prefix Reserved
dotnet add package OfficeIMO.Pdf --version 3.6.1
NuGet\Install-Package OfficeIMO.Pdf -Version 3.6.1
<PackageReference Include="OfficeIMO.Pdf" Version="3.6.1" />
<PackageVersion Include="OfficeIMO.Pdf" Version="3.6.1" />
<PackageReference Include="OfficeIMO.Pdf" />
paket add OfficeIMO.Pdf --version 3.6.1
#r "nuget: OfficeIMO.Pdf, 3.6.1"
#:package OfficeIMO.Pdf@3.6.1
#addin nuget:?package=OfficeIMO.Pdf&version=3.6.1
#tool nuget:?package=OfficeIMO.Pdf&version=3.6.1
OfficeIMO.Pdf
Create, read, edit and combine PDF files in .NET. OfficeIMO.Pdf is OfficeIMO's own PDF engine, with no third-party PDF library, browser or Office installation. It also fills forms, stamps and redacts pages, protects files with passwords and checks PDF/A and PDF/UA output.
Install
dotnet add package OfficeIMO.Pdf
Optional packages:
dotnet add package OfficeIMO.Security # certificate signatures
dotnet add package OfficeIMO.Pdf.Ocr # searchable scans, with an OCR provider
dotnet add package OfficeIMO.Pdf.Word # PDF to Word; also .Pdf.Excel and .Pdf.PowerPoint
To turn Word, Excel, PowerPoint or Markdown into PDF, install the source format's adapter (OfficeIMO.Word.Pdf, OfficeIMO.Excel.Pdf, OfficeIMO.PowerPoint.Pdf, OfficeIMO.Markdown.Pdf) and call SaveAsPdf on that document.
Targets netstandard2.0, net8.0 and net10.0, plus net472 on Windows.
Create a report
using OfficeIMO.Pdf;
PdfDocument.Create(pdf => pdf.Content(content => content
.H1("Service review")
.AddParagraph(p => {
p.AddText("All scheduled checks passed. ");
p.AddText("Two follow-ups remain open.").SetBold();
})
.AddTable(new[] {
new[] { "Task", "Owner", "Due" },
new[] { "Rotate certificates", "Platform", "4 Nov" },
new[] { "Review backups", "Operations", "11 Nov" }
})))
.Meta(title: "Service review", author: "Operations")
.Save("Service-review.pdf");
Page margins follow the Modern theme unless PdfCreateOptions.Theme names another. PdfCreateOptions also sets the page size, fonts, tagging and compliance profile.
A single flow spacer is limited to 1,000 page or column traversal steps and cannot exceed 1,000 configured page heights. Larger spacing fails with InvalidDataException. Set MaxGeneratedPages when the total output page count also needs a limit.
Read text and tables
using OfficeIMO.Pdf;
PdfDocument pdf = PdfDocument.Load("Service-review.pdf");
PdfDocumentReadResult result = pdf.Read();
foreach (PdfLogicalPage page in result.Pages) {
Console.WriteLine($"Page {page.PageNumber}: {page.Paragraphs.Count} paragraphs, {page.Tables.Count} tables");
}
Console.WriteLine(result.ExtractMarkdown());
foreach (PdfFontInspectionDiagnostic warning in result.TextDecodingDiagnostics) {
Console.Error.WriteLine($"Page {warning.PageNumber}, {warning.ResourcePath}: {warning.Code} — {warning.Message}");
}
Read() omits an entire native text run when its font resource is missing or its
character codes cannot be mapped to Unicode. The omitted run does not enter
Text, Markdown or tables. TextDecodingDiagnostics reports MissingFontResource
or UnmappableText with the source page and font path. Check this collection when
complete text extraction matters. Supported font encodings and valid /ActualText
replacements remain readable; a missing ToUnicode map alone does not imply failure.
OCR-merged results retain warnings about omitted native text.
To include interactive form values in Markdown, enable the widget section:
string markdown = result.ExtractMarkdown(new PdfLogicalMarkdownOptions {
IncludeFormWidgets = true
});
The Markdown widget section is separate from result.Text, which reads the
page content. To include text marked as an artifact, such as running headers,
footers, or chart labels, pass new PdfLoadOptions { IncludeArtifactText = true }
to PdfDocument.Load before calling Read().
Read() can throw PdfUnsupportedTextMappingException for an unsupported font
mapping. Opt in to recover other readable text on the same page during
inspection:
PdfInspectionReadResult inspection = pdf.ReadForInspection(new PdfLoadOptions {
RecoverDecodableTextForInspection = true
});
Console.WriteLine(inspection.Document.Text);
Check PageOutcomes and Document.TextDecodingDiagnostics before relying on the
result. A partially read page with an unsupported font mapping reports
UnmappableText and retains the mapping failure. When a page content filter such
as FlateDecode reports damaged data, inspection can recover text from leading
streams and reports DamagedContentStream. In either case,
CompletedAllSelectedPages is false.
For files from outside your organization, pass PdfLoadOptions with read limits, as shown in the guide.
Combine, split and reorder pages
using OfficeIMO.Pdf;
PdfDocument.Load("Service-review.pdf")
.MergeWith("Service-review.pdf")
.Pages.Rotate(90, "2")
.UpdateMetadata(title: "Review pack")
.Save("Review-pack.pdf");
PdfDocument pack = PdfDocument.Load("Review-pack.pdf");
pack.Pages.Extract("1").Save("Cover.pdf");
IReadOnlyList<PdfDocument> pages = pack.Pages.Split();
for (int i = 0; i < pages.Count; i++) pages[i].Save($"Review-pack-{i + 1}.pdf");
Page operations return a new document; the source file is never changed in place. Page numbers and ranges are 1-based.
Pages.Insert, Pages.Append and Pages.Prepend retain ordinary AcroForm fields. Incoming name collisions use suffixes such as Shared_source2; hierarchical fields keep their parent and sibling relationships. General merge keeps only the primary form by default; choose Forms = PdfMergeStructureMode.Combine to retain incoming fields. See the page composition guide for form, action and signature restrictions.
Fill a form
using OfficeIMO.Pdf;
PdfDocument.Create(pdf => pdf.Content(content => content
.H1("Application")
.TextField("Applicant.Name")
.TextField("Approval.Status")))
.Save("Application.pdf");
PdfDocument.Load("Application.pdf")
.Forms.FillAndFlatten(new Dictionary<string, string> {
["Applicant.Name"] = "Adele Vance",
["Approval.Status"] = "Approved"
})
.Save("Application-filled.pdf");
Forms.Fill keeps the fields editable; FillAndFlatten makes the values part of the page.
Protect with a password
using OfficeIMO.Pdf;
PdfDocument.Create(pdf => pdf.Content(content => content
.H1("Salaries 2027")
.AddParagraph(p => p.AddText("Confidential."))),
new PdfCreateOptions().SetEncryption("open-password", ownerPassword: "owner-password"))
.Save("Salaries.pdf");
Convert a PDF back to Word
using OfficeIMO;
using OfficeIMO.Pdf;
using OfficeIMO.Pdf.Word;
PdfDocument pdf = PdfDocument.Load("Service-review.pdf");
OfficeConversionReport report = pdf.SaveAsWord("Service-review.docx");
Console.WriteLine($"Loss: {report.HasLoss}");
Reconstruction from a fixed-layout PDF is semantic: paragraphs, headings, lists and tables come back as editable Word content, and the report lists what could not be recovered.
More
- PDF guide: page layout and typography, fonts, headers and footers, images, stamps and watermarks, redaction, annotations, signatures, attachments, tagged output, PDF/A and PDF/X, page images, invoices and inspection.
- PDF current state, PDF conversion support and the generated operation contract.
- Examples and the migration guide.
- PowerShell: PSWriteOffice (
New-OfficePdf,Open-OfficePdf).
Dependencies: OfficeIMO.Core only; the PDF parser, writer, renderer and password encryption are OfficeIMO code. MIT licensed.
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 |
|---|---|---|---|---|---|---|
| Create | 2 | 0 | 0 | 0 | 0 | 0 |
| Read | 2 | 0 | 0 | 0 | 0 | 0 |
| Edit | 2 | 0 | 0 | 0 | 0 | 0 |
| Preserve | 0 | 1 | 0 | 0 | 0 | 0 |
| Inspect | 3 | 0 | 0 | 0 | 0 | 0 |
| Validate | 2 | 0 | 0 | 0 | 0 | 1 |
| Remove | 2 | 0 | 0 | 0 | 0 | 0 |
| Convert | 0 | 2 | 0 | 0 | 0 | 0 |
| Export | 5 | 0 | 0 | 0 | 0 | 0 |
The complete rows for OfficeIMO.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)
-
.NETStandard 2.0
- OfficeIMO.Core (>= 3.6.1)
-
net10.0
- OfficeIMO.Core (>= 3.6.1)
-
net8.0
- OfficeIMO.Core (>= 3.6.1)
NuGet packages (25)
Showing the top 5 NuGet packages that depend on OfficeIMO.Pdf:
| Package | Downloads |
|---|---|
|
OfficeIMO.Word.Pdf
PDF converter for OfficeIMO.Word - Export Word documents to PDF using the first-party OfficeIMO.Pdf engine. |
|
|
OfficeIMO.Excel.Pdf
PDF converter for OfficeIMO.Excel - Export Excel workbooks to PDF using the first-party OfficeIMO.Pdf engine. |
|
|
OfficeIMO.PowerPoint.Pdf
PDF converter for OfficeIMO.PowerPoint - Export PowerPoint presentations to PDF using the first-party OfficeIMO.Pdf engine. |
|
|
OfficeIMO.Html.Pdf
HTML-to-PDF conversion, PDF-backed HTML image export, and PDF-to-HTML semantic and positioned-review conversion for OfficeIMO. |
|
|
OfficeIMO.Reader.Pdf
PDF reader and normalized PDF projection bridge for OfficeIMO.Reader. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.6.1 | 1,025 | 11/10/2026 |
| 3.6.0 | 1,770 | 11/6/2026 |
| 3.5.3 | 5,076 | 10/31/2026 |
| 3.5.2 | 6,418 | 10/24/2026 |
| 3.5.1 | 2,964 | 10/16/2026 |
| 3.4.5 | 1,979 | 10/10/2026 |
| 3.4.4 | 3,690 | 9/27/2026 |
| 3.4.3 | 1,486 | 9/12/2026 |
| 3.4.2 | 866 | 9/9/2026 |
| 3.4.1 | 937 | 9/7/2026 |
| 3.4.0 | 816 | 9/6/2026 |
| 3.3.0 | 92,469 | 9/2/2026 |
| 3.2.7 | 6,316 | 8/29/2026 |
| 3.2.6 | 4,606 | 8/22/2026 |
| 3.2.5 | 940 | 8/21/2026 |
| 3.2.4 | 950 | 8/19/2026 |
| 3.2.3 | 794 | 8/17/2026 |
| 3.2.2 | 4,086 | 8/13/2026 |
| 3.2.1 | 849 | 8/11/2026 |
| 3.2.0 | 3,883 | 8/7/2026 |