๐Ÿค– LLM Guide

A comprehensive reference designed for coding LLMs (GitHub Copilot, ChatGPT, Claude, etc.) to generate correct, accessible PDFs using ObviousPDF. ๐Ÿ“ฅ Download Markdown

๐Ÿค– For AI Coding Assistants

Drop the LLM_GUIDE.md file into your project root or custom instructions to give your AI assistant complete knowledge of the ObviousPDF API, accessibility patterns, and common pitfalls.

What's Covered

๐Ÿ“ Quick Reference Patterns

Minimal PDF, accessible PDF, and the 10-step accessibility checklist โ€” all as copy-paste-ready code blocks.

๐Ÿ”ง 17 Feature Areas

Text, graphics, images, transforms, annotations, forms, bookmarks, page labels, Form XObjects, encryption, signatures, gradients, patterns, layers, associated files, document parts, and colour spaces.

โ™ฟ Complete Accessibility Guide

All required steps for PDF/UA: structure trees, alt text, BBox, reading order, artifacts, language, heading hierarchy, table semantics, link structure, and form tooltips.

โš ๏ธ Common Pitfalls

Known mistakes LLMs make: forgetting DisplayDocTitle, mismatched begin/end calls, missing BBox on figures, unbalanced graphics state, and more.

Sample: Minimal Accessible PDF Pattern

From LLM_GUIDE.md โ€” Accessible Pattern
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");

10-Step Accessibility Checklist

#StepCode
1Set document languagedoc.Language = "en-US"
2Set titledoc.Info.Title = "..."
3Display titledoc.DisplayDocTitle = true
4Enable taggingdoc.EnableTaggedPdf()
5Tag all contentAddTaggedText(), BeginTaggedContent()
6Mark decorative contentBeginArtifact(), AddArtifactText()
7Alt text + BBox on figuresAddChild(Figure, "alt"); fig.BBox = ...
8Heading hierarchy H1โ†’H2โ†’H3No skipping levels
9Table headers with scopeAddHeaderCell(scope, id)
10Validatenew PdfAccessibilityChecker().Check(doc)