πŸ“– Complete API Reference

Every public class, method, property, and enum in ObviousPDF. πŸ“₯ Download Markdown

PdfDocument

namespace ObviousPDF β€” The main entry point for creating PDF files.

Creating a Document
var doc = new PdfDocument();
doc.Info.Title = "My Document";
doc.Language = "en-US";
doc.Save("output.pdf");

Properties

PropertyTypeDefaultDescription
InfoPdfDocumentInfo(empty)Document metadata (title, author, subject, etc.)
Languagestring?nullBCP 47 language tag (e.g. "en-US"). Required for PDF/UA.
DisplayDocTitleboolfalseShow title in viewer title bar. Required for PDF/UA.
PdfVersionstring?nullExplicit PDF version (e.g. "2.0"). Auto-inferred when null.
PdfAConformancePdfAConformanceLevelNonePDF/A archival conformance level.
PdfUaConformancePdfUaConformanceLevelNonePDF/UA accessibility conformance level.
UseCrossReferenceStreamsboolfalseUse compact xref streams (PDF 1.5+).
UseObjectStreamsboolfalsePack objects in compressed streams (PDF 1.5+).
EncryptionPdfEncryption?nullEncryption settings (AES-128 or AES-256).
LinearizeboolfalseEnable fast web view (linearized PDF).
IsTaggedbool(read-only)Whether tagged PDF is enabled.
StructureTreeRootPdfStructureElement?(read-only)Root of the structure tree, or null.

Methods

MethodReturnsDescription
AddPage(double width = 612, double height = 792)PdfPageBuilderAdds a page with custom dimensions (points).
AddPage((double, double) pageSize)PdfPageBuilderAdds a page using a PageSize constant.
EnableTaggedPdf()PdfStructureElementEnables tagged PDF; returns root Document element.
AddRoleMapping(string, StructureType)voidMaps custom structure type to standard type.
AddOutline(string title, int pageIndex)PdfOutlineItemAdds a top-level bookmark.
AddPageLabels(int, PdfPageLabelStyle, string?, int)PdfPageLabelAdds a page label range.
CreateFormXObject(double w, double h)PdfFormXObjectCreates a reusable form XObject.
CreateOptionalContentGroup(string, bool)PdfOptionalContentGroupCreates an OCG (layer).
AddAssociatedFile(string, string, byte[], ...)PdfAssociatedFileAttaches a document-level file.
CreateDocumentPartRoot()PdfDocumentPartCreates root for document part hierarchy.
Save(string filePath)voidWrites PDF to a file path.
Save(Stream stream)voidWrites PDF to any stream.
Sign(string filePath, PdfDigitalSignature)voidSaves and digitally signs the PDF.

PdfPageBuilder

namespace ObviousPDF β€” Fluent API for adding content to a single PDF page.

Text Methods

MethodDescription
AddText(string text, double x, double y, PdfTextOptions?)Single line of text at (x, y).
AddTextBlock(IEnumerable<string>, double x, double y, PdfTextOptions?)Multi-line text with auto line advance.
BeginTextBlock() / EndTextBlock()Fine-grained text block control.
SetFont(StandardFont, double)Sets standard font inside a text block.
SetFont(PdfEmbeddedFont, double)Sets embedded font inside a text block.
SetColor(PdfColor)Sets text colour using any colour space.
SetTextRenderingMode(PdfTextRenderingMode)Sets rendering mode (fill, stroke, clip, invisible).
MoveTextTo(double x, double y)Moves text cursor inside a text block.
ShowText(string text)Renders text at current position inside a text block.

Vector Graphics Methods

MethodDescription
DrawLine(double x1, double y1, double x2, double y2, PdfDrawOptions?)Draws a line between two points.
DrawRectangle(double x, y, w, h, PdfDrawOptions?)Rectangle outline.
FillRectangle(double x, y, w, h, PdfDrawOptions?)Filled rectangle.
DrawAndFillRectangle(double x, y, w, h, PdfDrawOptions?)Rectangle with fill and stroke.
DrawCircle(double cx, cy, r, PdfDrawOptions?)Circle outline.
FillCircle(double cx, cy, r, PdfDrawOptions?)Filled circle.
DrawEllipse(double cx, cy, rx, ry, PdfDrawOptions?)Ellipse outline.
FillEllipse(double cx, cy, rx, ry, PdfDrawOptions?)Filled ellipse.
DrawPolygon((double, double)[], PdfDrawOptions?)Polygon outline.
FillPolygon((double, double)[], PdfDrawOptions?)Filled polygon.
BeginPath(PdfDrawOptions?)Starts path construction; returns PdfPathBuilder.

Image Methods

MethodDescription
AddImage(PdfImage, double x, y, w, h)Places an image at exact size.
AddImageScaled(PdfImage, double x, y, maxW, maxH)Places an image preserving aspect ratio.

Transform & State Methods

MethodDescription
Translate(double tx, double ty)Translation transform.
Scale(double sx, double sy)Scale transform.
Rotate(double angleDegrees)Counter-clockwise rotation.
Skew(double angleX, double angleY)Skew (shear) transform.
SaveGraphicsState()Saves graphics state (q operator).
RestoreGraphicsState()Restores graphics state (Q operator).
SetAlpha(double strokeAlpha, double fillAlpha)Sets opacity (0.0–1.0).

Clipping Methods

MethodDescription
ClipToRectangle(double x, y, w, h)Rectangular clip region.
ClipToCircle(double cx, cy, radius)Circular clip region.
ClipToEllipse(double cx, cy, rx, ry)Elliptical clip region.

Annotation Methods

MethodDescription
AddLink(string uri, double x, y, w, h)Adds a URI hyperlink.
AddTextAnnotation(double x, y, string contents, ...)Sticky note.
AddFreeTextAnnotation(double x, y, w, h, ...)Inline text annotation.
AddHighlightAnnotation(...)Highlight markup.
AddUnderlineAnnotation(...)Underline markup.
AddSquigglyAnnotation(...)Squiggly underline.
AddStrikeOutAnnotation(...)Strikethrough.
AddStampAnnotation(..., PdfStampIcon, ...)Stamp annotation.

Form Field Methods

MethodDescription
AddTextField(string name, double x, y, w, h, ...)Text input field.
AddCheckboxField(string name, double x, y, size, ...)Checkbox field.
AddDropdownField(string name, ..., string[] options, ...)Dropdown list.
AddListBoxField(string name, ..., string[] options, ...)List box.
AddPushButtonField(string name, ...)Push button.
AddSignatureField(string name, ...)Signature placeholder.
AddTaggedAcroField(PdfStructureElement, PdfAcroField)Accessible tagged form field.

Tagged Content (Accessibility) Methods

MethodDescription
AddTaggedText(PdfStructureElement, string, double x, y, PdfTextOptions?)Tagged text linked to structure tree.
AddTaggedTextBlock(PdfStructureElement, IEnumerable<string>, ...)Tagged multi-line text.
AddTaggedLink(PdfStructureElement, string uri, string text, ...)Accessible tagged hyperlink.
BeginTaggedContent(PdfStructureElement)Starts tagged content region (returns MCID).
EndTaggedContent()Ends tagged content region.
BeginArtifact(PdfArtifactType)Starts artifact (non-structural) content.
EndArtifact()Ends artifact content.
AddArtifactText(string, double x, y, PdfArtifactType?, PdfTextOptions?)Text marked as artifact.

Pattern, Shading & Layer Methods

MethodDescription
FillWithShading(PdfShadingPattern, double x, y, w, h)Fills area with gradient.
FillWithPattern(PdfTilingPattern, double x, y, w, h)Fills area with tiling pattern.
AddFormXObject(PdfFormXObject, double x, y)Places a form XObject at natural size.
AddFormXObject(PdfFormXObject, double x, y, w, h)Places a form XObject scaled.
BeginOptionalContent(PdfOptionalContentGroup)Starts layer content.
EndOptionalContent()Ends layer content.

PdfTextOptions

namespace ObviousPDF β€” Configuration for text rendering.

PropertyTypeDefaultDescription
FontStandardFontHelveticaStandard font to use.
EmbeddedFontPdfEmbeddedFont?nullEmbedded font (overrides Font).
FontSizedouble12Size in points.
ColorPdfColorBlack RGBText colour.
Leadingdouble?null (1.2Γ—)Line spacing in points.
RenderingModePdfTextRenderingModeFillFill, Stroke, FillAndStroke, Invisible, Clip.

PdfDrawOptions

namespace ObviousPDF β€” Configuration for vector graphics rendering.

PropertyTypeDefaultDescription
StrokeColorPdfColorBlackStroke (outline) colour.
FillColorPdfColorBlackFill colour.
LineWidthdouble1.0Line width in points.
LineCapPdfLineCapButtLine cap style.
LineJoinPdfLineJoinMiterLine join style.
MiterLimitdouble10.0Miter limit for joins.
DashPatterndouble[]?nullDash pattern array.
DashPhasedouble0Dash pattern phase offset.
StrokeAlphadouble1.0Stroke opacity (0.0–1.0).
FillAlphadouble1.0Fill opacity (0.0–1.0).

PdfColor

namespace ObviousPDF β€” Represents a colour in DeviceGray, DeviceRGB, or DeviceCMYK.

Creating Colours
// RGB (each 0.0–1.0)
var red = new PdfColor(1.0, 0.0, 0.0);

// Named factory methods
var gray = PdfColor.FromGray(0.5);
var blue = PdfColor.FromRgb(0.0, 0.2, 0.8);
var cyan = PdfColor.FromCmyk(1.0, 0.0, 0.0, 0.0);

Factory Methods

MethodDescription
new PdfColor(double r, double g, double b)RGB colour (each 0.0–1.0).
PdfColor.FromRgb(double r, double g, double b)RGB colour via factory method.
PdfColor.FromGray(double gray)Grayscale (0.0 = black, 1.0 = white).
PdfColor.FromCmyk(double c, m, y, k)CMYK colour (each 0.0–1.0).

Properties

PropertyTypeDescription
ColorSpacePdfColorSpaceDeviceGray, DeviceRGB, or DeviceCMYK.
R, G, BdoubleRGB components (0.0–1.0).
GraydoubleGrayscale component (0.0–1.0).
C, M, Y, KdoubleCMYK components (0.0–1.0).

PdfImage

namespace ObviousPDF β€” Loads and represents JPEG and PNG images for embedding.

Factory MethodDescription
PdfImage.FromFile(string path)Loads a JPEG or PNG image from file.
PdfImage.FromStream(Stream stream)Loads from stream.
PdfImage.FromBytes(byte[] data)Loads from byte array.
PropertyTypeDescription
WidthPxintImage width in pixels.
HeightPxintImage height in pixels.

PdfEmbeddedFont

namespace ObviousPDF β€” Loads TrueType/OpenType fonts for embedding with automatic subsetting.

Factory MethodDescription
PdfEmbeddedFont.FromFile(string path)Loads a .ttf/.otf font from file.
PdfEmbeddedFont.FromStream(Stream stream)Loads from stream.
PdfEmbeddedFont.FromBytes(byte[] data)Loads from byte array.

StandardFont

namespace ObviousPDF.Fonts β€” The 14 standard PDF fonts. ObviousPDF auto-embeds SIL OFL substitutes.

ValuePDF NameEmbedded Substitute
HelveticaHelveticaSora Regular
HelveticaBoldHelvetica-BoldSora Bold
HelveticaObliqueHelvetica-ObliqueSora Italic
HelveticaBoldObliqueHelvetica-BoldObliqueSora BoldItalic
TimesRomanTimes-RomanCMU Serif Roman
TimesBoldTimes-BoldCMU Serif Bold
TimesItalicTimes-ItalicCMU Serif Italic
TimesBoldItalicTimes-BoldItalicCMU Serif BoldItalic
CourierCourierCMU Typewriter Regular
CourierBoldCourier-BoldCMU Typewriter Bold
CourierObliqueCourier-ObliqueCMU Typewriter Italic
CourierBoldObliqueCourier-BoldObliqueCMU Typewriter BoldItalic
SymbolSymbolβ€”
ZapfDingbatsZapfDingbatsβ€”

PageSize

namespace ObviousPDF β€” Predefined page size tuples (width Γ— height in points).

ConstantDimensionsSize
PageSize.Letter612 Γ— 7928.5 Γ— 11 in
PageSize.Legal612 Γ— 10088.5 Γ— 14 in
PageSize.A4595.28 Γ— 841.89210 Γ— 297 mm
PageSize.A3841.89 Γ— 1190.55297 Γ— 420 mm
PageSize.A5419.53 Γ— 595.28148 Γ— 210 mm
PageSize.Tabloid792 Γ— 122411 Γ— 17 in

PdfDocumentInfo

namespace ObviousPDF β€” Document metadata.

PropertyTypeDescription
Titlestring?Document title.
Authorstring?Author name.
Subjectstring?Document subject.
Keywordsstring?Comma-separated keywords.
Creatorstring?Application that created the content.
Producerstring(auto-set) Library that produced the PDF.

PdfFormXObject

namespace ObviousPDF β€” Reusable content stream for headers, footers, watermarks.

Usage
var header = doc.CreateFormXObject(612, 35);
header.FillRectangle(0, 0, 612, 35, opts);
header.AddText("Header Text", 72, 10, textOpts);

// Place on every page
page.AddFormXObject(header, 0, 757);
MethodDescription
AddText(string, double x, y, PdfTextOptions?)Adds text to the form.
DrawLine(...)Draws a line.
DrawRectangle(...)Draws a rectangle.
FillRectangle(...)Fills a rectangle.

PdfPathBuilder

namespace ObviousPDF β€” Low-level path construction via BeginPath().

BΓ©zier Curve Path
page.BeginPath(new PdfDrawOptions { FillColor = blue })
    .MoveTo(300, 440)
    .CurveTo(350, 520, 440, 480, 420, 440)
    .ClosePath()
    .FillAndStroke();
MethodReturnsDescription
MoveTo(double x, double y)PdfPathBuilderMoves to a point.
LineTo(double x, double y)PdfPathBuilderLine to a point.
CurveTo(x1, y1, x2, y2, x3, y3)PdfPathBuilderCubic BΓ©zier curve.
ClosePath()PdfPathBuilderCloses the current subpath.
Stroke()PdfPageBuilderStrokes the path.
Fill()PdfPageBuilderFills the path.
FillAndStroke()PdfPageBuilderFills and strokes.

PdfStructureElement

namespace ObviousPDF.Accessibility β€” A node in the PDF structure tree (ISO 32000 Β§14.7.2).

Properties

PropertyTypeDescription
TypeStructureTypeThe structure type (P, H1, Table, etc.).
AltTextstring?Alternative text (required for Figures).
ActualTextstring?Actual replacement text.
Languagestring?BCP 47 language override.
Phonemestring?Phonemic transcription (PDF 2.0).
PhoneticAlphabetPdfPhoneticAlphabet?IPA or X-SAMPA.
ScopePdfTableScope?Table header scope (Row/Column/Both).
Expansionstring?Expanded abbreviation text.
BBoxdouble[]?Bounding box [llx, lly, urx, ury]. Required for Figures.
Idstring?Unique ID for header associations.
HeadersIReadOnlyList<string>Header IDs for data cells.
ChildrenIReadOnlyList<...>Child elements in reading order.
OptionalContentGroupPdfOptionalContentGroup?Associated OCG.

Methods

MethodReturnsDescription
AddChild(StructureType)PdfStructureElementAdds child at end.
AddChild(StructureType, string? altText)PdfStructureElementAdds child with alt text.
AddCaption()PdfStructureElementAdds Caption child (Table/Figure).
AddTableHead()PdfStructureElementAdds THead child.
AddTableBody()PdfStructureElementAdds TBody child.
AddTableFoot()PdfStructureElementAdds TFoot child.
AddTableRow()PdfStructureElementAdds TR child.
AddHeaderCell(PdfTableScope?, string? id, string?)PdfStructureElementAdds TH with scope and ID.
AddDataCell(params string[] headerIds)PdfStructureElementAdds TD linked to header IDs.
AddRuby(bool includeParentheses)(Ruby, RB, RT)Ruby annotation group.
AddTableOfContents()PdfStructureElementAdds TOC child.
InsertChild(int, StructureType)PdfStructureElementInserts at position.
RemoveChild(PdfStructureElement)boolRemoves a child.

StructureType (40+ types)

namespace ObviousPDF.Accessibility β€” All ISO 32000 structure types.

Document Structure

Document, Sect, Art, Part, Div, BlockQuote, NonStruct

Headings & Paragraphs

H, H1, H2, H3, H4, H5, H6, P

Tables

Table, TR, TH, TD, THead, TBody, TFoot, Caption

Lists

L, LI, Lbl, LBody

Inline Elements

Span, Link, Note, Code, Em, Strong, Quote, Reference

Media & Forms

Figure, Formula, Form

CJK / Ruby

Ruby, RB, RT, RP, Warichu, WT, WP

Table of Contents

TOC, TOCI

PdfAccessibilityChecker

namespace ObviousPDF.Accessibility β€” Validates 43+ PDF/UA, WCAG 2.2, and ISO 32000 requirements.

Usage
var checker = new PdfAccessibilityChecker();
var report = checker.Check(doc);

Console.WriteLine(report.IsFullyCompliant);  // true/false
Console.WriteLine(report.ToString());        // Human-readable report

foreach (var issue in report.NonCompliantItems)
    Console.WriteLine($"  ❌ {issue}");

PdfAccessibilityReport

MemberDescription
IsFullyComplianttrue if no non-compliant items.
CompliantItemsList of passing checks.
NonCompliantItemsList of failing checks with remediation guidance.
ToString()Human-readable report text.

PdfArtifactType

Pagination Layout Page Background

PdfTableScope

Row Column Both

PdfPhoneticAlphabet

Ipa XSampa

PdfColorContrast

Static utility for WCAG contrast checking.

MethodDescription
CalculateRatio(PdfColor fg, PdfColor bg)Returns contrast ratio (1.0–21.0).
MeetsAA(double ratio, bool largeText)Whether ratio meets WCAG AA (4.5:1 / 3:1).
MeetsAAA(double ratio, bool largeText)Whether ratio meets WCAG AAA (7:1 / 4.5:1).

Annotations

namespace ObviousPDF

PdfAnnotationType

Text FreeText Highlight Underline Squiggly StrikeOut Stamp

PdfStampIcon

Approved Experimental NotApproved AsIs Expired NotForPublicRelease Confidential Final Sold Departmental ForComment TopSecret Draft ForPublicRelease

PdfAcroField

namespace ObviousPDF β€” Interactive form field configuration.

Tagged Form Field
var formElement = root.AddChild(StructureType.Form);
var field = new PdfAcroField(PdfAcroFieldType.Text,
    "fullName", 72, 675, 250, 20)
{
    Tooltip = "Full name (required)",
    Required = true
};
page.AddTaggedAcroField(formElement, field);

PdfAcroFieldType

Text Checkbox Dropdown ListBox PushButton Signature RadioButton

PdfEncryption

namespace ObviousPDF β€” Password and permission settings.

PropertyTypeDefaultDescription
UserPasswordstring""Open password (empty = no password to open).
OwnerPasswordstring""Full-access password.
AlgorithmPdfEncryptionAlgorithmAes128Aes128 or Aes256.
AllowPrintingbooltrueAllow printing.
AllowCopyingbooltrueAllow copy/paste.
AllowModifyingbooltrueAllow editing.
AllowAnnotatingbooltrueAllow annotations.

PdfDigitalSignature

namespace ObviousPDF β€” PKCS#7/CMS digital signature configuration.

PropertyTypeDefaultDescription
CertificateX509Certificate2(required)Signing certificate with private key.
Reasonstring?nullReason for signing.
Locationstring?nullSigning location.
ContactInfostring?nullSigner contact info.
SignerNamestring?nullSigner name (defaults to cert CN).
PageIndexint0Page for signature field.
X, Ydouble0Signature field position.
Widthdouble200Signature field width.
Heightdouble50Signature field height.

Visual Effects

PdfShadingPattern

namespace ObviousPDF β€” Axial (linear) and radial gradient definitions.

Gradients
// Linear gradient
var linear = new PdfShadingPattern(
    72, 650, 300, 650,
    PdfColor.FromRgb(0.1, 0.3, 0.8),
    PdfColor.FromRgb(0.4, 0.9, 0.6));
page.FillWithShading(linear, 72, 620, 228, 60);

// Radial gradient
var radial = PdfShadingPattern.RadialGradient(
    440, 650, 0, 70,
    PdfColor.FromRgb(1, 0.9, 0.2),
    PdfColor.FromRgb(0.9, 0.2, 0.1));
page.FillWithShading(radial, 370, 580, 140, 140);

PdfTilingPattern

namespace ObviousPDF β€” Repeating tile patterns for fills.

Tiling Pattern
var stripe = new PdfTilingPattern(10, 10);
stripe.FillRectangle(0, 0, 10, 10, lightColor);
stripe.FillRectangle(0, 0, 5, 10, darkColor);
page.FillWithPattern(stripe, 72, 480, 228, 80);

Document Features

PdfOutlineItem

Bookmarks for sidebar navigation.

MethodDescription
AddChild(string title, int pageIndex)Adds a child bookmark.

PdfPageLabelStyle

Decimal LowerRoman UpperRoman LowerAlpha UpperAlpha

PdfOptionalContentGroup

Toggle-able layers (OCG). Created via doc.CreateOptionalContentGroup(name, visible).

Conformance Levels

PdfAConformanceLevel (Archival)

None PdfA1B PdfA2B PdfA3B

PdfUaConformanceLevel (Accessibility)

None PdfUA1 PdfUA2

Coordinate System

πŸ“ PDF Coordinate System

Origin (0, 0) is at the bottom-left corner. X increases to the right, Y increases upward. Units are points (1 point = 1/72 inch).

For US Letter (612 Γ— 792): Top-left = (0, 792) Β· Bottom-right = (612, 0) Β· 1-inch margins = (72, 720)

πŸ“₯ Full Markdown Reference

This HTML page covers all public API surface. For a plain-text version with all overloads, download the full API Reference markdown file.