๐ Quick Reference Patterns
Minimal PDF, accessible PDF, and the 10-step accessibility checklist โ all as copy-paste-ready code blocks.
A comprehensive reference designed for coding LLMs (GitHub Copilot, ChatGPT, Claude, etc.) to generate correct, accessible PDFs using ObviousPDF. ๐ฅ Download Markdown
Minimal PDF, accessible PDF, and the 10-step accessibility checklist โ all as copy-paste-ready code blocks.
Text, graphics, images, transforms, annotations, forms, bookmarks, page labels, Form XObjects, encryption, signatures, gradients, patterns, layers, associated files, document parts, and colour spaces.
All required steps for PDF/UA: structure trees, alt text, BBox, reading order, artifacts, language, heading hierarchy, table semantics, link structure, and form tooltips.
Known mistakes LLMs make: forgetting DisplayDocTitle, mismatched begin/end calls, missing BBox on figures, unbalanced graphics state, and more.
using ObviousPDF;
using ObviousPDF.Accessibility;
var doc = new PdfDocument();
doc.Language = "en-US"; // Required
doc.Info.Title = "My Document"; // Required
doc.DisplayDocTitle = true; // Required
doc.PdfUaConformance = PdfUaConformanceLevel.PdfUA1;
var root = doc.EnableTaggedPdf();
var sect = root.AddChild(StructureType.Sect);
var h1 = sect.AddChild(StructureType.H1);
var para = sect.AddChild(StructureType.P);
var page = doc.AddPage();
page.AddTaggedText(h1, "Title", 72, 720,
new PdfTextOptions {
Font = StandardFont.HelveticaBold,
FontSize = 24 });
page.AddTaggedText(para, "Body text.", 72, 690);
page.AddArtifactText("Page 1", 285, 30,
PdfArtifactType.Pagination);
var report = new PdfAccessibilityChecker().Check(doc);
// report.IsFullyCompliant โ true โ
doc.Save("accessible.pdf");
| # | Step | Code |
|---|---|---|
| 1 | Set document language | doc.Language = "en-US" |
| 2 | Set title | doc.Info.Title = "..." |
| 3 | Display title | doc.DisplayDocTitle = true |
| 4 | Enable tagging | doc.EnableTaggedPdf() |
| 5 | Tag all content | AddTaggedText(), BeginTaggedContent() |
| 6 | Mark decorative content | BeginArtifact(), AddArtifactText() |
| 7 | Alt text + BBox on figures | AddChild(Figure, "alt"); fig.BBox = ... |
| 8 | Heading hierarchy H1โH2โH3 | No skipping levels |
| 9 | Table headers with scope | AddHeaderCell(scope, id) |
| 10 | Validate | new PdfAccessibilityChecker().Check(doc) |