JetsonPDF.Common
1.1.0
dotnet add package JetsonPDF.Common --version 1.1.0
NuGet\Install-Package JetsonPDF.Common -Version 1.1.0
<PackageReference Include="JetsonPDF.Common" Version="1.1.0" />
<PackageVersion Include="JetsonPDF.Common" Version="1.1.0" />
<PackageReference Include="JetsonPDF.Common" />
paket add JetsonPDF.Common --version 1.1.0
#r "nuget: JetsonPDF.Common, 1.1.0"
#:package JetsonPDF.Common@1.1.0
#addin nuget:?package=JetsonPDF.Common&version=1.1.0
#tool nuget:?package=JetsonPDF.Common&version=1.1.0
JetsonPDF.Common
Shared value types and pure-data utilities used by JetsonPDF.Reader and
JetsonPDF.Writer. This is the "no behaviour, just shapes" layer — every type
here is either an enum, a record, or a small immutable POCO that describes a
PDF concept (page size, viewer preference, destination, page label range,
widget action, conformance flag) without doing any I/O.
Most callers never reference this package directly. You add a project /
package reference to JetsonPDF.Writer or JetsonPDF.Reader and the types
here come along transitively — JetsonPDF.PageSize.Letter is reachable from
the Writer namespace because the Writer transitively re-exports it.
using JetsonPDF;
using JetsonPDF.Writer;
var doc = new PdfDocument
{
Title = "Hello",
PageLayout = PageLayout.TwoColumnLeft, // from Common
PageMode = PageMode.UseOutlines, // from Common
ViewerPreferences = new ViewerPreferences // from Common
{
DisplayDocTitle = true,
HideToolbar = true,
},
};
var page = doc.AddPage(PageSize.Letter); // PageSize from Common
page.DrawText("Hi", new Font(FontFamily.Helvetica, 12), 50, 700);
doc.Save("hi.pdf");
Contents
- Overview
- When you reference it directly
- Page geometry and sizes
- Viewer hints — layout, mode, preferences
- Destinations
- Encryption and permissions
- Conformance and output intents
- Page labels
- Widget actions
- Miscellaneous enums
- Targets
- License
Overview
The root namespace for every public type in this package is JetsonPDF. A
handful of annotation-adjacent enums live under JetsonPDF.Annotations
(currently just SoundEncoding). There is no JetsonPDF.Common namespace —
the assembly name and the root namespace are intentionally different so users
write using JetsonPDF; and not using JetsonPDF.Common;.
The assembly has no behavioural surface — nothing here writes bytes, parses
streams, or talks to the file system (with the lone exception of
IccProfile.FromFile, which reads ICC bytes off disk). Everything is either a
constructor, a property, or an enum literal. That makes the package safe to
reference from analysers, source generators, build-time validators, and
anywhere else you want PDF vocabulary without the writer/reader binaries.
When you reference it directly
You usually don't. The cases where a direct project / NuGet reference makes sense are:
- Writing a host application that dispatches
WidgetActionvalues returned byJetsonPDF.Readerand want the type hierarchy without pulling in the reader. - Building a separate validator, linter, or static-analysis tool that needs the conformance flags, the permission bits, or the page-label range type.
- Implementing a third-party renderer that reads back DTOs the JetsonPDF
reader produces —
Destination,OutputIntent,IccProfileetc. are all here.
For the common writer/reader/fluent paths, just reference the higher-level package and let the transitive bring this one in.
Page geometry and sizes
PageSize is an immutable record struct of (Width, Height) in PDF user
space units (points; 1 pt = 1/72 inch). PDF coordinates originate at the
bottom-left corner.
| Static | Width × Height (pt) | Equivalent |
|---|---|---|
PageSize.Letter |
612 × 792 | 8.5 × 11 in |
PageSize.Legal |
612 × 1008 | 8.5 × 14 in |
PageSize.Tabloid |
792 × 1224 | 11 × 17 in |
PageSize.A4 |
595 × 842 | 210 × 297 mm |
PageSize.A3 |
842 × 1191 | 297 × 420 mm |
PageSize.A5 |
420 × 595 | 148 × 210 mm |
For custom dimensions, use the record-struct constructor:
var square = new PageSize(720, 720); // 10 × 10 in
var halfLetter = new PageSize(612, 792 / 2.0);
// Swap width and height for landscape:
var letterLandscape = new PageSize(PageSize.Letter.Height, PageSize.Letter.Width);
Because PageSize is a record struct, equality and with expressions both
work:
var custom = PageSize.Letter with { Height = 900 };
bool isLetter = custom == PageSize.Letter; // false (height changed)
Viewer hints — layout, mode, preferences
Three types control the catalog's /PageLayout, /PageMode, and
/ViewerPreferences entries (ISO 32000-2 §12.2 Table 28 + Table 151).
PageLayout
How the viewer arranges pages on screen.
| Value | Meaning |
|---|---|
SinglePage |
One page at a time. |
OneColumn |
One continuous column. |
TwoColumnLeft |
Two columns, odd pages on the left. |
TwoColumnRight |
Two columns, odd pages on the right. |
TwoPageLeft |
Two pages at a time, odd on the left (PDF 1.5+). |
TwoPageRight |
Two pages at a time, odd on the right (PDF 1.5+). |
PageMode
What the viewer shows when the document opens.
| Value | Meaning |
|---|---|
UseNone |
No side panel visible. |
UseOutlines |
Outline (bookmarks) panel. |
UseThumbs |
Thumbnails panel. |
FullScreen |
Full-screen mode, no UI chrome. |
UseOC |
Optional Content (layers) panel (PDF 1.5+). |
UseAttachments |
Attachments panel (PDF 1.6+). |
ViewerPreferences
Every property is nullable. Only non-null entries are emitted, so viewers pick their own defaults for properties you don't set.
| Property | Type | Effect |
|---|---|---|
HideToolbar |
bool? |
Hide the viewer's toolbar. |
HideMenubar |
bool? |
Hide the viewer's menu bar. |
HideWindowUI |
bool? |
Hide scrollbars / navigation chrome. |
FitWindow |
bool? |
Resize the window to the first page. |
CenterWindow |
bool? |
Center the window on screen. |
DisplayDocTitle |
bool? |
Show document /Title in the window title (PDF 1.4+). |
NonFullScreenPageMode |
PageMode? |
Panel to show when exiting full screen. |
Direction |
ReadingDirection? |
LeftToRight or RightToLeft (PDF 1.3+). |
var prefs = new ViewerPreferences
{
DisplayDocTitle = true,
FitWindow = true,
Direction = ReadingDirection.LeftToRight,
};
Destinations
Destination describes a navigation target — a page and a viewport state —
used by outline items, link annotations, named destinations, and the
catalog's /OpenAction (ISO 32000-2 §12.3.2).
| Factory | Emits | Description |
|---|---|---|
Destination.FitEntire(pageIndex) |
/Fit |
Fit the whole page in the window. |
Destination.FitH(pageIndex, top) |
/FitH |
Fit page width; scroll vertically to top. |
Destination.FitV(pageIndex, left) |
/FitV |
Fit page height; scroll horizontally to left. |
Destination.Xyz(pageIndex, left?, top?, zoom?) |
/XYZ |
Explicit top-left and zoom (1.0 = 100%). null keeps the viewer's current value. |
// Top of page 3, page width fitted to the window.
var topOfPage3 = Destination.FitH(pageIndex: 2, top: 792);
// Page 0 at 200% zoom, scrolled to (100, 700).
var zoomed = Destination.Xyz(pageIndex: 0, left: 100, top: 700, zoom: 2.0);
Only explicit destinations are exposed here — named destinations are an
indirection through the /Dests name tree and resolve to a Destination
on the way out.
Encryption and permissions
EncryptionAlgorithm selects the PDF security handler family; Permissions
is a [Flags] enum that maps directly to the /P integer in the encryption
dictionary (ISO 32000-2 §7.6.4.2 Table 22).
EncryptionAlgorithm |
Notes |
|---|---|
Aes128 |
AES-128 CBC (V=4 R=4). Acrobat 7+. Default for PDF 1.7. |
Aes256 |
AES-256 CBC (V=5 R=6). Required for PDF 2.0 and Unicode passwords > 127 code points. Acrobat X+. |
Permissions flag |
Bit | Effect |
|---|---|---|
Print |
3 | Print the document. |
Modify |
4 | Modify content (other than annotations / form filling / assembly). |
CopyContent |
5 | Copy or extract text and graphics. |
AddAnnots |
6 | Add or modify annotations and interactive form fields. |
FillForms |
9 | Fill in existing form fields even if AddAnnots is clear. |
Accessibility |
10 | Extract for accessibility (R ≥ 3). |
Assemble |
11 | Insert, rotate, or delete pages; manage bookmarks (R ≥ 3). |
HighPrint |
12 | Print at high resolution (R ≥ 3). |
AllowAll |
— | All of the above. |
var perms = Permissions.Print | Permissions.FillForms | Permissions.Accessibility;
// Pair with EncryptionOptions (in JetsonPDF.Writer) to actually encrypt.
Conformance and output intents
Conformance is a [Flags] enum — flags compose, so a single document can
declare PDF/A and PDF/UA simultaneously.
| Flag | Standard | Notes |
|---|---|---|
None |
— | No conformance declaration. |
PdfA1b |
ISO 19005-1 Level B | Archival, PDF 1.4 base. No transparency, object streams, JPEG 2000, encryption, JavaScript, or non-embedded standard fonts. |
PdfA2b |
ISO 19005-2 Level B | PDF 1.7 base. Allows transparency, object streams, JPEG 2000. |
PdfA2a |
ISO 19005-2 Level A | A-2b plus tagging and language declaration. |
PdfA2u |
ISO 19005-2 Level U | A-2b plus mandatory text extractability. |
PdfA3b |
ISO 19005-3 Level B | A-2b rules; permits embedded files of any type (ZUGFeRD, Factur-X). |
PdfA3a |
ISO 19005-3 Level A | A-3b plus tagging and language. |
PdfA3u |
ISO 19005-3 Level U | A-3b plus text extractability. |
PdfUA1 |
ISO 14289-1 | Accessible PDF based on PDF 1.7. Requires tagging, language, and DisplayDocTitle true. |
PdfUA2 |
ISO 14289-2 | Accessible PDF based on PDF 2.0. |
var conformance = Conformance.PdfA2u | Conformance.PdfUA1;
OutputIntent
Output-intent dictionary (ISO 32000-2 §14.11.5). Required by PDF/A and recommended for prepress.
| Property | Type | Description |
|---|---|---|
Subtype |
string |
Typically "GTS_PDFA1", "GTS_PDFX", or "ISO_PDFE1". Defaults to GTS_PDFA1. |
OutputConditionIdentifier |
string |
ICC characterization name (e.g. "sRGB IEC61966-2.1"). Required. |
OutputCondition |
string? |
Human-readable description. |
RegistryName |
string? |
Registry that defines the identifier (e.g. "http://www.color.org"). |
Info |
string? |
General info string. |
DestProfile |
IccProfile? |
Optional ICC profile stream attached as /DestOutputProfile. Required for strict PDF/A-1. |
IccProfile
// From bytes (header inspected to derive component count):
var srgb = IccProfile.FromBytes(File.ReadAllBytes("sRGB.icc"));
// From disk:
var profile = IccProfile.FromFile(@"C:\ICC\sRGB IEC61966-2.1.icc");
// Or supply the component count yourself (1=gray, 3=RGB, 4=CMYK):
var raw = new IccProfile(profileBytes, componentCount: 3);
var intent = new OutputIntent
{
OutputConditionIdentifier = "sRGB IEC61966-2.1",
DestProfile = profile,
};
Page labels
PageLabelRange overrides the viewer-facing page-label string for a run of
pages — useful when front matter uses roman numerals and the body uses
arabic, or when an appendix should display A-1, A-2, …
PageLabelStyle |
Format |
|---|---|
DecimalArabic |
1, 2, 3, … |
UpperRoman |
I, II, III, … |
LowerRoman |
i, ii, iii, … |
UpperAlpha |
A, B, …, Z, AA, BB, … |
LowerAlpha |
a, b, …, z, aa, bb, … |
NoNumeric |
No number — only the prefix is shown. |
// Front matter (pages 0..3): i, ii, iii, iv
var front = new PageLabelRange(startPageIndex: 0, style: PageLabelStyle.LowerRoman);
// Body (pages 4..47): 1, 2, …, 44
var body = new PageLabelRange(startPageIndex: 4, style: PageLabelStyle.DecimalArabic);
// Appendix (pages 48..): A-1, A-2, …
var apdx = new PageLabelRange(48, PageLabelStyle.DecimalArabic, prefix: "A-");
// Force a restart at a specific number:
var sectB = new PageLabelRange(100, PageLabelStyle.DecimalArabic, startNumber: 5);
StartPageIndex is zero-based; StartNumber defaults to 1 and must be ≥ 1.
Pages not covered by any range fall through to the viewer's "1, 2, 3"
default.
Widget actions
WidgetAction is the discriminated base for every action a widget annotation
can dispatch on activation (ISO 32000-2 §12.6). The reader parses the
widget's /A entry into one of these subclasses; a viewer shell (the WPF
sample, or any custom host) type-tests the value to decide what to do.
| Subclass | Spec | Carries |
|---|---|---|
UriAction |
§12.6.4.7 | Uri (string). |
NamedAction |
§12.6.4.11 | Name — standard viewer command (Print, NextPage, …) or producer extension. IsPrint shortcut. |
GoToAction |
§12.6.4.2 | Destination (opaque string — same form LinkAnnotation.InternalDestination uses). |
GoToRemoteAction |
§12.6.4.3 | FileName, optional Destination, OpenInNewWindow. |
LaunchAction |
§12.6.4.5 | FileName, OpenInNewWindow. Treat as untrusted — historical attack vector. |
ResetFormAction |
§12.7.5.3 | FieldNames, ExcludeFields (when true, the list is fields to exclude — every other field is reset). |
SubmitFormAction |
§12.7.5.2 | Uri, FieldNames, raw Flags integer. |
JavaScriptAction |
§12.6.4.16 | Script (opaque text). |
HideAction |
§12.6.4.10 | TargetFieldNames, Operation (Hide or Show). |
SetOcgStateAction |
§12.6.4.17 | States — list of OcgStateEntry(Change, OcgName) with Change ∈ {Off, On, Toggle}; PreserveRadioButtonState flag. |
ImportDataAction |
§12.7.5.4 | FileName — FDF/XFDF file path. |
SoundAction |
§12.6.4.8 | SoundBytes plus PCM-shape metadata (SamplingRate, Channels, BitsPerSample, Encoding, Volume, Synchronous, Repeat, Mix). |
WidgetAction action = /* from widget.Action */;
switch (action)
{
case UriAction uri:
Process.Start(new ProcessStartInfo(uri.Uri) { UseShellExecute = true });
break;
case NamedAction { IsPrint: true }:
PrintDocument();
break;
case ResetFormAction reset:
ResetForm(reset.FieldNames, exclude: reset.ExcludeFields);
break;
case GoToAction go:
NavigateTo(go.Destination);
break;
case JavaScriptAction:
// ignore — JetsonPDF.Wpf doesn't run scripts
break;
}
Miscellaneous enums
FillRule (§8.5.3.3)
| Value | PDF operators |
|---|---|
NonZero |
f, B, b (non-zero winding number). |
EvenOdd |
f*, B*, b* (even-odd). |
TextAlignment
Horizontal alignment for Page.DrawTextBlock. Note: the Forms layer has its
own FieldAlignment enum for field-content alignment; this TextAlignment
is for the writer's text-block drawing helper.
| Value | Effect |
|---|---|
Left |
Flush-left (LTR default). |
Center |
Centered within the rectangle. |
Right |
Flush-right. |
Justify |
Left- and right-justified; last line stays left-aligned. |
JetsonPDF.Annotations.SoundEncoding (§12.5.6.16 + §13.3)
Sample-data encoding for SoundAction.Encoding and the sound-annotation
/E entry.
| Value | PDF name |
|---|---|
Raw |
/Raw (raw PCM). |
ALaw |
/ALaw (ITU-T G.711 A-law). |
MuLaw |
/muLaw (ITU-T G.711 mu-law). |
Signed |
/Signed (IEEE signed-integer samples). |
Targets
net8.0netstandard2.0net462
On netstandard2.0 and net462 the project pulls System.Memory 4.5.5 and
System.Buffers 4.5.1 to back the Span<T> / Memory<T> surface that
net8.0 provides in the BCL.
License
MIT.
| 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 was computed. 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 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. 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.6.2
- Microsoft.Bcl.HashCode (>= 6.0.0)
- System.Buffers (>= 4.5.1)
- System.Memory (>= 4.5.5)
- System.ValueTuple (>= 4.5.0)
-
.NETStandard 2.0
- Microsoft.Bcl.HashCode (>= 6.0.0)
- System.Buffers (>= 4.5.1)
- System.Memory (>= 4.5.5)
-
net8.0
- No dependencies.
NuGet packages (10)
Showing the top 5 NuGet packages that depend on JetsonPDF.Common:
| Package | Downloads |
|---|---|
|
JetsonPDF.Reader
Parses PDF files into a navigable object model (ReadDocument). |
|
|
JetsonPDF.Writer
Builds PDF documents from scratch, following ISO 32000-2. |
|
|
JetsonPDF.XamlToPdfConverter.Core
Runtime-neutral core for the XAML-to-PDF authoring pipeline. Owns the snapshot model, PDF emission, pagination, font/Std14 mapping, and path/geometry flattening. Consumed by the WPF and OpenSilver tree-walker adapters. |
|
|
JetsonPDF.Fluent
Headless, code-first fluent API for building PDFs with JetsonPDF — QuestPDF-style containers, auto-pagination, dynamic page numbers. |
|
|
JetsonPDF.Flow
Word-like retained-mode DOM (Section / Paragraph / Run / Table) with auto-pagination, layered on JetsonPDF.Fluent. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.0 | 51 | 6/6/2026 |
| 1.0.0 | 415 | 5/23/2026 |
| 0.2.0-preview | 412 | 5/23/2026 |
| 0.1.0-preview | 367 | 5/17/2026 |