OfficeIMO.Drawing
2.0.1
Prefix Reserved
dotnet add package OfficeIMO.Drawing --version 2.0.1
NuGet\Install-Package OfficeIMO.Drawing -Version 2.0.1
<PackageReference Include="OfficeIMO.Drawing" Version="2.0.1" />
<PackageVersion Include="OfficeIMO.Drawing" Version="2.0.1" />
<PackageReference Include="OfficeIMO.Drawing" />
paket add OfficeIMO.Drawing --version 2.0.1
#r "nuget: OfficeIMO.Drawing, 2.0.1"
#:package OfficeIMO.Drawing@2.0.1
#addin nuget:?package=OfficeIMO.Drawing&version=2.0.1
#tool nuget:?package=OfficeIMO.Drawing&version=2.0.1
OfficeIMO.Drawing - shared document and drawing primitives
OfficeIMO.Drawing is the zero-dependency shared foundation for OfficeIMO packages. It owns the common document lifecycle contracts as well as color, image metadata, font, text measurement, vector shape, chart snapshot, SVG, raster canvas, PNG read/write, and drawing-quality primitives. Format packages keep their document-specific behavior while reusing one lifecycle and persistence vocabulary.
Install
dotnet add package OfficeIMO.Drawing
Quick start
Document lifecycle policy
using OfficeIMO.Drawing;
var loadOptions = new DocumentLoadOptions {
AccessMode = DocumentAccessMode.ReadOnly,
PersistenceMode = DocumentPersistenceMode.Explicit
};
Word, Excel, and PowerPoint expose format-specific options derived from these shared contracts.
Colors and vector intent
using OfficeIMO.Drawing;
OfficeColor accent = OfficeColor.Parse("#336699");
OfficeImageFit fit = OfficeImageFit.Contain;
var badge = OfficeShape.RoundedRectangle(120, 32, 8);
badge.FillColor = OfficeColor.WhiteSmoke;
badge.StrokeColor = accent;
badge.Shadow = new OfficeShadow(OfficeColor.Black, 0.18, 3, 4);
Image metadata without decoding pixels
using OfficeIMO.Drawing;
OfficeImageInfo info = OfficeImageReader.Identify("logo.png");
Console.WriteLine($"{info.Width}x{info.Height} {info.MimeType}");
OfficeImageFit fit = OfficeImageFit.Contain;
Deterministic text measurement
using OfficeIMO.Drawing;
var measurer = OfficeTextMeasurer.Create();
var style = measurer.CreateStyle(new OfficeFontInfo("Aptos", 11, OfficeFontStyle.Regular));
OfficeTextMetrics metrics = measurer.Measure("Quarterly report", style);
if (metrics.WidthPixels > 240) {
Console.WriteLine("The label needs wrapping or a smaller font.");
}
Examples
Build a reusable vector scene
using OfficeIMO.Drawing;
var drawing = new OfficeDrawing(width: 420, height: 180)
.AddShape(new OfficeShape {
Kind = OfficeShapeKind.Rectangle,
Width = 420,
Height = 180,
FillGradient = OfficeLinearGradient.Horizontal(
OfficeColor.Parse("#F8FBFF"),
OfficeColor.Parse("#EAF4FF")),
StrokeColor = OfficeColor.Parse("#B7D7F5"),
StrokeWidth = 1
}, x: 0, y: 0)
.AddText("OfficeIMO.Drawing", 20, 18, 380, 32,
new OfficeFontInfo("Aptos", 18, OfficeFontStyle.Bold),
OfficeColor.Parse("#1F2937"),
OfficeTextAlignment.Left)
.AddShape(OfficeShape.RoundedRectangle(140, 44, 10), 20, 86)
.AddText("Shared vector intent", 34, 98, 240, 24);
OfficeDrawingQualityReport report = OfficeDrawingQualityAnalyzer.Analyze(drawing);
if (report.HasIssues) {
foreach (var issue in report.Issues) {
Console.WriteLine($"{issue.Kind}: {issue.Message}");
}
}
Render a chart snapshot to drawing primitives
using OfficeIMO.Drawing;
var snapshot = new OfficeChartSnapshot(
name: "RevenueChart",
title: "Revenue by quarter",
chartKind: OfficeChartKind.ColumnClustered,
data: new OfficeChartData(
new[] { "Q1", "Q2", "Q3", "Q4" },
new[] {
new OfficeChartSeries("Revenue", new[] { 10d, 18d, 24d, 30d }),
new OfficeChartSeries("Forecast", new[] { 12d, 19d, 25d, 33d })
}),
widthPoints: 420,
heightPoints: 260);
OfficeChartRenderingResult rendered = OfficeChartDrawingRenderer.RenderWithQuality(snapshot);
OfficeDrawing chartDrawing = rendered.Drawing;
foreach (var issue in rendered.QualityReport.Issues) {
Console.WriteLine(issue.Message);
}
Read TrueType outlines for renderers
using OfficeIMO.Drawing;
OfficeTrueTypeFont? font = OfficeTrueTypeFont.TryLoadDefault(out string? path);
if (font != null) {
Console.WriteLine($"Loaded {path}");
}
What it provides
DocumentAccessMode,DocumentPersistenceMode,DocumentCreateOptions, andDocumentLoadOptionsfor one lifecycle vocabulary across document packages.OfficeColorimmutable RGBA values with named colors and hex parsing.OfficeImageReaderandOfficeImageInfofor dependency-free image inspection where supported.OfficeImageFitfor shared stretch, contain, and cover intent.OfficeFontInfo,OfficeFontStyle,OfficeTextMeasurer, andOfficeTextMetricsfor deterministic layout estimates.OfficeTrueTypeFontfor dependency-free font-outline reading when renderers need glyph contours.OfficeShape,OfficeDrawing, gradients, shadows, transforms, clipping, and vector descriptors that format-specific packages can map into their own coordinate systems.OfficeChartSnapshotand chart rendering primitives shared by PDF and Office exporters.OfficeRasterImage,OfficeRasterCanvas,OfficeRasterRenderTarget, andOfficeDrawingRasterRendererfor shared dependency-free raster rendering.OfficePngReaderandOfficePngWriterfor PNG paths that should not be reimplemented by document packages.- Shared SVG formatting, primitive writing, image projection, text-block rendering, hatch-pattern, data-bar, and sparkline helpers.
- Drawing quality diagnostics for canvas bounds and text overlap checks.
Boundaries
- This package owns shared lifecycle contracts, persistence mechanics, drawing intent, raster buffers, SVG/PNG primitives, image projection, text layout helpers, chart drawing, and document-agnostic visual diagnostics.
- Word, Excel, PowerPoint, Visio, and PDF packages own source-document semantics: package parsing, layout policy, coordinate systems, style/theme resolution, and user-facing export APIs.
- Document packages should not add private pixel engines, PNG encoders/decoders, SVG primitive writers, text wrapping engines, or duplicate image-transform loops when the behavior can reasonably live here.
- PDF keeps PDF-stream and page-writer behavior in
OfficeIMO.Pdf; when it needs generic image-like drawing, vector descriptors, colors, chart snapshots, PNG helpers, or raster visual QA, it should useOfficeIMO.Drawing. - Unsupported or approximate source features belong in stable diagnostics from the adapter, not as silent omissions in a renderer.
Targets and license
- Targets:
netstandard2.0,net8.0,net10.0. - License: MIT.
- Repository: EvotecIT/OfficeIMO
Dependency footprint
- External: None.
- OfficeIMO: This is the shared foundation; it does not depend on another OfficeIMO runtime package.
See the complete OfficeIMO package map for related formats and conversion paths.
| 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
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (27)
Showing the top 5 NuGet packages that depend on OfficeIMO.Drawing:
| Package | Downloads |
|---|---|
|
OfficeIMO.Word
An Open Source cross-platform .NET library providing an easy way to create Microsoft Word (DocX) documents. |
|
|
OfficeIMO.Markdown
Markdown builder, typed reader/AST, and HTML renderer for .NET with GitHub-like output and an optional portable reader profile. |
|
|
OfficeIMO.Excel
An Open Source cross-platform .NET library providing an easy way to create Excel documents. |
|
|
OfficeIMO.PowerPoint
An Open Source cross-platform .NET library providing an easy way to create Microsoft PowerPoint (PPTX) presentations. |
|
|
OfficeIMO.Pdf
Dependency-free PDF builder and reader for .NET with fluent document composition, standard PDF fonts, basic layout primitives, and no runtime package dependencies. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on OfficeIMO.Drawing:
| Repository | Stars |
|---|---|
|
EvotecIT/PSWriteOffice
PowerShell Module to create and edit Microsoft Word, Microsoft Excel, and Microsoft PowerPoint documents without having Microsoft Office installed.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.1 | 147 | 7/14/2026 |
| 2.0.0 | 185 | 7/14/2026 |
| 1.0.29 | 1,097 | 7/9/2026 |
| 1.0.28 | 1,235 | 7/8/2026 |
| 1.0.27 | 1,684 | 7/5/2026 |
| 1.0.26 | 1,398 | 7/4/2026 |
| 1.0.25 | 1,591 | 6/27/2026 |
| 1.0.24 | 1,151 | 6/27/2026 |
| 1.0.23 | 1,609 | 6/24/2026 |
| 1.0.22 | 1,392 | 6/23/2026 |
| 1.0.21 | 1,360 | 6/21/2026 |
| 1.0.20 | 1,531 | 6/16/2026 |
| 1.0.19 | 1,338 | 6/16/2026 |
| 1.0.18 | 1,970 | 6/15/2026 |
| 1.0.17 | 1,989 | 6/13/2026 |
| 1.0.16 | 1,055 | 6/12/2026 |
| 1.0.15 | 1,035 | 6/9/2026 |
| 1.0.14 | 1,167 | 6/5/2026 |
| 1.0.13 | 7,418 | 5/27/2026 |
| 1.0.12 | 652 | 5/26/2026 |