# Symbol reference

> Every symbol exported by @birchui/pdf and @birchui/pdf/engine with its declaration, grouped by area and generated from the source.

This page lists every exported symbol with its declaration. It is generated from the source by `packages/pdf/scripts/generate-reference.mjs`, and a test fails when it is out of date. Types can be imported from either entry; for values, the entry is given.

## Viewer

### AnnotationSyncChannel

Type.

```text
interface AnnotationSyncChannel {
  actorId?: string;
  color?: string;
  send(operations: SyncOperation[]): void;
  onRemote(receive: (operations: SyncOperation | SyncOperation[]) => void): (() => void) | void;
  sendPresence?(message: PresenceMessage): void;
  onRemotePresence?(receive: (message: PresenceMessage) => void): (() => void) | void;
  onConflict?(conflict: SyncConflict): void;
  snapshot?: SyncSnapshot;
  sendFormValues?(operations: FormSyncOperation[]): void;
  onRemoteFormValues?(receive: (operations: FormSyncOperation | FormSyncOperation[]) => void): (() => void) | void;
  onFormConflict?(conflict: FormSyncConflict): void;
  sendPageOperations?(operations: PageSyncOperation[]): void;
  onRemotePageOperations?(receive: (operations: PageSyncOperation | PageSyncOperation[]) => void): (() => void) | void;
  onPageConflict?(conflict: PageSyncConflict): void;
  presenceTimeout?: number;
  onPresenceChange?(collaborators: PresenceState[]): void;
}
```

### AttachmentOpenEvent

Type.

```text
interface AttachmentOpenEvent {
  name: string;
  mimeType: string;
  size: number;
  data: Uint8Array;
  source: 'document' | 'annotation';
  pageIndex?: number;
  relationship?: AttachmentRelationship;
  description?: string;
}
```

### CommentFilter

Type.

```text
interface CommentFilter {
  author?: string;
  type?: AnnotationType;
  status?: ReviewStatus;
  pages?: number[];
}
```

### CommentSort

Type.

```text
type CommentSort = 'page' | 'date' | 'author' | 'type';
```

### CommentSummaryFormat

Type.

```text
type CommentSummaryFormat = 'pdf' | 'html' | 'csv';
```

### CommentSummaryOptions

Type.

```text
interface CommentSummaryOptions extends CommentFilter {
  format: CommentSummaryFormat;
  sort?: CommentSort;
  title?: string;
  includeReplies?: boolean;
  fonts?: PdfFontSource[];
  allowMissingGlyphs?: boolean;
}
```

### createPdfViewer

Value, from `@birchui/pdf`.

```text
function createPdfViewer(container: HTMLElement, options?: PdfViewerOptions): PdfViewerApi;
```

### createSyncChannel

Value, from `@birchui/pdf`.

```text
function createSyncChannel(transport: SyncTransport, options?: SyncChannelOptions): AnnotationSyncChannel;
```

### CustomToolbarItem

Type.

```text
interface CustomToolbarItem {
  type: 'custom';
  id: string;
  label: string;
  icon?: string;
  onClick: (viewer: PdfViewerApi) => void;
  isDisabled?: (viewer: PdfViewerApi) => boolean;
}
```

### DEFAULT_LABELS

Value, from `@birchui/pdf`.

```text
const DEFAULT_LABELS: Record<"save" | "attachmentOpen" | "password" | "theme" | "toolbar" | "shortcuts" | "sidebar" | "zoom" | "keepToolSelected" | "fullscreen" | "openFile" | "properties" | "calibrate" | ... 1249 more ... | "exportNoTables", string> & { ...; };
```

### DocCommandId

Type.

```text
type DocCommandId =
  | 'fullscreen'
  | 'openFile'
  | 'properties'
  | 'calibrate'
  | 'contentAddImage'
  | 'contentReplaceImage'
  | 'contentDeleteImage'
  | 'contentRotateImageLeft'
  | 'contentRotateImageRight'
  | 'contentImageProperties'
  | 'contentTextStyle'
  | 'findReplace'
  | 'pageObjectsPanel'
  | 'pageDecorations'
  | 'background'
  | 'imagesToPdf'
  | 'watermark'
  | 'headerFooter'
  | 'bates'
  | 'fieldsPanel'
  | 'formCheck'
  | 'detectFields'
  | 'accessibilityCheck'
  | 'formImport'
  | 'formExportFdf'
  | 'formExportXfdf'
  | 'formExportJson'
  | 'formExportXml'
  | 'searchRedact'
  | 'applyRedactions'
  | 'signDocument'
  | 'signaturesPanel'
  | 'security'
  | 'sanitize'
  | 'recognizeText'
  | 'optimize'
  | 'compare'
  | 'exportImages'
  | 'exportText'
  | 'flattenAnnotations'
  | 'flattenForms'
  | 'flattenAll'
  | 'attachmentsPanel';
```

### DynamicStampContext

Type.

```text
interface DynamicStampContext {
  user: PdfUser;
  now: Date;
  locale: string;
}
```

### ExportedPageFile

Type.

```text
interface ExportedPageFile {
  pageIndex: number;
  fileName: string;
  mimeType: 'image/png' | 'image/jpeg';
  data: Uint8Array;
}
```

### ExportPageImagesOptions

Type.

```text
interface ExportPageImagesOptions {
  /** Pages to export, from 0. All pages by default. */
  pages?: number[];
  format?: 'png' | 'jpeg';
  /** Resolution, 36 to 600. 150 by default. */
  dpi?: number;
  /** JPEG quality, 0.1 to 1. 0.85 by default. */
  quality?: number;
  signal?: AbortSignal;
  onProgress?: (progress: { pageIndex: number; position: number; total: number }) => void;
}
```

### ExportTextOptions

Type.

```text
interface ExportTextOptions {
  pages?: number[];
  /** `false` leaves out the line that marks where each page starts. */
  pageBreaks?: boolean;
}
```

### ExtractImagesOptions

Type.

```text
interface ExtractImagesOptions {
  renderFallback?: boolean;
}
```

### FormDataFormat

Type.

```text
type FormDataFormat = 'fdf' | 'xfdf' | 'json' | 'xml';
```

### FormFieldDraft

Type.

```text
interface FormFieldDraft {
  type: FormFieldInput['type'];
  name?: string;
  options?: string[];
}
```

### FormSubmitEvent

Type.

```text
interface FormSubmitEvent {
  url: string;
  method: 'get' | 'post';
  format: SubmitFormat;
  body: PdfBytes | string;
  contentType: string;
  fieldNames: string[];
  fieldName?: string;
}
```

### KEYBOARD_SHORTCUTS

Value, from `@birchui/pdf`.

```text
const KEYBOARD_SHORTCUTS: readonly Shortcut[];
```

### MailConversionEvent

Type.

```text
interface MailConversionEvent {
  format: MailFormat;
  sourceFileName: string;
  fileName: string;
  pageCount: number;
  message: MailConversionSummary;
  warnings: MailPdfWarning[];
}
```

### MailConversionOptions

Type.

```text
interface MailConversionOptions extends Omit<MailToPdfOptions, 'attachOriginal'> {
  attachOriginal?: boolean;
}
```

### MailConversionSummary

Type.

```text
interface MailConversionSummary {
  subject: string;
  from?: MailAddress;
  to: MailAddress[];
  cc: MailAddress[];
  sentAt?: Date;
  attachments: { fileName: string; mimeType: string; size: number; isInline: boolean }[];
}
```

### MentionCandidate

Type.

```text
interface MentionCandidate {
  id: string;
  name: string;
  description?: string;
}
```

### MentionEvent

Type.

```text
interface MentionEvent {
  user: MentionCandidate;
  annotation: PdfAnnotation;
  replyId?: string;
}
```

### MentionOptions

Type.

```text
interface MentionOptions {
  search(query: string, context: { signal: AbortSignal }): MentionCandidate[] | Promise<MentionCandidate[]>;
  onMention?(event: MentionEvent): void;
  debounce?: number;
}
```

### OcrPageOutcome

Type.

```text
interface OcrPageOutcome {
  pageIndex: number;
  status: 'recognized' | 'has-text' | 'no-text' | 'failed';
  /** Words written to the invisible text layer. */
  words: number;
  message?: string;
}
```

### OcrPageState

Type.

```text
type OcrPageState = 'running' | 'recognized' | 'failed' | 'no-text';
```

### OptimizePreset

Type.

```text
type OptimizePreset = 'lossless' | 'balanced' | 'smallest';
```

### PageCommandId

Type.

```text
type PageCommandId =
  | 'pagesOrganize'
  | 'pagesMerge'
  | 'pagesInsertBlank'
  | 'pagesInsertPdf'
  | 'pagesInsertImages'
  | 'pagesInsertClipboard'
  | 'pagesDelete'
  | 'pagesRotateLeft'
  | 'pagesRotateRight'
  | 'pagesDuplicate'
  | 'pagesExtract'
  | 'pagesSplit'
  | 'pagesReplace'
  | 'pagesMove'
  | 'pagesReverse'
  | 'pagesCrop'
  | 'pagesResize'
  | 'pagesNumbers'
  | 'pagesRemoveNumbers'
  | 'pagesLabels'
  | 'pagesBoxes'
  | 'pagesDeleteBlank'
  | 'pagesAutoRotate'
  | 'pagesInterleave'
  | 'pagesImpose'
  | 'pagesOptimize';
```

### PDF_VIEWER_EVENT_NAMES

Value, from `@birchui/pdf`.

```text
const PDF_VIEWER_EVENT_NAMES: readonly (keyof PdfViewerEvents)[];
```

### PdfFileConverter

Type.

```text
type PdfFileConverter = (
  data: Uint8Array,
  file: { name: string; type: string },
) => Promise<Uint8Array | ArrayBuffer | undefined> | Uint8Array | ArrayBuffer | undefined;
```

### PdfLayer

Type.

```text
interface PdfLayer {
  id: string;
  name: string;
  isVisible: boolean;
  depth: number;
  groups: string[];
  radioGroup: string[];
}
```

### pdfLocaleDe

Value, from `@birchui/pdf`.

```text
const pdfLocaleDe: PdfViewerLabels;
```

### pdfLocaleEn

Value, from `@birchui/pdf`.

```text
const pdfLocaleEn: PdfViewerLabels;
```

### pdfLocaleEs

Value, from `@birchui/pdf`.

```text
const pdfLocaleEs: PdfViewerLabels;
```

### pdfLocaleFr

Value, from `@birchui/pdf`.

```text
const pdfLocaleFr: PdfViewerLabels;
```

### pdfLocaleJa

Value, from `@birchui/pdf`.

```text
const pdfLocaleJa: PdfViewerLabels;
```

### pdfLocalePt

Value, from `@birchui/pdf`.

```text
const pdfLocalePt: PdfViewerLabels;
```

### pdfLocaleZh

Value, from `@birchui/pdf`.

```text
const pdfLocaleZh: PdfViewerLabels;
```

### PdfProgressiveSource

Type.

```text
type PdfProgressiveSource = PdfUrlSource | PdfRangeSource;
```

### PdfRangeLoader

Type.

```text
interface PdfRangeLoader {
  length: number;
  read(begin: number, end: number): Promise<Uint8Array>;
  initialData?: Uint8Array;
}
```

### PdfRangeSource

Type.

```text
interface PdfRangeSource {
  rangeLoader: PdfRangeLoader;
}
```

### PdfRenderer

Type.

```text
interface PdfRenderer {
  getDocument(source: RendererDocumentSource): RendererLoadingTask;
  AnnotationMode?: { DISABLE: number; ENABLE?: number };
  RangeTransport?: new (length: number, initialData: Uint8Array | null) => RendererRangeTransport;
  readonly mode?: 'worker' | 'main';
  destroy?(): void;
}
```

### PdfRendererSource

Type.

```text
type PdfRendererSource = PdfRenderer | (() => PdfRenderer | Promise<PdfRenderer>);
```

### PdfRenderOptions

Type.

```text
interface PdfRenderOptions {
  renderLimits?: Partial<RenderLimits>;
  maxRenderMs?: number;
  substituteFont?: SubstituteFontProvider;
  /**
   * Draw fonts a document does not embed from the bundled substitute outlines, loaded on first use. On by
   * default; `false` leaves that text to the fonts of the device.
   */
  standardFonts?: boolean;
  /**
   * Read fonts encoded with a predefined CJK CMap through the bundled tables, loaded per character collection on
   * first use. On by default; `false` leaves such fonts undrawn when they are embedded.
   */
  predefinedCMaps?: boolean;
}
```

### PdfSource

Type.

```text
type PdfSource = Uint8Array | ArrayBuffer | Blob;
```

### PdfTabInfo

Type.

```text
interface PdfTabInfo {
  id: string;
  fileName: string;
  isActive: boolean;
  isModified: boolean;
  pageCount: number;
}
```

### PdfUrlSource

Type.

```text
interface PdfUrlSource {
  url: string;
  httpHeaders?: Record<string, string>;
  withCredentials?: boolean;
}
```

### PdfUser

Type.

```text
interface PdfUser {
  name: string;
  id?: string;
  isAdmin?: boolean;
}
```

### PdfViewerApi

Type.

```text
interface PdfViewerApi extends Widget<PdfViewerOptions, PdfViewerEvents> {
  readonly ready: Promise<void>;
  load(source: PdfSource | PdfProgressiveSource, options?: { fileName?: string; password?: string }): Promise<void>;
  isEditable(): boolean;
  openTab(
    source: PdfSource | PdfProgressiveSource,
    options?: { fileName?: string; password?: string },
  ): Promise<string>;
  closeTab(id: string): boolean;
  activateTab(id: string): boolean;
  getTabs(): PdfTabInfo[];
  getViewState(): PdfViewState;
  setViewState(state: Partial<PdfViewState>): void;
  runCommand(command: ViewerCommand): boolean;
  getCommands(): ViewerCommandInfo[];
  openCommandPalette(): void;
  getLayers(): Promise<PdfLayer[]>;
  setLayerVisibility(id: string, isVisible: boolean): Promise<void>;
  getPageCount(): number;
  getPages(): PdfPageSummary[];
  getCurrentPage(): number;
  goToPage(pageIndex: number, options?: { point?: PdfPoint }): void;
  nextPage(): void;
  previousPage(): void;
  getZoom(): number;
  setZoom(zoom: ZoomValue): void;
  zoomIn(): void;
  zoomOut(): void;
  getRotation(): number;
  rotateView(delta?: number): void;
  search(query: string, options?: SearchOptions): Promise<{ total: number }>;
  searchNext(): void;
  searchPrevious(): void;
  clearSearch(): void;
  print(options?: PrintOptions): Promise<void>;
  getScrollMode(): ScrollMode;
  setScrollMode(mode: ScrollMode): void;
  getSpread(): SpreadMode;
  setSpread(spread: SpreadMode): void;
  getPageLabel(pageIndex: number): string;
  enterPresentation(): void;
  exitPresentation(): void;
  toggleFullscreen(): void;
  zoomToRect(pageIndex: number, rect: PdfRect): void;
  getRenderStats(): RenderStats;
  download(fileName?: string): Promise<void>;
  save(options?: SaveOptions): Promise<SaveResult>;
  isModified(): boolean;
  getTool(): ViewerTool;
  setTool(tool: ViewerTool, options?: { stamp?: BuiltInStamp | string; field?: FormFieldDraft }): void;
  getAnnotations(pageIndex?: number): PdfAnnotation[];
  getAnnotation(id: string): PdfAnnotation | undefined;
  addAnnotation(input: AnnotationInput): PdfAnnotation;
  addAnnotations(inputs: AnnotationInput[]): PdfAnnotation[];
  addTextMarkup(
    type: TextMarkupType,
    pageIndex: number,
    rects: PdfRect[],
    options?: Partial<AnnotationInput>,
  ): PdfAnnotation;
  updateAnnotation(id: string, patch: AnnotationPatch): PdfAnnotation | undefined;
  removeAnnotation(id: string | string[]): void;
  selectAnnotation(id: string | null): void;
  getSelectedAnnotation(): PdfAnnotation | undefined;
  getSelectedAnnotations(): PdfAnnotation[];
  selectAnnotations(ids: string[]): void;
  addReply(annotationId: string, reply: { contents: string; author?: string }): AnnotationReply | undefined;
  updateReply(annotationId: string, replyId: string, contents: string): AnnotationReply | undefined;
  removeReply(annotationId: string, replyId: string): boolean;
  setAuthor(author: string): void;
  undo(): boolean;
  redo(): boolean;
  canUndo(): boolean;
  canRedo(): boolean;
  markRedactions(query: RedactionQuery, options?: RedactionSearchOptions): PdfAnnotation[];
  applyRedactions(ids?: string[]): number;
  applyRedactionsAsync(ids?: string[]): Promise<number>;
  getCollaborators(): PresenceState[];
  getSyncSnapshot(): SyncSnapshot | undefined;
  mergeSyncSnapshot(snapshot: SyncSnapshot): void;
  getFormFields(): PdfFormField[];
  getFormValues(): Record<string, FormValue>;
  setFormValue(name: string, value: FormValue): void;
  setFormValues(values: Record<string, FormValue>): void;
  resetForm(names?: string[]): void;
  validateForm(): FormIssue[];
  exportFormData(format: 'fdf'): PdfBytes;
  exportFormData(format: 'xfdf' | 'json' | 'xml'): string;
  importFormData(
    data: Uint8Array | ArrayBuffer | string | Record<string, unknown>,
    format?: FormDataFormat,
  ): FormImportResult;
  downloadFormData(format: FormDataFormat): void;
  addFormField(input: FormFieldInput): PdfFormField;
  detectFormFields(pageIndexes?: readonly number[]): DetectedField[];
  checkAccessibility(): AccessibilityReport;
  getFigures(): PdfFigure[];
  setAlternateText(figureId: string, alternateText: string): Promise<boolean>;
  setLanguage(language: string): Promise<void>;
  addDetectedFields(fields?: readonly DetectedField[]): PdfFormField[];
  updateFormField(name: string, patch: FormFieldPatch): PdfFormField | undefined;
  removeFormField(name: string): boolean;
  getSignatures(): Promise<(SignatureInfo & { fieldName: string })[]>;
  verifySignatures(): Promise<PdfSignatureVerification[]>;
  signDocument(options: SignPdfOptions): Promise<PdfBytes>;
  compareWith(
    other: PdfSource,
    options?: { fileName?: string; password?: string; view?: 'text' | 'visual' },
  ): Promise<void>;
  movePage(from: number, to: number): void;
  movePages(indices: number[], target: number): void;
  reversePages(indices?: number[]): void;
  duplicatePages(indices: number[]): Promise<number>;
  insertPagesFrom(source: PdfSource, pageIndexes: number[], at?: number): Promise<number>;
  insertImagePages(images: (Uint8Array | ImagePageInput)[], at?: number, options?: ImagesToPdfOptions): Promise<number>;
  resizePages(indices: number[], options: ResizePagesOptions): Promise<void>;
  getPageBoxes(pageIndex: number): PageBoxes;
  setPageBoxes(indices: number[], boxes: PageBoxesPatch): Promise<void>;
  splitDocument(options: SplitOptions): Promise<SplitPart[]>;
  openPageOrganizer(): void;
  closePageOrganizer(): void;
  rotatePages(indices: number[], degrees?: number): void;
  deletePages(indices: number[]): void;
  insertBlankPage(at: number, size?: { width: number; height: number }): number;
  mergeDocument(source: PdfSource, at?: number): Promise<number>;
  extractPages(indices: number[], options?: { deleteExtracted?: boolean }): Promise<PdfBytes>;
  replacePages(indices: number[], source: PdfSource, sourceIndices?: number[]): Promise<number>;
  interleaveDocument(source: PdfSource, options?: InterleaveOptions): Promise<numbe
// continues in the source
```

### pdfViewerDefinition

Value, from `@birchui/pdf`.

```text
const pdfViewerDefinition: WidgetDefinition<PdfViewerOptions | undefined, { documentLoad: any; documentPreview: any; layersChange: any; viewStateChange: any; tabChange: any; documentError: any; pageChange: any; ... 32 more ...; documentSanitize: any; }, PdfViewerApi>;
```

### PdfViewerEvents

Type.

```text
interface PdfViewerEvents {
  documentLoad: { pageCount: number; fileName?: string; title?: string };
  documentPreview: { pageCount: number; fileName?: string };
  layersChange: { layers: PdfLayer[] };
  viewStateChange: { state: PdfViewState };
  tabChange: { tabs: PdfTabInfo[]; activeId: string | undefined };
  documentError: { error: unknown; message: string };
  pageChange: { pageIndex: number; previousPageIndex: number; pageCount: number };
  zoomChange: { zoom: number; mode: ZoomValue };
  annotationPresetsChange: { presets: AnnotationPreset[] };
  annotationAdd: { annotations: PdfAnnotation[]; source: ChangeSource };
  annotationChange: { changes: { before: PdfAnnotation; after: PdfAnnotation }[]; source: ChangeSource };
  annotationRemove: { annotations: PdfAnnotation[]; source: ChangeSource };
  annotationSelect: { annotation: PdfAnnotation | null; annotations: PdfAnnotation[] };
  layoutChange: { scrollMode: ScrollMode; spread: SpreadMode };
  presentationChange: { isPresenting: boolean };
  printProgress: { page: number; total: number; isDone: boolean; isCancelled: boolean };
  formFieldChange: { name: string; value: FormValue; previousValue: FormValue; source: ChangeSource };
  pagesChange: { pages: PdfPageSummary[]; reason: string };
  documentChange: { reason: string };
  fontMissing: MissingGlyphReport;
  toolChange: { tool: ViewerTool };
  searchResult: { query: string; total: number; current: number };
  historyChange: { canUndo: boolean; canRedo: boolean };
  save: { bytes: PdfBytes; mode: 'incremental' | 'full'; fileName: string };
  formValidation: { issues: FormIssue[]; isValid: boolean };
  formSubmit: FormSubmitEvent;
  formReset: { names: string[]; changed: string[] };
  formDataExport: { format: FormDataFormat; data: Uint8Array | string; fileName: string };
  pagesSplit: { parts: SplitPart[] };
  filesMerge: { files: string[]; pageCount: number; result: 'inserted' | 'new'; bytes?: PdfBytes };
  mailConversion: MailConversionEvent;
  attachmentOpen: AttachmentOpenEvent;
  textRecognition: { pages: OcrPageOutcome[]; isCancelled: boolean };
  pagesExport: { format: 'png' | 'jpeg'; files: ExportedPageFile[] };
  textExport: { text: string; pages: number[] };
  officeExport: { format: 'docx' | 'xlsx'; bytes: Uint8Array; pages: number[]; tables: number };
  fillInitialsChange: { initials: string };
  organizerSecondChange: { bytes: Uint8Array; fileName: string; pageCount: number };
  compareReport: { format: CompareReportFormat; report: string; summary: PdfComparisonSummary };
  documentSanitize: { report: SanitizeReport };
}
```

### PdfViewerLabels

Type.

```text
type PdfViewerLabels = Record<LabelKey, string> & { tools: Record<ViewerTool, string> };
```

### PdfViewerOptions

Type.

```text
interface PdfViewerOptions {
  document?: PdfSource | PdfProgressiveSource;
  rangeChunkSize?: number;
  fileName?: string;
  password?: string;
  allowFetch?: boolean;
  fetchDocument?: RendererFetchDocument;
  renderer?: PdfRendererSource;
  worker?: PdfWorkerSource;
  renderOptions?: PdfRenderOptions;
  renderPage?: (context: RenderPageContext) => Promise<void> | void;
  licenseKey?: string;
  injectStyles?: boolean;
  theme?: 'light' | 'dark' | 'auto';
  invertPagesInDark?: boolean;
  height?: number | string;
  ariaLabel?: string;
  toolbar?: boolean | ToolbarItem[];
  toolbarPreset?: ToolbarPreset;
  initialViewState?: Partial<PdfViewState>;
  shortcuts?: ShortcutOverrides;
  tools?: ViewerTool[];
  sidebar?: false | SidebarPanel;
  sidebarPanels?: SidebarPanel[];
  isSidebarOpen?: boolean;
  initialPage?: number;
  zoom?: ZoomValue;
  minZoom?: number;
  maxZoom?: number;
  spread?: SpreadMode;
  scrollMode?: ScrollMode;
  pageDirection?: 'ltr' | 'rtl';
  toolGroup?: ToolGroup;
  author?: string;
  currentUser?: string | PdfUser;
  canEdit?: (annotation: PdfAnnotation, user: PdfUser) => boolean;
  readOnly?: boolean;
  annotationSync?: AnnotationSyncChannel;
  ignorePermissions?: boolean;
  locale?: string;
  localeText?: LocaleTextInput;
  rtl?: boolean;
  onPasswordRequest?: (request: {
    isRetry: boolean;
    fileName: string;
  }) => string | undefined | null | Promise<string | undefined | null>;
  signatureStorage?: SignatureStorage;
  ocr?: ViewerOcrOptions;
  trustedCertificates?: (Uint8Array | string)[];
  /** Trust lists read with `loadTrustList`; a list past its expiry date is not used. */
  trustLists?: PdfTrustList[];
  allowFileDrop?: boolean;
  fileConverters?: Record<string, PdfFileConverter>;
  fillInitials?: string;
  welcome?: boolean;
  convertMail?: boolean | MailConversionOptions;
  decodeImage?: ImageDecoder;
  tabs?: boolean;
  printResolution?: number;
  snapping?: boolean;
  keepToolSelected?: boolean;
  pixelRatio?: number;
  maxRenderPixels?: number;
  placeholders?: boolean;
  enableForms?: boolean;
  enablePageTools?: boolean;
  enableFormDesigner?: boolean;
  highlightRequiredFields?: boolean;
  tool?: ViewerTool;
  annotationDefaults?: Partial<Record<AnnotationType, Partial<AnnotationDefaults>>>;
  annotationPresets?: AnnotationPreset[];
  fonts?: PdfFontSource[];
  fontFallback?: PdfFontFallback;
  mentions?: MentionOptions;
  allowMissingGlyphs?: boolean;
  /**
   * How annotation text is saved when no supplied font has its characters. By default the viewer draws it with the
   * fonts of the browser and stores the drawing in the appearance, so the save never fails; `false` turns that off.
   */
  textRasterizer?: PdfTextRasterizer | false;
  annotationScope?: 'markup' | 'all';
  stamps?: StampDefinition[];
  /** Called with the whole list when a stamp is created or deleted in the stamp gallery. */
  onStampsChange?: (stamps: StampDefinition[]) => void;
  labels?: Partial<Record<LabelKey, string>> & { tools?: Partial<Record<ViewerTool, string>> };
  maxCanvasPixels?: number;
  pageGap?: number;
  createId?: () => string;
  now?: () => Date;
}
```

### PdfViewState

Type.

```text
interface PdfViewState {
  pageIndex: number;
  zoom: ZoomValue;
  scrollMode: ScrollMode;
  spread: SpreadMode;
  rotation: number;
  sidebar: { isOpen: boolean; panel: SidebarPanel };
  scrollOffset: { x: number; y: number };
}
```

### PdfWorkerSource

Type.

```text
type PdfWorkerSource = boolean | Worker | (() => Worker);
```

### PrintMode

Type.

```text
type PrintMode = 'auto' | 'vector' | 'raster';
```

### PrintOptions

Type.

```text
interface PrintOptions {
  pages?: 'all' | 'current' | number[] | string;
  resolution?: number;
  annotations?: boolean;
  mode?: PrintMode;
  /** Size on paper: the size of the page, fitted to the paper, or a percentage. Anything but `'actual'` prints as images. */
  scale?: PrintScale;
}
```

### PrintScale

Type.

```text
type PrintScale = 'actual' | 'fit' | number;
```

### ReadAloudChunk

Type.

```text
interface ReadAloudChunk {
  pageIndex: number;
  text: string;
  quads: PdfQuad[];
}
```

### ReadAloudHandle

Type.

```text
interface ReadAloudHandle {
  readonly isPaused: boolean;
  readonly isStopped: boolean;
  readonly finished: Promise<void>;
  pause(): void;
  resume(): void;
  stop(): void;
}
```

### ReadAloudOptions

Type.

```text
interface ReadAloudOptions {
  fromPage?: number;
  onText?: (chunk: ReadAloudChunk) => void | Promise<void>;
  lang?: string;
  rate?: number;
}
```

### RecognizeTextRequest

Type.

```text
interface RecognizeTextRequest {
  /** Pages to work on, from 0. All pages by default. */
  pages?: number[];
  /** Also recognise pages that already have text. */
  includePagesWithText?: boolean;
  language?: string;
  signal?: AbortSignal;
  onProgress?: (progress: { pageIndex: number; position: number; total: number; progress: number }) => void;
}
```

### RendererDocument

Type.

```text
interface RendererDocument {
  numPages: number;
  getPage(pageNumber: number): Promise<RendererPage>;
  getOutline(): Promise<RendererOutlineItem[] | null>;
  getDestination(id: string): Promise<unknown[] | null>;
  getPageIndex(ref: unknown): Promise<number>;
  getPageLabels?(): Promise<string[] | null>;
  getMetadata?(): Promise<{ info?: Record<string, unknown> } | null>;
  getAttachments?(): Promise<Record<string, { filename?: string; content?: Uint8Array; description?: string }> | null>;
  getData?(): Promise<Uint8Array>;
  getOptionalContentConfig?(params?: { intent?: string }): Promise<RendererOptionalContentConfig>;
  destroy(): Promise<void>;
}
```

### RendererDocumentSource

Type.

```text
interface RendererDocumentSource {
  data?: Uint8Array;
  url?: string;
  httpHeaders?: Record<string, string>;
  withCredentials?: boolean;
  range?: RendererRangeTransport;
  length?: number;
  password?: string;
  rangeChunkSize?: number;
  allowFetch?: boolean;
  fetchDocument?: RendererFetchDocument;
}
```

### RendererFetchDocument

Type.

```text
type RendererFetchDocument = (request: RendererFetchRequest) => Promise<RendererFetchReply>;
```

### RendererFetchReply

Type.

```text
interface RendererFetchReply {
  bytes: Uint8Array | ArrayBuffer;
  total?: number;
}
```

### RendererFetchRequest

Type.

```text
interface RendererFetchRequest {
  url: string;
  range?: { begin: number; end: number };
  headers?: Record<string, string>;
  withCredentials: boolean;
  signal: AbortSignal;
}
```

### RendererLoadingTask

Type.

```text
interface RendererLoadingTask {
  promise: Promise<RendererDocument>;
  destroy(): Promise<void>;
  onPassword?: (update: (password: string) => void, reason: number) => void;
}
```

### RendererPage

Type.

```text
interface RendererPage {
  view: number[];
  rotate: number;
  getViewport(params: { scale: number; rotation?: number; offsetX?: number; offsetY?: number }): RendererViewport;
  render(params: {
    canvas?: HTMLCanvasElement | OffscreenCanvas | null;
    canvasContext?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
    viewport: RendererViewport;
    transform?: number[];
    annotationMode?: number;
    background?: string | null;
    intent?: string;
    optionalContentConfigPromise?: Promise<RendererOptionalContentConfig | null | undefined>;
  }): RendererRenderTask;
  getTextContent(params?: { includeMarkedContent?: boolean }): Promise<RendererTextContent>;
  getStructTree?(): Promise<RendererStructNode | null | undefined>;
  getAnnotations?(params?: { intent?: string }): Promise<RendererLinkAnnotation[]>;
  cleanup?(): void;
}
```

### RenderPageContext

Type.

```text
interface RenderPageContext {
  pageIndex: number;
  canvas: HTMLCanvasElement;
  viewport: RendererViewport;
  scale: number;
  pixelRatio: number;
  area?: { x: number; y: number; width: number; height: number };
  signal: AbortSignal;
  defaultRender(): Promise<void>;
}
```

### RenderStats

Type.

```text
interface RenderStats {
  views: number;
  renderedViews: number;
  canvasPixels: number;
  queued: number;
  thumbnails: number;
  thumbnailPixels: number;
  renderMode: 'worker' | 'main';
}
```

### resolveShortcuts

Value, from `@birchui/pdf`.

```text
function resolveShortcuts(overrides: ShortcutOverrides | undefined, warn?: (message: string) => void): readonly Shortcut[];
```

### SavedSignature

Type.

```text
interface SavedSignature {
  id: string;
  draft: SignatureDraft;
  createdAt: string;
}
```

### ScrollMode

Type.

```text
type ScrollMode = 'vertical' | 'horizontal' | 'page';
```

### SearchOptions

Type.

```text
interface SearchOptions {
  caseSensitive?: boolean;
  wholeWord?: boolean;
  diacriticSensitive?: boolean;
  regex?: boolean;
}
```

### Shortcut

Type.

```text
interface Shortcut {
  keys: string;
  command: ViewerCommand;
  description: string;
}
```

### shortcutFor

Value, from `@birchui/pdf`.

```text
function shortcutFor(event: KeyLike, isPresenting?: boolean, shortcuts?: readonly Shortcut[]): ViewerCommand | undefined;
```

### ShortcutOverrides

Type.

```text
type ShortcutOverrides = Partial<Record<ViewerCommand, string | string[] | false>>;
```

### SidebarPanel

Type.

```text
type SidebarPanel =
  | 'thumbnails'
  | 'outline'
  | 'annotations'
  | 'fields'
  | 'search'
  | 'redaction'
  | 'attachments'
  | 'signatures'
  | 'layers'
  | 'objects';
```

### SignatureDraft

Type.

```text
interface SignatureDraft {
  kind: 'drawn' | 'typed' | 'image';
  inkList?: PdfPoint[][];
  text?: string;
  image?: { data: Uint8Array; mimeType: 'image/png' | 'image/jpeg'; width: number; height: number };
}
```

### SignatureStorage

Type.

```text
interface SignatureStorage {
  load(): SavedSignature[] | Promise<SavedSignature[]>;
  save(signatures: SavedSignature[]): void | Promise<void>;
}
```

### SpreadMode

Type.

```text
type SpreadMode = 'none' | 'odd' | 'even';
```

### StampDefinition

Type.

```text
interface StampDefinition {
  name: string;
  label: string | ((context: DynamicStampContext) => string);
  color?: string;
  /** A function, or text in which `{name}` and `{date}` stand for the current user and the date and time. */
  subtitle?: string | ((context: DynamicStampContext) => string);
  /** Set on stamps made in the stamp gallery; these can be deleted there. */
  isUserMade?: boolean;
}
```

### SyncChannelName

Type.

```text
type SyncChannelName = SyncMessage['channel'];
```

### SyncChannelOptions

Type.

```text
interface SyncChannelOptions {
  actorId?: string;
  color?: string;
  channels?: readonly SyncChannelName[];
  snapshot?: SyncSnapshot;
  presenceTimeout?: number;
  onConflict?: (conflict: SyncConflict) => void;
  onPresenceChange?: (collaborators: PresenceState[]) => void;
}
```

### SyncMessage

Type.

```text
type SyncMessage =
  | { channel: 'annotations'; operations: SyncOperation[] }
  | { channel: 'forms'; operations: FormSyncOperation[] }
  | { channel: 'pages'; operations: PageSyncOperation[] }
  | { channel: 'presence'; message: PresenceMessage };
```

### SyncTransport

Type.

```text
interface SyncTransport {
  actorId?: string;
  send(message: SyncMessage): void;
  subscribe(receive: (message: SyncMessage) => void): (() => void) | void;
}
```

### ToolbarItem

Type.

```text
type ToolbarItem = ToolbarItemName | CustomToolbarItem;
```

### ToolbarItemName

Type.

```text
type ToolbarItemName =
  | 'sidebar'
  | 'pageNavigation'
  | 'zoom'
  | 'rotate'
  | 'view'
  | 'pointer'
  | 'search'
  | 'tools'
  | 'undoRedo'
  | 'print'
  | 'download'
  | 'theme'
  | 'menu'
  | 'separator'
  | 'spacer';
```

### ToolbarPreset

Type.

```text
type ToolbarPreset = 'viewer' | 'reviewer' | 'editor' | 'form-filler' | 'full';
```

### toolbarPresetOptions

Value, from `@birchui/pdf`.

```text
function toolbarPresetOptions(preset: ToolbarPreset, allTools: readonly ViewerTool[]): Partial<PdfViewerOptions>;
```

### ToolbarTab

Type.

```text
type ToolbarTab = 'view' | 'comment' | 'edit' | 'pages' | 'forms' | 'protect' | 'tools';
```

### ToolGroup

Type.

```text
type ToolGroup = ToolbarTab | 'annotate' | 'shapes' | 'insert' | 'measure' | 'redact' | 'content';
```

### ViewerCommand

Type.

```text
type ViewerCommand =
  | PageCommandId
  | DocCommandId
  | 'zoomIn'
  | 'zoomOut'
  | 'zoomReset'
  | 'fitWidth'
  | 'fitPage'
  | 'nextPage'
  | 'previousPage'
  | 'firstPage'
  | 'lastPage'
  | 'find'
  | 'findNext'
  | 'findPrevious'
  | 'print'
  | 'download'
  | 'rotateClockwise'
  | 'rotateCounterClockwise'
  | 'undo'
  | 'redo'
  | 'deleteSelection'
  | 'escape'
  | 'toggleSidebar'
  | 'selectAll'
  | 'copy'
  | 'cut'
  | 'paste'
  | 'duplicate'
  | 'bringForward'
  | 'sendBackward'
  | 'bringToFront'
  | 'sendToBack'
  | 'presentation'
  | 'shortcutHelp'
  | 'contextMenu'
  | 'focusToolbar'
  | 'placeAtCenter'
  | 'commandPalette'
  | 'readAloud'
  | 'snapshotPage'
  | `tool:${ViewerTool}`
  | 'tool:select'
  | 'tool:pan'
  | 'tool:marqueeZoom'
  | 'tool:eraser'
  | 'tool:stamp'
  | 'tool:highlight'
  | 'tool:underline'
  | 'tool:strikeout'
  | 'tool:note'
  | 'tool:freeText'
  | 'tool:ink'
  | 'tool:rectangle'
  | 'tool:ellipse'
  | 'tool:line'
  | 'tool:arrow'
  | 'tool:redaction';
```

### ViewerCommandInfo

Type.

```text
interface ViewerCommandInfo {
  id: ViewerCommand;
  label: string;
  shortcut?: string;
  isEnabled: boolean;
}
```

### ViewerOcrEngine

Type.

```text
type ViewerOcrEngine = Pick<OcrEngine, 'recognizePage'>;
```

### ViewerOcrOptions

Type.

```text
interface ViewerOcrOptions {
  /**
   * The recognition model shipped as `@birchui/pdf/assets/ocr/latin.lqocr`: its bytes, or a function that
   * loads them. The viewer never fetches it; it is read the first time text recognition runs.
   */
  model?: Uint8Array | (() => Uint8Array | Promise<Uint8Array>);
  /** `true` starts the packaged worker, or pass a worker running `@birchui/pdf/ocr-worker` or a function creating one. */
  worker?: boolean | OcrWorkerLike | (() => OcrWorkerLike);
  /** An engine of your own instead of the packaged one; `model` and `worker` are then ignored. */
  engine?: ViewerOcrEngine;
  /** Languages offered in the dialog. Read from the model by default. */
  languages?: string[];
  /** Resolution pages are rendered at for recognition. 200 by default. */
  dpi?: number;
  /** `false` hides the banner offered on scanned pages. */
  banner?: boolean;
}
```

### ViewerTool

Type.

```text
type ViewerTool =
  | 'select'
  | 'pan'
  | 'marqueeZoom'
  | 'snapshot'
  | TextMarkupType
  | 'insertText'
  | 'replaceText'
  | 'note'
  | 'freeText'
  | 'callout'
  | 'ink'
  | 'eraser'
  | 'rectangle'
  | 'ellipse'
  | 'cloud'
  | 'line'
  | 'arrow'
  | 'polygon'
  | 'polyline'
  | 'distance'
  | 'perimeter'
  | 'area'
  | 'stamp'
  | 'image'
  | 'signature'
  | 'redaction'
  | 'formField'
  | 'editText'
  | 'addText'
  | 'editImage'
  | 'count'
  | 'arc'
  | 'angle'
  | 'link';
```

### ZoomValue

Type.

```text
type ZoomValue = number | 'fit-width' | 'fit-page' | 'auto';
```

## Documents and saving

### ApplyRedactionsAsyncOptions

Type.

```text
interface ApplyRedactionsAsyncOptions {
  decodeImage?: AsyncRedactionImageDecoder;
}
```

### ApplyRedactionsOptions

Type.

```text
interface ApplyRedactionsOptions {
  decodeImage?: RedactionImageDecoder;
}
```

### AsyncRedactionImageDecoder

Type.

```text
type AsyncRedactionImageDecoder = (
  image: PageRedactionImage,
) => DecodedRedactionImage | undefined | Promise<DecodedRedactionImage | undefined>;
```

### decryptPdf

Value, from `@birchui/pdf/engine`.

```text
function decryptPdf(data: Uint8Array | ArrayBuffer, password?: string): Promise<PdfBytes>;
```

### DocumentChangeReason

Type.

```text
type DocumentChangeReason =
  | 'metadata'
  | 'outline'
  | 'attachments'
  | 'watermark'
  | 'headerFooter'
  | 'bates'
  | 'crop'
  | 'pageLabels'
  | 'pageText'
  | 'pageImage'
  | 'pageObject'
  | 'background'
  | 'flatten'
  | 'history';
```

### encryptPdf

Value, from `@birchui/pdf/engine`.

```text
function encryptPdf(data: Uint8Array | ArrayBuffer, options: EncryptOptions & { password?: string; }): Promise<PdfBytes>;
```

### InterleaveOptions

Type.

```text
interface InterleaveOptions {
  reverseSecond?: boolean;
}
```

### loadPdfDocument

Value, from `@birchui/pdf/engine`.

```text
function loadPdfDocument(data: Uint8Array | ArrayBuffer, options?: OpenPdfOptions): Promise<PdfDocument>;
```

### MergeFileInput

Type.

```text
interface MergeFileInput {
  data: Uint8Array | ArrayBuffer;
  name?: string;
  pages?: string | readonly number[];
  password?: string;
}
```

### MergeFilesOptions

Type.

```text
interface MergeFilesOptions {
  at?: number;
  bookmarkPerFile?: boolean;
  keepBookmarks?: boolean;
  keepFormFields?: boolean;
  signal?: AbortSignal;
  onProgress?: (progress: MergeProgress) => void | Promise<void>;
}
```

### MergeFilesResult

Type.

```text
interface MergeFilesResult {
  at: number;
  pageCount: number;
  documentIndexes: number[];
  renamedFields: { from: string; to: string }[];
}
```

### MergeProgress

Type.

```text
interface MergeProgress {
  done: number;
  total: number;
  name: string;
}
```

### openPdfDocument

Value, from `@birchui/pdf/engine`.

```text
function openPdfDocument(data: Uint8Array | ArrayBuffer, options?: OpenPdfOptions): PdfDocument;
```

### OpenPdfOptions

Type.

```text
interface OpenPdfOptions {
  limits?: Partial<PdfLimits>;
  fontFallback?: PdfFontFallback;
  /**
   * `false` makes `save()` reject with a `PdfMissingGlyphError` when text has no font. By default the file is
   * saved and the result names the missing scripts in `missingGlyphs`.
   */
  allowMissingGlyphs?: boolean;
  /** Draws annotation text no font covers as an image. The viewer sets one that uses the fonts of the browser. */
  textRasterizer?: PdfTextRasterizer;
  author?: string;
  createId?: () => string;
  now?: () => Date;
  annotationDefaults?: Partial<Record<AnnotationType, Partial<AnnotationDefaults>>>;
  historyLimit?: number;
  readAnnotations?: boolean;
  annotationScope?: 'markup' | 'all';
  password?: string;
  fonts?: PdfFontSource[];
  decodeImage?: ImageDecoder;
  ignorePermissions?: boolean;
  authorId?: string;
}
```

### PageDecoration

Type.

```text
interface PageDecoration {
  kind: PageLayerKind;
  pages: number[];
  /** True when this library made the layer; `options` then holds what it was made with. */
  isOwn: boolean;
  options?: Record<string, unknown>;
}
```

### PageNumberOptions

Type.

```text
interface PageNumberOptions {
  format?: string;
  position?: PageNumberPosition;
  startNumber?: number;
  pages?: number[];
  fontSize?: number;
  color?: string;
  margin?: number;
  font?: StandardFont;
  fonts?: FontRegistry;
}
```

### PageNumberPosition

Type.

```text
type PageNumberPosition =
  'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
```

### PageRedactionImage

Type.

```text
interface PageRedactionImage extends RedactionImageRequest {
  pageIndex: number;
}
```

### PagesChangeReason

Type.

```text
type PagesChangeReason =
  'move' | 'rotate' | 'delete' | 'insert' | 'merge' | 'history' | 'redaction' | 'crop' | 'content';
```

### PageSourceKind

Type.

```text
type PageSourceKind = 'original' | 'merged' | 'blank';
```

### PageTextOptions

Type.

```text
type PageTextOptions = Omit<StructuredTextOptions, 'exclude'>;
```

### PdfDocument

Type.

```text
interface PdfDocument {
  readonly pageCount: number;
  readonly isModified: boolean;
  readonly isEncrypted: boolean;
  readonly isLocked: boolean;
  readonly hasSignatures: boolean;
  readonly certification: PdfCertificationInfo | undefined;
  readonly permissions: PdfPermissions;
  readonly encryption: PdfEncryptionInfo | undefined;
  isAllowed(permission: PdfPermissionName): boolean;
  encrypt(options: EncryptOptions): void;
  decrypt(): void;
  mergeEncryptedDocument(data: Uint8Array | ArrayBuffer, password?: string, at?: number): Promise<number>;
  on<K extends keyof PdfDocumentEvents & string>(event: K, listener: Listener<PdfDocumentEvents[K]>): () => void;
  getPages(): PdfPageSummary[];
  setAuthor(author: string): void;
  getAnnotations(pageIndex?: number): PdfAnnotation[];
  addAnnotation(input: AnnotationInput): PdfAnnotation;
  addAnnotations(inputs: AnnotationInput[]): PdfAnnotation[];
  updateAnnotation(id: string, patch: AnnotationPatch): PdfAnnotation | undefined;
  removeAnnotation(id: string | string[]): PdfAnnotation[];
  addReply(id: string, reply: string | { contents: string; author?: string; id?: string }): AnnotationReply | undefined;
  updateReply(id: string, replyId: string, contents: string): AnnotationReply | undefined;
  removeReply(id: string, replyId: string): boolean;
  addTextMarkup(
    type: TextMarkupType,
    pageIndex: number,
    quads: readonly PdfQuad[],
    extra?: Partial<Omit<AnnotationInput, 'type' | 'pageIndex' | 'quadPoints'>>,
  ): PdfAnnotation | undefined;
  uprightPlacement(pageIndex: number, rect: PdfRect): { rect: PdfRect; rotation: number | undefined };
  getNamedDestinations(): NamedDestination[];
  getAnnotationAttachment(id: string): AnnotationAttachmentFile | undefined;
  exportAnnotationsFdf(options?: { fileName?: string; includeAppearances?: boolean }): PdfBytes;
  importAnnotationsFdf(data: Uint8Array | ArrayBuffer, options?: { replace?: boolean }): { annotations: number };
  applyRemoteChanges(changes: { upsert: PdfAnnotation[]; remove: string[] }): void;
  subscribeAnnotationChanges(listener: (changes: AnnotationChangeSet) => void): () => void;
  getFormFields(): PdfFormField[];
  getFormField(name: string): PdfFormField | undefined;
  getFormValues(): Record<string, FormValue>;
  setFormValue(name: string, value: FormValue): string[];
  setFormValues(values: Record<string, FormValue>): string[];
  validateFormField(name: string, value?: FormValue): string | undefined;
  validateFormFieldIssue(name: string, value?: FormValue): FieldIssue | undefined;
  validateForm(): FormIssue[];
  getFormState(): FormState;
  describeFieldScripts(name: string): FieldScriptReport | undefined;
  filterKeystroke(
    name: string,
    currentValue: string,
    change: string,
    selStart: number,
    selEnd?: number,
  ): KeystrokeResult;
  getFieldActions(name: string): FieldActionEntry[];
  resetForm(names?: readonly string[], options?: { exclude?: boolean }): string[];
  buildSubmitPayload(action: SubmitFormAction): Promise<FormSubmitPayload>;
  submitForm(action: SubmitFormAction, fieldName?: string): Promise<FormSubmitPayload>;
  exportFormFdf(fileName?: string): PdfBytes;
  importFormFdf(data: Uint8Array | ArrayBuffer): FormImportResult;
  exportFormXfdf(fileName?: string): string;
  importFormXfdf(xml: string): FormImportResult;
  exportFormJson(options?: FormJsonOptions): FormJson;
  importFormJson(json: unknown): FormImportResult;
  exportFormXml(): string;
  importFormXml(xml: string): FormImportResult;
  addFormField(input: FormFieldInput): PdfFormField;
  /** Proposes fields for blank lines, empty boxes and tick squares of flat pages; nothing is changed. */
  detectFormFields(pageIndexes?: readonly number[]): DetectedField[];
  /** Adds the proposed fields (default: those of every page) as one undo step. */
  addDetectedFields(fields?: readonly DetectedField[]): PdfFormField[];
  updateFormField(name: string, patch: FormFieldPatch): PdfFormField | undefined;
  updateFormFields(names: readonly string[], patch: FormFieldPatch): PdfFormField[];
  removeFormField(name: string): boolean;
  duplicateField(name: string, options?: DuplicateFieldOptions): PdfFormField | undefined;
  alignFields(targets: readonly FormFieldTarget[], mode: FieldAlignment): PdfFormField[];
  distributeFields(targets: readonly FormFieldTarget[], direction: 'horizontal' | 'vertical'): PdfFormField[];
  sizeFields(targets: readonly FormFieldTarget[], mode: 'width' | 'height' | 'both'): PdfFormField[];
  getCalculationOrder(): string[];
  setCalculationOrder(names: readonly string[]): string[];
  setFieldCalculation(name: string, calculation: SimpleCalculation | null): PdfFormField | undefined;
  getSignatureFields(): SignatureFieldInfo[];
  fillSignatureField(name: string, signature: FieldSignatureInput): PdfAnnotation;
  getTabOrder(pageIndex: number): PageTabOrder;
  setTabOrder(pageIndex: number, mode: TabOrderMode): PageTabOrder;
  setFieldTabOrder(pageIndex: number, widgetIds: string[]): PageTabOrder;
  getSignatures(): Promise<(SignatureInfo & { fieldName: string })[]>;
  movePage(from: number, to: number): void;
  movePages(indices: number[], target: number): void;
  rotatePages(indices: number[], degrees?: number): void;
  deletePages(indices: number[]): void;
  insertBlankPage(at: number, size?: { width: number; height: number }): number;
  mergeDocument(data: Uint8Array | ArrayBuffer, at?: number): number;
  extractPages(indices: number[], options?: { deleteExtracted?: boolean }): Promise<PdfBytes>;
  replacePages(indices: number[], source: Uint8Array | ArrayBuffer, sourceIndices?: readonly number[]): number;
  interleaveDocument(data: Uint8Array | ArrayBuffer, options?: InterleaveOptions): number;
  mergeFiles(inputs: readonly MergeFileInput[], options?: MergeFilesOptions): Promise<MergeFilesResult>;
  findBlankPages(pages?: number[], options?: BlankScanOptions & { analyzeImages?: boolean }): number[];
  deleteBlankPages(pages?: number[], options?: Bla
// continues in the source
```

### PdfDocumentEvents

Type.

```text
interface PdfDocumentEvents {
  annotationAdd: { annotations: PdfAnnotation[]; source: ChangeSource };
  annotationChange: { changes: { before: PdfAnnotation; after: PdfAnnotation }[]; source: ChangeSource };
  annotationRemove: { annotations: PdfAnnotation[]; source: ChangeSource };
  formFieldChange: { name: string; value: FormValue; previousValue: FormValue; source: ChangeSource };
  formFieldsChange: { added: string[]; changed: string[]; removed: string[]; source: ChangeSource };
  formSubmit: { action: SubmitFormAction; payload: FormSubmitPayload; fieldName?: string };
  formReset: { names: string[]; changed: string[]; source: ChangeSource };
  pagesChange: { pages: PdfPageSummary[]; reason: PagesChangeReason };
  historyChange: { canUndo: boolean; canRedo: boolean; undoLabel?: string; redoLabel?: string };
  documentChange: { reason: string };
  fontMissing: MissingGlyphReport;
  formFieldReject: { name: string; value: FormValue; issue: FieldIssue; source: ChangeSource };
}
```

### PdfEncryptionInfo

Type.

```text
interface PdfEncryptionInfo {
  algorithm: EncryptionAlgorithm;
  revision: number;
  isOwner: boolean;
  encryptsMetadata: boolean;
}
```

### PdfInputError

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
class PdfInputError extends TypeError {
  constructor( readonly path: string, message: string, );
}
```

### PdfPageSummary

Type.

```text
interface PdfPageSummary {
  index: number;
  width: number;
  height: number;
  rotation: number;
  box: PdfRect;
  kind: PageSourceKind;
  sourceIndex: number;
  documentIndex: number;
  key: number;
}
```

### PdfPermissionError

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
class PdfPermissionError extends Error {
  constructor(readonly permission: PdfPermissionName);
}
```

### PdfPermissionName

Type.

```text
type PdfPermissionName = keyof PdfPermissions | 'changeSecurity';
```

### RecognizedPage

Type.

```text
interface RecognizedPage extends TextLayerResult {
  pageIndex: number;
  status: 'recognized' | 'has-text' | 'no-image' | 'no-words';
}
```

### RecognizeTextOptions

Type.

```text
interface RecognizeTextOptions {
  recognizeText: RecognizeTextCallback;
  pages?: number[];
  includePagesWithText?: boolean;
  renderPage?: (pageIndex: number) => RenderedPageImage | undefined | Promise<RenderedPageImage | undefined>;
}
```

### RedactionImageDecoder

Type.

```text
type RedactionImageDecoder = (image: PageRedactionImage) => DecodedRedactionImage | undefined;
```

### RedactionSearchOptions

Type.

```text
interface RedactionSearchOptions {
  pages?: number[];
  caseSensitive?: boolean;
  wholeWord?: boolean;
  overlayText?: string;
  fillColor?: string;
}
```

### RenderedPageImage

Type.

```text
interface RenderedPageImage {
  width: number;
  height: number;
  data: Uint8Array;
  matrix: Matrix;
}
```

### ReplyInput

Type.

```text
type ReplyInput = string | (Partial<AnnotationReply> & { contents: string });
```

### ResizePagesOptions

Type.

```text
interface ResizePagesOptions {
  width: number;
  height: number;
  anchor?: PageAnchor;
  scaleContent: boolean;
  fit?: 'fit' | 'fill';
  margin?: number;
}
```

### SaveMode

Type.

```text
type SaveMode = 'auto' | 'incremental' | 'full';
```

### SaveOptions

Type.

```text
interface SaveOptions {
  allowMissingGlyphs?: boolean;
  objectStreams?: boolean;
  mode?: SaveMode;
  compress?: boolean;
  flatten?: FlattenMode;
  linearize?: boolean;
}
```

### SaveResult

Type.

```text
interface SaveResult {
  bytes: PdfBytes;
  mode: 'incremental' | 'full';
  redactions: RedactionReport[];
  /** Characters that were written without a glyph, and their scripts; absent when every character was drawn. */
  missingGlyphs?: MissingGlyphReport;
}
```

## Annotations

### angleBetween

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function angleBetween(a: PdfPoint, vertex: PdfPoint, b: PdfPoint): number;
```

### AnnotationAttachment

Type.

```text
interface AnnotationAttachment {
  fileName: string;
  mimeType?: string;
  description?: string;
  size?: number;
  data?: Uint8Array;
  relationship?: AttachmentRelationship;
}
```

### AnnotationAttachmentFile

Type.

```text
interface AnnotationAttachmentFile {
  fileName: string;
  mimeType: string;
  description?: string;
  data: Uint8Array;
  relationship?: AttachmentRelationship;
}
```

### annotationBounds

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function annotationBounds(annotation: Pick<PdfAnnotation, "rect" | "rotation">): PdfRect;
```

### AnnotationChangeSet

Type.

```text
interface AnnotationChangeSet {
  added: PdfAnnotation[];
  changed: { before: PdfAnnotation; after: PdfAnnotation }[];
  removed: PdfAnnotation[];
  source: ChangeSource;
}
```

### annotationCorners

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function annotationCorners(annotation: Pick<PdfAnnotation, "rect" | "rotation">): PdfPoint[];
```

### AnnotationDefaults

Type.

```text
interface AnnotationDefaults {
  color: string;
  opacity: number;
  strokeWidth: number;
  fillColor?: string;
  fontSize?: number;
}
```

### annotationFlags

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function annotationFlags(annotation: Pick<PdfAnnotation, "isHidden" | "isLocked" | "isReadOnly" | "isContentsLocked" | "isNoView" | "isPrintable">, extra?: number): number;
```

### AnnotationFont

Type.

```text
type AnnotationFont = 'Helvetica' | 'Times' | 'Courier';
```

### AnnotationImage

Type.

```text
interface AnnotationImage {
  data: Uint8Array;
  mimeType: 'image/png' | 'image/jpeg';
  width: number;
  height: number;
}
```

### AnnotationInput

Type.

```text
type AnnotationInput = Partial<Omit<PdfAnnotation, 'type' | 'pageIndex'>> &
  Pick<PdfAnnotation, 'type' | 'pageIndex'>;
```

### annotationInputFromPreset

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function annotationInputFromPreset(preset: AnnotationPreset, placement: Partial<Omit<AnnotationInput, "type">> & { pageIndex: number; }): AnnotationInput;
```

### AnnotationPatch

Type.

```text
type AnnotationPatch = Partial<Omit<PdfAnnotation, 'id'>>;
```

### AnnotationPermissionOptions

Type.

```text
interface AnnotationPermissionOptions {
  isDocumentReadOnly?: boolean;
  canAnnotate?: boolean;
}
```

### annotationPermissions

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function annotationPermissions(annotation: PdfAnnotation, user: AnnotationUser | string, options?: AnnotationPermissionOptions): AnnotationPermissions;
```

### AnnotationPermissions

Type.

```text
interface AnnotationPermissions {
  canMove: boolean;
  canResize: boolean;
  canEditContents: boolean;
  canEditStyle: boolean;
  canDelete: boolean;
  canReply: boolean;
  canChangeStatus: boolean;
  isOwner: boolean;
}
```

### AnnotationPreset

Type.

```text
interface AnnotationPreset extends AnnotationPresetStyle {
  id: string;
  name: string;
  type: AnnotationType;
}
```

### annotationPresetsFromJson

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function annotationPresetsFromJson(value: unknown): AnnotationPreset[];
```

### AnnotationPresetsJson

Type.

```text
interface AnnotationPresetsJson {
  format: 'birchui-pdf-annotation-presets';
  version: 1;
  presets: AnnotationPreset[];
}
```

### annotationPresetsToJson

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function annotationPresetsToJson(presets: readonly AnnotationPreset[]): AnnotationPresetsJson;
```

### AnnotationPresetStyle

Type.

```text
interface AnnotationPresetStyle {
  color?: string;
  fillColor?: string;
  opacity?: number;
  strokeWidth?: number;
  borderStyle?: BorderStyle;
  lineEndings?: [LineEnding, LineEnding];
  fontSize?: number;
  fontColor?: string;
  fontFamily?: AnnotationFont;
  textAlign?: RichTextAlign;
  icon?: NoteIcon;
  iconName?: string;
  stamp?: string;
  stampLabel?: string;
  label?: string;
  measureScale?: MeasureScale;
  rotation?: number;
  overlayText?: string;
  text?: string;
  contents?: string;
  width?: number;
  height?: number;
}
```

### AnnotationReply

Type.

```text
interface AnnotationReply {
  id: string;
  author: string;
  contents: string;
  createdAt: string;
  modifiedAt: string;
}
```

### annotationRichDefaults

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function annotationRichDefaults(annotation: Pick<PdfAnnotation, "fontSize" | "fontColor" | "color" | "fontFamily" | "textAlign">): RichTextDefaults;
```

### AnnotationsFdfImport

Type.

```text
interface AnnotationsFdfImport {
  annotations: AnnotationInput[];
  fileName?: string;
}
```

### AnnotationsFdfOptions

Type.

```text
interface AnnotationsFdfOptions {
  fileName?: string;
  includeAppearances?: boolean;
  fonts?: FontRegistry;
  pageRotations?: readonly number[];
}
```

### annotationsFromJson

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function annotationsFromJson(value: unknown): AnnotationInput[];
```

### AnnotationsJson

Type.

```text
interface AnnotationsJson {
  format: 'birchui-pdf-annotations';
  version: 1;
  annotations: (Omit<PdfAnnotation, 'image'> & {
    image?: { data: string; mimeType: string; width: number; height: number };
  })[];
}
```

### annotationsToFdf

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function annotationsToFdf(annotations: readonly PdfAnnotation[], options?: AnnotationsFdfOptions): Uint8Array;
```

### annotationsToJson

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function annotationsToJson(annotations: readonly PdfAnnotation[]): AnnotationsJson;
```

### annotationsToXfdf

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function annotationsToXfdf(annotations: readonly PdfAnnotation[], fields?: readonly PdfFormField[], fileName?: string): string;
```

### AnnotationSync

Type.

```text
interface AnnotationSync {
  receive(operations: SyncOperation | SyncOperation[]): void;
  merge(snapshot: SyncSnapshot): void;
  snapshot(): SyncSnapshot;
  refresh(): void;
  destroy(): void;
}
```

### AnnotationSyncHost

Type.

```text
interface AnnotationSyncHost {
  getAnnotations(): PdfAnnotation[];
  applyRemoteChanges(changes: RemoteAnnotationChanges): void;
  subscribeAnnotationChanges(listener: (changes: SyncAnnotationChanges) => void): () => void;
}
```

### AnnotationSyncOptions

Type.

```text
interface AnnotationSyncOptions {
  actorId: string;
  send: (operations: SyncOperation[]) => void;
  author?: string;
  onConflict?: (conflict: SyncConflict) => void;
  snapshot?: SyncSnapshot;
  pageIds?: () => readonly (string | undefined)[];
}
```

### AnnotationType

Type.

```text
type AnnotationType =
  | TextMarkupType
  | ShapeType
  | MeasurementType
  | 'note'
  | 'caret'
  | 'freeText'
  | 'ink'
  | 'stamp'
  | 'image'
  | 'signature'
  | 'redaction'
  | 'link'
  | MediaAnnotationType;
```

### AnnotationUser

Type.

```text
interface AnnotationUser {
  name: string;
  id?: string;
  isAdmin?: boolean;
}
```

### ArcGeometry

Type.

```text
interface ArcGeometry {
  center: PdfPoint;
  radius: number;
  startAngle: number;
  sweep: number;
  length: number;
}
```

### arcPoints

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function arcPoints(points: readonly PdfPoint[], segments?: number): PdfPoint[];
```

### arcThrough

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function arcThrough(start: PdfPoint, through: PdfPoint, end: PdfPoint): ArcGeometry | undefined;
```

### BorderStyle

Type.

```text
type BorderStyle = 'solid' | 'dashed' | 'dotted' | 'cloudy';
```

### BuiltInStamp

Type.

```text
type BuiltInStamp =
  'Approved' | 'Draft' | 'Confidential' | 'Final' | 'NotApproved' | 'ForComment' | 'Void' | 'Received';
```

### ChangeSource

Type.

```text
type ChangeSource = 'user' | 'api' | 'history' | 'import' | 'remote';
```

### circleThrough

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function circleThrough(a: PdfPoint, b: PdfPoint, c: PdfPoint): { center: PdfPoint; radius: number; } | undefined;
```

### compareSyncClocks

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function compareSyncClocks(a: SyncClock, b: SyncClock): number;
```

### createAnnotationSync

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function createAnnotationSync(host: AnnotationSyncHost, options: AnnotationSyncOptions): AnnotationSync;
```

### createFormSync

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function createFormSync(host: FormSyncHost, options: FormSyncOptions): FormSync;
```

### createPageSync

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function createPageSync(host: PageSyncHost, options: PageSyncOptions): PageSync;
```

### createPresenceTracker

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function createPresenceTracker(options?: { actorId?: string; timeout?: number; onChange?: (states: PresenceState[]) => void; now?: () => number; }): PresenceTracker;
```

### DEFAULT_STYLES

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
const DEFAULT_STYLES: Record<AnnotationType, AnnotationDefaults>;
```

### describeLinkAction

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function describeLinkAction(action: LinkAction | undefined): string;
```

### FILE_ATTACHMENT_ICONS

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
const FILE_ATTACHMENT_ICONS: readonly FileAttachmentIcon[];
```

### FileAttachmentIcon

Type.

```text
type FileAttachmentIcon = 'PushPin' | 'Paperclip' | 'Graph' | 'Tag';
```

### formatMeasurement

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function formatMeasurement(annotation: Measurable): string;
```

### FormSync

Type.

```text
interface FormSync {
  receive(operations: FormSyncOperation | FormSyncOperation[]): void;
  merge(snapshot: FormSyncSnapshot): void;
  snapshot(): FormSyncSnapshot;
  destroy(): void;
}
```

### FormSyncConflict

Type.

```text
interface FormSyncConflict {
  field: string;
  operation: FormSyncOperation;
  winner: SyncClock;
}
```

### formSyncHost

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function formSyncHost(document: SyncableDocument): FormSyncHost;
```

### FormSyncHost

Type.

```text
interface FormSyncHost {
  getFormValues(): Record<string, FormSyncValue>;
  setFieldValues(values: Record<string, FormSyncValue>, source: 'remote'): unknown;
  subscribeFormChanges(listener: (change?: { source?: string }) => void): () => void;
  isCalculated?(field: string): boolean;
}
```

### FormSyncOperation

Type.

```text
interface FormSyncOperation {
  id: string;
  kind: 'set';
  field: string;
  value: FormSyncValue;
  author: string;
  clock: SyncClock;
}
```

### FormSyncOptions

Type.

```text
interface FormSyncOptions {
  actorId: string;
  send: (operations: FormSyncOperation[]) => void;
  author?: string;
  onConflict?: (conflict: FormSyncConflict) => void;
  snapshot?: FormSyncSnapshot;
}
```

### FormSyncSnapshot

Type.

```text
interface FormSyncSnapshot {
  version: 1;
  counter: number;
  fields: { [field: string]: { clock: SyncClock; value: FormSyncValue } };
}
```

### FormSyncValue

Type.

```text
type FormSyncValue = string | string[] | boolean | null;
```

### fromSyncJson

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function fromSyncJson(value: SyncJson): unknown;
```

### hitTestAnnotation

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function hitTestAnnotation(annotation: PdfAnnotation, point: PdfPoint, tolerance?: number): boolean;
```

### hitTestRotated

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function hitTestRotated(annotation: PdfAnnotation, p: PdfPoint, tolerance?: number): boolean;
```

### ImageFormatError

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
class ImageFormatError extends Error {
  constructor(message: string);
}
```

### isAnnotationOwner

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function isAnnotationOwner(annotation: Pick<PdfAnnotation, "author" | "customData">, user: AnnotationUser | string): boolean;
```

### isMediaType

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function isMediaType(type: AnnotationType): type is MediaAnnotationType;
```

### isReadOnlyType

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function isReadOnlyType(type: AnnotationType): boolean;
```

### isSafeLinkUri

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function isSafeLinkUri(uri: string | undefined | null): boolean;
```

### isUniformRichText

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function isUniformRichText(paragraphs: readonly RichTextParagraph[]): boolean;
```

### layoutRichText

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function layoutRichText(paragraphs: readonly RichTextParagraph[], maxWidth: number, defaults?: RichTextDefaults, registry?: FontRegistry): RichTextLine[];
```

### leaveMessage

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function leaveMessage(actorId: string, sentAt?: number): PresenceMessage;
```

### LineEnding

Type.

```text
type LineEnding = 'none' | 'openArrow' | 'closedArrow' | 'circle' | 'square' | 'diamond' | 'butt';
```

### LinkAction

Type.

```text
type LinkAction =
  | { kind: 'uri'; uri: string }
  | ({ kind: 'goto' } & LinkDestination)
  | { kind: 'named'; name: string }
  | { kind: 'other'; actionType: string; name?: string };
```

### LinkDestination

Type.

```text
interface LinkDestination {
  pageIndex: number;
  fit?: LinkFit;
  left?: number;
  top?: number;
  right?: number;
  bottom?: number;
  zoom?: number;
}
```

### LinkFit

Type.

```text
type LinkFit = 'page' | 'width' | 'height' | 'box' | 'boxWidth' | 'boxHeight' | 'point' | 'rect';
```

### LinkHighlightMode

Type.

```text
type LinkHighlightMode = 'none' | 'invert' | 'outline' | 'push';
```

### linkUriScheme

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function linkUriScheme(uri: string): string | undefined;
```

### Measurable

Type.

```text
type Measurable = Pick<PdfAnnotation, 'type' | 'line' | 'vertices' | 'measureScale'> &
  Partial<Pick<PdfAnnotation, 'label' | 'rect'>>;
```

### measureDetails

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function measureDetails(annotation: Measurable): MeasureDetails;
```

### MeasureDetails

Type.

```text
interface MeasureDetails {
  type: PdfAnnotation['type'];
  value: number;
  unit: string;
  text: string;
  length?: number;
  perimeter?: number;
  area?: number;
  radius?: number;
  angle?: number;
  count?: number;
}
```

### MeasurementType

Type.

```text
type MeasurementType = 'distance' | 'perimeter' | 'area' | 'count' | 'arc' | 'angle';
```

### MeasureScale

Type.

```text
interface MeasureScale {
  pdfUnits: number;
  realUnits: number;
  unit: string;
  precision?: number;
}
```

### measureValue

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function measureValue(annotation: Measurable): number;
```

### MediaAnnotationType

Type.

```text
type MediaAnnotationType = 'fileAttachment' | 'sound' | 'movie' | 'screen' | 'richMedia' | 'media3d';
```

### mergeLineRects

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function mergeLineRects(rects: readonly PdfRect[], gap?: number): PdfRect[];
```

### NamedDestination

Type.

```text
interface NamedDestination extends LinkDestination {
  name: string;
}
```

### normalizeDegrees

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function normalizeDegrees(degrees: number): number;
```

### normalizeRichText

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function normalizeRichText(paragraphs: readonly RichTextParagraph[]): RichTextParagraph[];
```

### NoteIcon

Type.

```text
type NoteIcon = 'comment' | 'note' | 'key' | 'help' | 'paragraph' | 'insert';
```

### originalPageId

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function originalPageId(sourceIndex: number): string;
```

### PageSync

Type.

```text
interface PageSync {
  receive(operations: PageSyncOperation | PageSyncOperation[]): void;
  merge(snapshot: PageSyncSnapshot): void;
  snapshot(): PageSyncSnapshot;
  pageIds(): (string | undefined)[];
  destroy(): void;
}
```

### PageSyncConflict

Type.

```text
interface PageSyncConflict {
  pageId: string;
  reason: 'older-write' | 'removed';
  operation: PageSyncOperation;
  winner: SyncClock;
}
```

### pageSyncHost

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function pageSyncHost(document: SyncableDocument): PageSyncHost;
```

### PageSyncHost

Type.

```text
interface PageSyncHost {
  getPages(): PageSyncPage[];
  movePages(indices: number[], target: number): void;
  rotatePages(indices: number[], degrees: number): void;
  deletePages(indices: number[]): void;
  insertBlankPage(at: number, size?: PageSyncSize): number;
  subscribePageChanges(listener: () => void): () => void;
}
```

### PageSyncOperation

Type.

```text
interface PageSyncOperation {
  id: string;
  kind: PageSyncOperationKind;
  pageId: string;
  position?: string;
  rotation?: number;
  size?: PageSyncSize;
  author: string;
  clock: SyncClock;
}
```

### PageSyncOperationKind

Type.

```text
type PageSyncOperationKind = 'insert' | 'move' | 'rotate' | 'delete';
```

### PageSyncOptions

Type.

```text
interface PageSyncOptions {
  actorId: string;
  send: (operations: PageSyncOperation[]) => void;
  author?: string;
  onConflict?: (conflict: PageSyncConflict) => void;
  onApply?: () => void;
  snapshot?: PageSyncSnapshot;
}
```

### PageSyncPage

Type.

```text
interface PageSyncPage {
  key: number | string;
  kind: string;
  sourceIndex: number;
  rotation: number;
  width: number;
  height: number;
}
```

### PageSyncSize

Type.

```text
interface PageSyncSize {
  width: number;
  height: number;
}
```

### PageSyncSnapshot

Type.

```text
interface PageSyncSnapshot {
  version: 1;
  counter: number;
  pages: PageSyncSnapshotEntry[];
}
```

### PageSyncSnapshotEntry

Type.

```text
interface PageSyncSnapshotEntry {
  id: string;
  position?: { clock: SyncClock; value: string };
  rotation?: { clock: SyncClock; value: number };
  removed?: SyncClock;
  size?: PageSyncSize;
}
```

### parseAnnotationsFdf

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function parseAnnotationsFdf(data: Uint8Array | ArrayBuffer, fallbackAuthor?: string): AnnotationsFdfImport;
```

### parseRichText

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function parseRichText(xhtml: string, defaults?: Partial<RichTextDefaults>): RichTextParagraph[] | undefined;
```

### parseXfdf

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function parseXfdf(xml: string): XfdfImport;
```

### PdfAnnotation

Type.

```text
interface PdfAnnotation {
  id: string;
  type: AnnotationType;
  pageIndex: number;
  rect: PdfRect;
  color: string;
  opacity: number;
  strokeWidth: number;
  author: string;
  createdAt: string;
  modifiedAt: string;
  contents?: string;
  replies?: AnnotationReply[];
  status?: ReviewStatus;
  statusAuthor?: string;
  statusModifiedAt?: string;
  replacedQuadPoints?: number[];
  fillColor?: string;
  dashed?: boolean;
  borderStyle?: BorderStyle;
  rotation?: number;
  quadPoints?: number[];
  inkList?: PdfPoint[][];
  vertices?: PdfPoint[];
  line?: [PdfPoint, PdfPoint];
  lineEndings?: [LineEnding, LineEnding];
  text?: string;
  fontSize?: number;
  fontColor?: string;
  textAlign?: 'left' | 'center' | 'right';
  fontFamily?: AnnotationFont;
  calloutLine?: PdfPoint[];
  groupId?: string;
  icon?: NoteIcon;
  stamp?: BuiltInStamp | string;
  stampLabel?: string;
  image?: AnnotationImage;
  signatureKind?: 'drawn' | 'typed' | 'image';
  measureScale?: MeasureScale;
  overlayText?: string;
  url?: string;
  destinationPage?: number;
  isLocked?: boolean;
  isHidden?: boolean;
  isReadOnly?: boolean;
  isContentsLocked?: boolean;
  isNoView?: boolean;
  isPrintable?: boolean;
  richText?: RichTextParagraph[];
  action?: LinkAction;
  highlightMode?: LinkHighlightMode;
  label?: string;
  iconName?: string;
  attachment?: AnnotationAttachment;
  customData?: Record<string, unknown>;
}
```

### PdfPoint

Type.

```text
interface PdfPoint {
  x: number;
  y: number;
}
```

### PdfRect

Type.

```text
type PdfRect = [x1: number, y1: number, x2: number, y2: number];
```

### PLACEHOLDER_PAGE_ID

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
const PLACEHOLDER_PAGE_ID: "placeholder";
```

### plainToRichText

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function plainToRichText(text: string, style?: Omit<RichTextRun, "text">): RichTextParagraph[];
```

### polygonArea

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function polygonArea(points: readonly PdfPoint[]): number;
```

### polylineLength

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function polylineLength(points: readonly PdfPoint[], isClosed?: boolean): number;
```

### positionBetween

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function positionBetween(before: string | undefined, after: string | undefined, actor?: string): string;
```

### presenceMessage

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function presenceMessage(state: PresenceState, sentAt?: number): PresenceMessage;
```

### PresenceMessage

Type.

```text
type PresenceMessage =
  { type: 'presence'; state: PresenceState; sentAt: number } | { type: 'leave'; actorId: string; sentAt: number };
```

### PresenceState

Type.

```text
interface PresenceState {
  actorId: string;
  name: string;
  color: string;
  pageIndex?: number;
  point?: PdfPoint;
  selection?: string[];
  viewPageIndex?: number;
}
```

### PresenceTracker

Type.

```text
interface PresenceTracker {
  receive(message: PresenceMessage): void;
  list(): PresenceState[];
  get(actorId: string): PresenceState | undefined;
  prune(now?: number): string[];
  clear(): void;
}
```

### presetFromAnnotation

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function presetFromAnnotation(annotation: PdfAnnotation, identity: { id: string; name: string; }, options?: { keepText?: boolean; keepSize?: boolean; }): AnnotationPreset;
```

### presetStyle

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function presetStyle(preset: AnnotationPreset): AnnotationPresetStyle;
```

### quadPointsFromRects

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function quadPointsFromRects(rects: readonly PdfRect[]): number[];
```

### quadsFromQuadPoints

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function quadsFromQuadPoints(quadPoints: readonly number[]): [PdfPoint, PdfPoint, PdfPoint, PdfPoint][];
```

### readImageInfo

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function readImageInfo(bytes: Uint8Array): AnnotationImage;
```

### rectsFromQuadPoints

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function rectsFromQuadPoints(quadPoints: readonly number[]): PdfRect[];
```

### RemoteAnnotationChanges

Type.

```text
interface RemoteAnnotationChanges {
  upsert: PdfAnnotation[];
  remove: string[];
}
```

### resizeRotated

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function resizeRotated(annotation: Pick<PdfAnnotation, "rect" | "rotation">, handle: "n" | "s" | "e" | "w" | "ne" | "nw" | "se" | "sw", pointer: PdfPoint, minSize?: number): PdfRect;
```

### ReviewStatus

Type.

```text
type ReviewStatus = 'none' | 'accepted' | 'rejected' | 'cancelled' | 'completed';
```

### RICH_TEXT_DEFAULTS

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
const RICH_TEXT_DEFAULTS: RichTextDefaults;
```

### RichTextAlign

Type.

```text
type RichTextAlign = 'left' | 'center' | 'right';
```

### RichTextDefaults

Type.

```text
interface RichTextDefaults {
  fontSize: number;
  color: string;
  fontFamily: string;
  align: RichTextAlign;
}
```

### richTextDefaultStyle

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function richTextDefaultStyle(defaults?: RichTextDefaults): string;
```

### RichTextLine

Type.

```text
interface RichTextLine {
  pieces: { text: string; style: ResolvedStyle; width: number }[];
  width: number;
  fontSize: number;
  align: RichTextAlign;
}
```

### RichTextParagraph

Type.

```text
interface RichTextParagraph {
  runs: RichTextRun[];
  align?: RichTextAlign;
}
```

### RichTextRun

Type.

```text
interface RichTextRun {
  text: string;
  bold?: boolean;
  italic?: boolean;
  underline?: boolean;
  strikethrough?: boolean;
  color?: string;
  fontSize?: number;
  fontFamily?: string;
}
```

### richTextToPlain

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function richTextToPlain(paragraphs: readonly RichTextParagraph[]): string;
```

### richTextToXhtml

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function richTextToXhtml(paragraphs: readonly RichTextParagraph[], defaults?: RichTextDefaults): string;
```

### rotateAnnotation

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function rotateAnnotation(annotation: PdfAnnotation, degrees: number): AnnotationPatch;
```

### rotatedBounds

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function rotatedBounds(rect: PdfRect, degrees: number): PdfRect;
```

### rotatedCorners

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function rotatedCorners(rect: PdfRect, degrees: number): [PdfPoint, PdfPoint, PdfPoint, PdfPoint];
```

### rotationFromPointer

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function rotationFromPointer(annotation: Pick<PdfAnnotation, "rect">, pointer: PdfPoint, snap?: number): number;
```

### rotationHandlePoint

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function rotationHandlePoint(annotation: Pick<PdfAnnotation, "rect" | "rotation">, offset?: number): PdfPoint;
```

### setAnnotationRotation

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function setAnnotationRotation(annotation: PdfAnnotation, degrees: number): AnnotationPatch;
```

### ShapeType

Type.

```text
type ShapeType = 'rectangle' | 'ellipse' | 'line' | 'arrow' | 'polygon' | 'polyline';
```

### simplifyPath

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function simplifyPath(points: readonly PdfPoint[], tolerance?: number): PdfPoint[];
```

### smoothStroke

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function smoothStroke(points: readonly PdfPoint[]): PdfPoint[];
```

### STAMP_COLORS

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
const STAMP_COLORS: Record<string, string>;
```

### STAMP_LABELS

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
const STAMP_LABELS: Record<string, string>;
```

### StandardFont

Type.

```text
type StandardFont =
  | 'Helvetica'
  | 'Helvetica-Bold'
  | 'Helvetica-Oblique'
  | 'Helvetica-BoldOblique'
  | 'Times-Roman'
  | 'Times-Bold'
  | 'Times-Italic'
  | 'Times-BoldItalic'
  | 'Courier'
  | 'Courier-Bold'
  | 'Courier-Oblique'
  | 'Courier-BoldOblique'
  | 'Symbol'
  | 'ZapfDingbats';
```

### SyncableDocument

Type.

```text
interface SyncableDocument {
  on(event: DocumentSyncEvent, listener: (payload: object) => void): () => void;
  getFormValues(): Record<string, FormSyncValue>;
  setFormValues(values: Record<string, FormSyncValue>): unknown;
  getFormField?(name: string): { calculation?: unknown; scripts?: { calculate?: string } } | undefined;
  getPages(): PageSyncPage[];
  movePages(indices: number[], target: number): void;
  rotatePages(indices: number[], degrees?: number): void;
  deletePages(indices: number[]): void;
  insertBlankPage(at: number, size?: PageSyncSize): number;
}
```

### SyncAnnotationChanges

Type.

```text
interface SyncAnnotationChanges {
  added: PdfAnnotation[];
  changed: { before: PdfAnnotation; after: PdfAnnotation }[];
  removed: PdfAnnotation[];
  source: string;
}
```

### SyncClock

Type.

```text
interface SyncClock {
  counter: number;
  actor: string;
}
```

### SyncConflict

Type.

```text
interface SyncConflict {
  annotationId: string;
  reason: 'older-write' | 'removed';
  keys: string[];
  operation: SyncOperation;
  winner: SyncClock;
}
```

### SyncJson

Type.

```text
type SyncJson = string | number | boolean | null | SyncJson[] | { [key: string]: SyncJson };
```

### SyncOperation

Type.

```text
interface SyncOperation {
  id: string;
  kind: SyncOperationKind;
  annotationId: string;
  payload: { [key: string]: SyncJson };
  author: string;
  clock: SyncClock;
}
```

### SyncOperationKind

Type.

```text
type SyncOperationKind = 'add' | 'update' | 'remove' | 'reply-add' | 'reply-update' | 'reply-remove';
```

### SyncSnapshot

Type.

```text
interface SyncSnapshot {
  version: 1;
  counter: number;
  entries: SyncSnapshotEntry[];
  forms?: FormSyncSnapshot;
  pages?: PageSyncSnapshot;
}
```

### SyncSnapshotEntry

Type.

```text
interface SyncSnapshotEntry {
  id: string;
  added?: SyncClock;
  removed?: SyncClock;
  groups: { [group: string]: { clock: SyncClock; values: { [key: string]: SyncJson } } };
  replies: {
    [replyId: string]: {
      clock: SyncClock;
      added?: SyncClock;
      removed?: SyncClock;
      reply?: { [key: string]: SyncJson };
    };
  };
}
```

### TextMarkupType

Type.

```text
type TextMarkupType = 'highlight' | 'underline' | 'strikeout' | 'squiggly';
```

### toRotatedPoint

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function toRotatedPoint(annotation: Pick<PdfAnnotation, "rect" | "rotation">, p: PdfPoint): PdfPoint;
```

### toSyncJson

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function toSyncJson(value: unknown): SyncJson;
```

### toUnrotatedPoint

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function toUnrotatedPoint(annotation: Pick<PdfAnnotation, "rect" | "rotation">, p: PdfPoint): PdfPoint;
```

### unrotatedRectFromBounds

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function unrotatedRectFromBounds(bounds: PdfRect, degrees: number, aspect?: number): PdfRect | undefined;
```

### uprightPlacement

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function uprightPlacement(rect: PdfRect, pageRotation: number): { rect: PdfRect; rotation: number | undefined; };
```

### uprightRotation

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function uprightRotation(pageRotation: number): number;
```

### viewportTransform

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function viewportTransform(box: PdfRect, rotation: number, scale: number): Matrix;
```

### XfdfImport

Type.

```text
interface XfdfImport {
  annotations: AnnotationInput[];
  fields: Record<string, FormValue>;
}
```

## Forms

### BarcodeFieldInfo

Type.

```text
interface BarcodeFieldInfo {
  symbology: 'pdf417' | 'qrCode' | 'dataMatrix' | 'unknown';
}
```

### checkFieldValue

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function checkFieldValue(field: ValidatedField, value: FormValue, resolve?: FieldValueResolver): FieldIssue | undefined;
```

### classifyScript

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function classifyScript(trigger: FieldScriptTrigger, source: string | undefined): FieldScriptInfo;
```

### describeScripts

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function describeScripts(field: Pick<PdfFormField, "format" | "calculation" | "range" | "scripts">): FieldScriptReport;
```

### DetectedField

Type.

```text
interface DetectedField {
  type: 'text' | 'checkbox';
  pageIndex: number;
  rect: PdfRect;
  name: string;
  /** The text on the page the name was taken from. */
  label?: string;
  isMultiline?: boolean;
  source: 'underline' | 'box' | 'square' | 'underscores';
}
```

### detectFields

Value, from `@birchui/pdf/engine`.

```text
function detectFields(shapes: readonly DetectionShape[], text: PageTextStructure, pageIndex: number, options?: DetectFieldsOptions): DetectedField[];
```

### DetectFieldsOptions

Type.

```text
interface DetectFieldsOptions {
  /** Names that are taken already; detected names are made different from these and from each other. */
  takenNames?: Iterable<string>;
  /** Rectangles of fields the page has already; a candidate that overlaps one is left out. */
  existing?: readonly PdfRect[];
}
```

### DetectionShape

Type.

```text
interface DetectionShape {
  rect: PdfRect;
  /** The painting operator of the path: `S`, `f`, `B` and their variants. */
  operator: string;
}
```

### DuplicateFieldOptions

Type.

```text
interface DuplicateFieldOptions {
  offset?: [number, number];
  pageIndex?: number;
  newName?: string;
}
```

### FieldAction

Type.

```text
type FieldAction =
  | SubmitFormAction
  | ResetFormAction
  | { type: 'javaScript'; script: string }
  | { type: 'named'; name: string }
  | { type: 'goTo'; pageIndex?: number; destination?: string }
  | { type: 'uri'; uri: string }
  | { type: 'hide'; fields: string[]; isHidden: boolean }
  | { type: 'other'; subtype: string };
```

### FieldActionEntry

Type.

```text
interface FieldActionEntry {
  trigger: FieldActionTrigger;
  widgetIndex?: number;
  action: FieldAction;
}
```

### FieldActionTrigger

Type.

```text
type FieldActionTrigger =
  | 'activate'
  | 'mouseUp'
  | 'mouseDown'
  | 'mouseEnter'
  | 'mouseExit'
  | 'focus'
  | 'blur'
  | 'keystroke'
  | 'format'
  | 'validate'
  | 'calculate';
```

### FieldAlignment

Type.

```text
type FieldAlignment = 'left' | 'right' | 'top' | 'bottom' | 'center' | 'middle';
```

### FieldCalculation

Type.

```text
interface FieldCalculation {
  operation: 'SUM' | 'AVG' | 'PRD' | 'MIN' | 'MAX' | 'CUSTOM';
  fields: string[];
  expression?: string;
}
```

### FieldFormat

Type.

```text
type FieldFormat =
  | {
      kind: 'number';
      decimals: number;
      separatorStyle: number;
      negativeStyle: number;
      currency: string;
      isCurrencyPrepended: boolean;
    }
  | { kind: 'percent'; decimals: number; separatorStyle: number }
  | { kind: 'date'; pattern: string }
  | { kind: 'time'; pattern: string }
  | { kind: 'special'; mask: 'zip' | 'zip4' | 'phone' | 'ssn' }
  | { kind: 'mask'; mask: string };
```

### FieldIssue

Type.

```text
interface FieldIssue {
  code: FormIssueCode;
  key: FormMessageKey;
  params: FormMessageParams;
  message: string;
}
```

### fieldKind

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function fieldKind(field: Pick<PdfFormField, "type" | "barcode">): PdfFieldType;
```

### FieldRange

Type.

```text
interface FieldRange {
  min?: number;
  max?: number;
}
```

### FieldScriptInfo

Type.

```text
interface FieldScriptInfo {
  status: 'supported' | 'unsupported' | 'none';
  kind: 'none' | 'builtin' | 'expression' | 'custom';
  source: string;
}
```

### FieldScriptReport

Type.

```text
type FieldScriptReport = Record<FieldScriptTrigger, FieldScriptInfo>;
```

### FieldScripts

Type.

```text
interface FieldScripts {
  format?: string;
  keystroke?: string;
  validate?: string;
  calculate?: string;
}
```

### FieldScriptTrigger

Type.

```text
type FieldScriptTrigger = keyof FieldScripts;
```

### FieldSignatureInput

Type.

```text
type FieldSignatureInput =
  | { kind: 'image'; image: AnnotationImage }
  | { kind: 'drawn'; inkList: PdfPoint[][]; strokeWidth?: number; color?: string }
  | { kind: 'typed'; text: string };
```

### filterFieldKeystroke

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function filterFieldKeystroke(field: KeystrokeField, currentValue: string, change: string, selStart: number, selEnd?: number): KeystrokeResult;
```

### FlattenMode

Type.

```text
type FlattenMode = 'forms' | 'annotations' | 'all';
```

### FORM_MESSAGES

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
const FORM_MESSAGES: Record<FormMessageKey, string>;
```

### formatFieldValue

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function formatFieldValue(field: Pick<PdfFormField, "format" | "value"> & { scripts?: FieldScripts; }, value?: FormValue): string;
```

### formatFormMessage

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function formatFormMessage(key: FormMessageKey, params?: FormMessageParams, messages?: Partial<Record<FormMessageKey, string>>): string;
```

### FormFieldInput

Type.

```text
interface FormFieldInput {
  name: string;
  type: FormFieldType;
  pageIndex: number;
  rect: PdfRect;
  value?: FormValue;
  options?: (FormFieldOption | string)[];
  tooltip?: string;
  isReadOnly?: boolean;
  isRequired?: boolean;
  isMultiline?: boolean;
  isPassword?: boolean;
  isComb?: boolean;
  maxLength?: number;
  isMultiSelect?: boolean;
  isEditable?: boolean;
  alignment?: 'left' | 'center' | 'right';
  fontSize?: number;
  borderColor?: string | null;
  backgroundColor?: string | null;
  format?: FieldFormat;
  calculation?: FieldCalculation;
  range?: FieldRange;
  radioValue?: string;
  isNoExport?: boolean;
  richText?: RichTextParagraph[];
}
```

### FormFieldOption

Type.

```text
interface FormFieldOption {
  value: string;
  label: string;
}
```

### FormFieldPatch

Type.

```text
type FormFieldPatch = Partial<Omit<FormFieldInput, 'name' | 'type'>> & { widgetIndex?: number };
```

### FormFieldTarget

Type.

```text
type FormFieldTarget = string | { name: string; widgetIndex?: number };
```

### FormFieldType

Type.

```text
type FormFieldType = 'text' | 'checkbox' | 'radio' | 'combo' | 'list' | 'signature' | 'button';
```

### FormFieldWidget

Type.

```text
interface FormFieldWidget {
  id: string;
  pageIndex: number;
  rect: PdfRect;
  onValue?: string;
  exportValue?: string;
  isHidden?: boolean;
  tabIndex?: number;
  rotation?: 90 | 180 | 270;
}
```

### FormImportRejection

Type.

```text
interface FormImportRejection {
  name: string;
  code: FormIssueCode | 'option' | 'type';
  key: FormMessageKey;
  params: FormMessageParams;
  message: string;
}
```

### FormImportResult

Type.

```text
interface FormImportResult {
  imported: number;
  changed: string[];
  unknown: string[];
  rejected: FormImportRejection[];
}
```

### FormIssue

Type.

```text
interface FormIssue extends FieldIssue {
  name: string;
  pageIndex: number;
  rect: PdfRect;
}
```

### FormIssueCode

Type.

```text
type FormIssueCode = 'required' | 'format' | 'range' | 'script' | 'maxLength' | 'pattern';
```

### FormJson

Type.

```text
type FormJson = { [name: string]: FormJsonValue };
```

### FormJsonOptions

Type.

```text
interface FormJsonOptions {
  flat?: boolean;
}
```

### FormJsonValue

Type.

```text
type FormJsonValue = string | boolean | null | string[] | FormJson;
```

### FormMessageKey

Type.

```text
type FormMessageKey =
  | 'required'
  | 'maxLength'
  | 'number'
  | 'rangeMin'
  | 'rangeMax'
  | 'date'
  | 'time'
  | 'special'
  | 'mask'
  | 'script'
  | 'option'
  | 'readOnlyType';
```

### FormMessageParams

Type.

```text
type FormMessageParams = Record<string, string | number>;
```

### FormState

Type.

```text
interface FormState {
  isDirty: boolean;
  dirtyFields: string[];
  isValid: boolean;
  fieldCount: number;
  filledCount: number;
  requiredCount: number;
  requiredFilledCount: number;
}
```

### FormSubmitPayload

Type.

```text
interface FormSubmitPayload {
  url: string;
  method: 'get' | 'post';
  format: SubmitFormat;
  body: PdfBytes | string;
  contentType: string;
  fieldNames: string[];
}
```

### FormValue

Type.

```text
type FormValue = string | string[] | boolean | null;
```

### KeystrokeResult

Type.

```text
interface KeystrokeResult {
  isAccepted: boolean;
  value: string;
  selStart: number;
  selEnd: number;
  key?: FormMessageKey;
}
```

### PageTabOrder

Type.

```text
interface PageTabOrder {
  pageIndex: number;
  mode: TabOrderMode;
  widgets: TabOrderEntry[];
}
```

### parseCalculateScript

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function parseCalculateScript(script: string | undefined): FieldCalculation | undefined;
```

### parseFormatScript

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function parseFormatScript(script: string | undefined): FieldFormat | undefined;
```

### parseValidateScript

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function parseValidateScript(script: string | undefined): FieldRange | undefined;
```

### PdfFieldType

Type.

```text
type PdfFieldType = FormFieldType | 'barcode';
```

### PdfFormField

Type.

```text
interface PdfFormField {
  name: string;
  type: FormFieldType;
  value: FormValue;
  defaultValue: FormValue;
  widgets: FormFieldWidget[];
  options?: FormFieldOption[];
  tooltip?: string;
  isReadOnly: boolean;
  isRequired: boolean;
  isMultiline?: boolean;
  isPassword?: boolean;
  isComb?: boolean;
  maxLength?: number;
  isMultiSelect?: boolean;
  isEditable?: boolean;
  alignment?: 'left' | 'center' | 'right';
  fontSize?: number;
  borderColor?: string | null;
  backgroundColor?: string | null;
  format?: FieldFormat;
  calculation?: FieldCalculation;
  range?: FieldRange;
  signature?: SignatureInfo;
  scripts?: FieldScripts;
  isNoExport?: boolean;
  isNoToggleToOff?: boolean;
  isRadiosInUnison?: boolean;
  isRichText?: boolean;
  richText?: RichTextParagraph[];
  actions?: FieldActionEntry[];
  signatureLock?: SignatureFieldLock;
  barcode?: BarcodeFieldInfo;
}
```

### RECOGNISED_FUNCTIONS

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
const RECOGNISED_FUNCTIONS: readonly string[];
```

### ResetFormAction

Type.

```text
interface ResetFormAction {
  type: 'resetForm';
  fields: string[];
  isExclude: boolean;
}
```

### SignatureFieldInfo

Type.

```text
interface SignatureFieldInfo {
  name: string;
  pageIndex: number;
  rect: PdfRect;
  isSigned: boolean;
  isRequired: boolean;
  isReadOnly: boolean;
  lock?: SignatureFieldLock;
}
```

### SignatureFieldLock

Type.

```text
interface SignatureFieldLock {
  action: 'all' | 'include' | 'exclude';
  fields: string[];
}
```

### SignatureInfo

Type.

```text
interface SignatureInfo {
  signerName?: string;
  signedAt?: string;
  reason?: string;
  location?: string;
  filter?: string;
  subFilter?: string;
  byteRange?: number[];
  coversWholeFile: boolean;
  hasLaterChanges: boolean;
  integrity: 'unchecked' | 'intact' | 'modified' | 'unsupported';
}
```

### SimpleCalculation

Type.

```text
type SimpleCalculation =
  { op: 'sum' | 'product' | 'average' | 'min' | 'max'; fields: string[] } | { expression: string };
```

### SubmitFormAction

Type.

```text
interface SubmitFormAction {
  type: 'submitForm';
  url: string;
  flags: number;
  format: SubmitFormat;
  method: 'get' | 'post';
  fields: string[];
  isExclude: boolean;
  includeEmpty: boolean;
}
```

### SubmitFormat

Type.

```text
type SubmitFormat = 'fdf' | 'xfdf' | 'html' | 'pdf';
```

### TabOrderMode

Type.

```text
type TabOrderMode = 'row' | 'column' | 'structure' | 'manual' | 'unspecified';
```

### validateFieldValue

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function validateFieldValue(field: ValidatedField, value: FormValue, resolve?: FieldValueResolver): string | undefined;
```

## Text, geometry and redaction search

### PageGeometry

Type.

```text
interface PageGeometry {
  points: PdfPoint[];
  segments: PdfSegment[];
  baselines: PdfSegment[];
  textBoxes: PageTextBox[];
  isTruncated: boolean;
}
```

### PageGeometryOptions

Type.

```text
interface PageGeometryOptions {
  maxPoints?: number;
  maxSegments?: number;
  maxTextRuns?: number;
  bounds?: PdfRect;
  includeText?: boolean;
  includePaths?: boolean;
  includeImages?: boolean;
}
```

### PageTextBox

Type.

```text
interface PageTextBox {
  rect: PdfRect;
  quad: PdfQuad;
}
```

### PageTextDirection

Type.

```text
type PageTextDirection = 'ltr' | 'rtl' | 'ttb';
```

### PageTextItem

Type.

```text
interface PageTextItem {
  text: string;
  rect: PdfRect;
  quad: PdfQuad;
  baseline: [PdfPoint, PdfPoint];
  fontName?: string;
  fontSize: number;
  isBold: boolean;
  isItalic: boolean;
  rotation: number;
  direction: PageTextDirection;
  lineIndex: number;
  hasSpaceAfter: boolean;
  charQuads?: PdfQuad[];
}
```

### PageTextLine

Type.

```text
interface PageTextLine {
  text: string;
  rect: PdfRect;
  quad: PdfQuad;
  baseline: [PdfPoint, PdfPoint];
  fontSize: number;
  rotation: number;
  direction: PageTextDirection;
  items: PageTextItem[];
}
```

### PageTextOrder

Type.

```text
type PageTextOrder = 'reading' | 'content';
```

### PageTextStructure

Type.

```text
interface PageTextStructure {
  text: string;
  lines: PageTextLine[];
  items: PageTextItem[];
  /** With `markedContent` and content order: lines and marked-content boundaries as they follow each other. */
  sequence?: (PageTextLine | PageTextMark)[];
}
```

### PdfQuad

Type.

```text
type PdfQuad = [bottomLeft: PdfPoint, bottomRight: PdfPoint, topRight: PdfPoint, topLeft: PdfPoint];
```

### PdfSegment

Type.

```text
type PdfSegment = [x1: number, y1: number, x2: number, y2: number];
```

### quadPointsFromQuads

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function quadPointsFromQuads(quads: readonly PdfQuad[]): number[];
```

### REDACTION_PATTERN_NAMES

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
const REDACTION_PATTERN_NAMES: readonly ("date" | "email" | "phone" | "ssn" | "creditCard" | "iban")[];
```

### REDACTION_PATTERNS

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
const REDACTION_PATTERNS: { readonly email: RegExp; readonly phone: RegExp; readonly ssn: RegExp; readonly creditCard: RegExp; readonly iban: RegExp; readonly date: RegExp; };
```

### RedactionPattern

Type.

```text
type RedactionPattern = RedactionPatternName;
```

### RedactionPatternName

Type.

```text
type RedactionPatternName = keyof typeof REDACTION_PATTERNS;
```

### RedactionQuery

Type.

```text
type RedactionQuery =
  | string
  | RegExp
  | { text: string; matchCase?: boolean; wholeWord?: boolean }
  | { pattern: RegExp }
  | { preset: RedactionPatternName };
```

### TextMatch

Type.

```text
interface TextMatch {
  start: number;
  end: number;
  text: string;
  rects: PdfRect[];
}
```

## Content editing

### AddImageOptions

Type.

```text
interface AddImageOptions {
  data: Uint8Array;
  rect: PdfRect;
  opacity?: number;
  rotation?: number;
}
```

### AddMarkOptions

Type.

```text
interface AddMarkOptions {
  kind: PageMarkKind;
  /** Centre of the mark. */
  x: number;
  y: number;
  size?: number;
  color?: string;
}
```

### AddTextOptions

Type.

```text
interface AddTextOptions {
  text: string;
  x: number;
  y: number;
  fontSize?: number;
  color?: string;
  opacity?: number;
  font?: StandardFontName;
  /** Name of a supplied font to use instead of a standard one. */
  fontName?: string;
  rotation?: number;
  lineHeight?: number;
  fonts?: FontRegistry;
}
```

### AddTextResult

Type.

```text
interface AddTextResult extends TextEditResult {
  rect?: PdfRect;
}
```

### ContentEditFailure

Type.

```text
type ContentEditFailure =
  | 'stale-hit'
  | 'unsupported-font'
  | 'missing-glyphs'
  | 'empty-text'
  | 'unsupported-image'
  | 'not-invertible'
  | 'unsupported-object';
```

### EditableTextMatch

Type.

```text
interface EditableTextMatch {
  /** The block of text in reading order, then the position of the match in it. */
  id: string;
  text: string;
  before: string;
  after: string;
  rect: PdfRect;
  /** Whether replacing reflows a paragraph or rewrites one text run. */
  scope: 'paragraph' | 'run';
  start: number;
  end: number;
}
```

### EncodedImageMimeType

Type.

```text
type EncodedImageMimeType = 'image/jpeg' | 'image/jp2' | 'image/x-jbig2' | 'image/g3fax';
```

### ExtractedImage

Type.

```text
interface ExtractedImage {
  id: string;
  index: number;
  name: string;
  isInline: boolean;
  ref?: PdfRef;
  rect: PdfRect;
  quad: [PdfPoint, PdfPoint, PdfPoint, PdfPoint];
  matrix: Matrix;
  width: number;
  height: number;
  bitsPerComponent: number;
  colorSpace?: string;
  filters: string[];
  format: PageImageFormat;
  isMask: boolean;
  hasMask: boolean;
  status: ExtractedImageStatus;
  data?: ExtractedImagePixels;
  encoded?: ExtractedImageEncoding;
  isRendered?: boolean;
  message?: string;
}
```

### ExtractedImageEncoding

Type.

```text
interface ExtractedImageEncoding {
  mimeType: EncodedImageMimeType;
  filter: string;
  bytes: Uint8Array;
  decodeParms?: Record<string, number | boolean>;
  jbig2Globals?: Uint8Array;
}
```

### ExtractedImagePixels

Type.

```text
interface ExtractedImagePixels {
  width: number;
  height: number;
  rgba: Uint8Array;
}
```

### ExtractedImageStatus

Type.

```text
type ExtractedImageStatus = 'decoded' | 'encoded-only' | 'unsupported';
```

### FindTextOptions

Type.

```text
interface FindTextOptions {
  matchCase?: boolean;
  wholeWord?: boolean;
}
```

### ImageEditResult

Type.

```text
interface ImageEditResult {
  ok: boolean;
  reason?: ContentEditFailure;
  message?: string;
  name?: string;
  ref?: PdfRef;
  rect?: PdfRect;
  image?: PageImage;
}
```

### ImageMove

Type.

```text
type ImageMove = { dx: number; dy: number } | { rect: PdfRect } | { matrix: Matrix };
```

### ObjectEditResult

Type.

```text
interface ObjectEditResult {
  ok: boolean;
  reason?: ContentEditFailure;
  message?: string;
  object?: PageObject;
}
```

### ObjectOrder

Type.

```text
type ObjectOrder = 'front' | 'forward' | 'backward' | 'back';
```

### OcrPageImage

Type.

```text
interface OcrPageImage {
  pageIndex: number;
  width: number;
  height: number;
  data: Uint8Array;
}
```

### OcrWord

Type.

```text
interface OcrWord {
  text: string;
  rect: [number, number, number, number];
}
```

### PageImage

Type.

```text
interface PageImage {
  id: string;
  index: number;
  name: string;
  ref?: PdfRef;
  rect: PdfRect;
  quad: [PdfPoint, PdfPoint, PdfPoint, PdfPoint];
  matrix: Matrix;
  width: number;
  height: number;
  filter?: string;
  format: PageImageFormat;
  bitsPerComponent: number;
  colorSpace?: string;
  isMask: boolean;
  hasAlpha: boolean;
  /** Constant opacity set next to the image, 1 when none. */
  opacity: number;
  /** The shown part in image space (0 to 1 from the lower left corner), when the image is cropped. */
  crop?: [x0: number, y0: number, x1: number, y1: number];
  /** Bounding box of the shown part on the page. */
  visibleRect: PdfRect;
}
```

### PageImageFormat

Type.

```text
type PageImageFormat = 'raw' | 'jpeg' | 'jpeg2000' | 'jbig2' | 'ccitt' | 'unknown';
```

### PageMarkKind

Type.

```text
type PageMarkKind = 'tick' | 'cross' | 'dot' | 'circle';
```

### PageObject

Type.

```text
interface PageObject {
  id: string;
  kind: PageObjectKind;
  /** Operation that paints the object, and the first operation that belongs to it. */
  index: number;
  firstIndex: number;
  /** Position in paint order, 0 is painted first. */
  order: number;
  rect: PdfRect;
  operator: string;
  label: string;
  matrix: Matrix;
  hasClip?: boolean;
  isInvisible?: boolean;
  layer?: PageObjectLayer;
}
```

### PageObjectKind

Type.

```text
type PageObjectKind = 'text' | 'image' | 'path' | 'form' | 'shading' | 'inlineImage';
```

### PageObjectLayer

Type.

```text
type PageObjectLayer = 'watermark' | 'header' | 'footer' | 'background' | 'pageNumbers' | 'bates';
```

### ParagraphEditOptions

Type.

```text
interface ParagraphEditOptions {
  fonts?: FontRegistry;
  width?: number;
  /** Move the text, images and shapes under the paragraph down when it needs more lines than before. */
  pushBelow?: boolean;
}
```

### ParagraphEditResult

Type.

```text
interface ParagraphEditResult extends TextEditResult {
  lines?: string[];
  rect?: PdfRect;
  overflow?: number;
  /** How many objects under the paragraph were moved down to make room. */
  pushed?: number;
}
```

### RecognizeTextCallback

Type.

```text
type RecognizeTextCallback = (image: OcrPageImage) => OcrWord[] | Promise<OcrWord[]>;
```

### ReplaceTextResult

Type.

```text
interface ReplaceTextResult {
  replaced: number;
  failed: { id: string; text: string; reason: ContentEditFailure; message: string }[];
}
```

### RestyleResult

Type.

```text
interface RestyleResult extends TextEditResult {
  rect?: PdfRect;
  isSynthetic?: boolean;
}
```

### StandardFontName

Type.

```text
type StandardFontName =
  | 'Helvetica'
  | 'Helvetica-Bold'
  | 'Helvetica-Oblique'
  | 'Helvetica-BoldOblique'
  | 'Times-Roman'
  | 'Times-Bold'
  | 'Times-Italic'
  | 'Times-BoldItalic'
  | 'Courier'
  | 'Courier-Bold'
  | 'Courier-Oblique'
  | 'Courier-BoldOblique';
```

### TextEditResult

Type.

```text
interface TextEditResult {
  ok: boolean;
  reason?: ContentEditFailure;
  message?: string;
  usedFont?: 'original' | 'embedded' | 'standard';
  fontNames?: string[];
  missing?: string;
  widthChange?: number;
}
```

### TextLayerResult

Type.

```text
interface TextLayerResult {
  words: number;
  skippedWords: number;
}
```

### TextLayerRotation

Type.

```text
type TextLayerRotation = 0 | 90 | 180 | 270;
```

### TextLayerWord

Type.

```text
interface TextLayerWord {
  text: string;
  rect: PdfRect;
  /**
   * Direction of the baseline in page space, counter-clockwise in degrees. Left out, the word reads upright on
   * the page as it is displayed, so it follows the rotation of the page.
   */
  rotation?: TextLayerRotation;
}
```

### TextMove

Type.

```text
interface TextMove {
  dx: number;
  dy: number;
}
```

### TextMoveResult

Type.

```text
interface TextMoveResult extends TextEditResult {
  run?: TextRun;
}
```

### TextParagraph

Type.

```text
interface TextParagraph {
  index: number;
  text: string;
  lines: string[];
  runs: TextRun[];
  rect: PdfRect;
  fontName: string;
  baseFont?: string;
  fontSize: number;
  lineHeight: number;
  /** How the lines sit in the block. A rewritten paragraph keeps it. */
  alignment: ParagraphAlignment;
}
```

### TextRun

Type.

```text
interface TextRun {
  index: number;
  operator: string;
  text: string;
  rect: PdfRect;
  fontName: string;
  fontSize: number;
  baseFont?: string;
  origin: PdfPoint;
  matrix: Matrix;
  advance: number;
  /** Drawn with the invisible render mode, as a text layer over a scan is. */
  isInvisible?: boolean;
}
```

### TextStyle

Type.

```text
interface TextStyle {
  /** A standard font, or the name of a supplied font. */
  font?: string;
  fontSize?: number;
  color?: string;
  isBold?: boolean;
  isItalic?: boolean;
}
```

## Redaction

### DecodedRedactionImage

Type.

```text
interface DecodedRedactionImage {
  width: number;
  height: number;
  rgba: Uint8Array | Uint8ClampedArray;
}
```

### RedactionArea

Type.

```text
interface RedactionArea {
  rect: PdfRect;
  fillColor?: string;
  overlayText?: string;
}
```

### RedactionImageInfo

Type.

```text
interface RedactionImageInfo {
  data: Uint8Array;
  filter: string;
  width: number;
  height: number;
  bitsPerComponent: number;
  colorSpace?: string;
  isMask: boolean;
  decode?: number[];
  decodeParms?: Record<string, number | boolean>;
  jbig2Globals?: Uint8Array;
}
```

### RedactionImageOutcome

Type.

```text
interface RedactionImageOutcome {
  name: string;
  action: 'modified' | 'removed';
  filter?: string;
  decodedBy?: 'package' | 'callback';
  reason?: RedactionImageRemovalReason;
  message?: string;
}
```

### RedactionImageRemovalReason

Type.

```text
type RedactionImageRemovalReason = 'covered' | 'undecodable' | 'mask-undecodable' | 'inline-image';
```

### RedactionImageRequest

Type.

```text
interface RedactionImageRequest extends RedactionImageInfo {
  ref: PdfRef;
  name: string;
  role: 'image' | 'softMask' | 'mask';
  rect: PdfRect;
  matrix: Matrix;
}
```

### RedactionReport

Type.

```text
interface RedactionReport {
  glyphsRemoved: number;
  removedText: string;
  imagesRemoved: number;
  imagesModified: number;
  pathsRemoved: number;
  formsRewritten: number;
  images: RedactionImageOutcome[];
}
```

## Signatures

### addDocumentTimestamp

Value, from `@birchui/pdf/engine`.

```text
function addDocumentTimestamp(data: Uint8Array | ArrayBuffer, options: AddDocumentTimestampOptions): Promise<PdfBytes>;
```

### AddDocumentTimestampOptions

Type.

```text
interface AddDocumentTimestampOptions {
  timestamp: TimestampCallback;
  fieldName?: string;
  placeholderSize?: number;
  password?: string;
}
```

### addValidationData

Value, from `@birchui/pdf/engine`.

```text
function addValidationData(data: Uint8Array | ArrayBuffer, options?: AddValidationDataOptions): Promise<PdfBytes>;
```

### AddValidationDataOptions

Type.

```text
interface AddValidationDataOptions {
  certificates?: (Uint8Array | string)[];
  ocsps?: Uint8Array[];
  crls?: Uint8Array[];
  fetch?: ValidationDataCallback;
  password?: string;
  now?: Date;
}
```

### certificateToDer

Value, from `@birchui/pdf/engine`.

```text
function certificateToDer(input: Uint8Array | string): Uint8Array;
```

### ChainProblem

Type.

```text
interface ChainProblem {
  code: ChainProblemCode;
  /** Position in the chain of the certificate the problem is about; 0 is the signer. */
  index: number;
  subject: string;
  message: string;
}
```

### ChainProblemCode

Type.

```text
type ChainProblemCode =
  'ca-not-valid-at-signing' | 'not-a-ca' | 'key-usage' | 'path-length' | 'name-constraints';
```

### ChainStatus

Type.

```text
type ChainStatus = 'trusted' | 'untrusted' | 'self-signed' | 'incomplete';
```

### checkChainConstraints

Value, from `@birchui/pdf/engine`.

```text
function checkChainConstraints(chain: readonly ParsedCertificate[], at: Date): ChainProblem[];
```

### CheckResult

Type.

```text
type CheckResult = 'valid' | 'invalid' | 'unsupported';
```

### derToPem

Value, from `@birchui/pdf/engine`.

```text
function derToPem(der: Uint8Array, label: string): string;
```

### GeneralName

Type.

```text
interface GeneralName {
  kind: 'email' | 'dns' | 'directory' | 'uri' | 'other';
  value: string;
}
```

### HashName

Type.

```text
type HashName = 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512';
```

### importPkcs12PrivateKey

Value, from `@birchui/pdf/engine`.

```text
function importPkcs12PrivateKey(contents: Pkcs12Contents, hash?: "SHA-256" | "SHA-384" | "SHA-512"): Promise<CryptoKey>;
```

### isTrustListExpired

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function isTrustListExpired(list: PdfTrustList, now?: Date): boolean;
```

### KeyUsage

Type.

```text
type KeyUsage =
  | 'digitalSignature'
  | 'nonRepudiation'
  | 'keyEncipherment'
  | 'dataEncipherment'
  | 'keyAgreement'
  | 'keyCertSign'
  | 'cRLSign'
  | 'encipherOnly'
  | 'decipherOnly';
```

### loadTrustList

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function loadTrustList(input: PdfTrustListInput | string): PdfTrustList;
```

### NameConstraints

Type.

```text
interface NameConstraints {
  permitted: GeneralName[];
  excluded: GeneralName[];
}
```

### PadesLevel

Type.

```text
type PadesLevel = 'B-B' | 'B-T' | 'B-LT' | 'B-LTA' | 'not-pades';
```

### parsePkcs12

Value, from `@birchui/pdf/engine`.

```text
function parsePkcs12(data: Uint8Array | ArrayBuffer, password?: string): Promise<Pkcs12Contents>;
```

### PdfCertificateInfo

Type.

```text
interface PdfCertificateInfo {
  subject: PdfDistinguishedName;
  issuer: PdfDistinguishedName;
  serialNumber: string;
  notBefore: string;
  notAfter: string;
  publicKeyAlgorithm: 'RSA' | 'EC' | 'unknown';
  publicKeyBits?: number;
  curve?: 'P-256' | 'P-384' | 'P-521';
  isCertificateAuthority: boolean;
  isSelfIssued: boolean;
  der: Uint8Array;
  revocation?: RevocationStatus;
  revocationDetails?: PdfRevocationDetails;
}
```

### PdfCertificationInfo

Type.

```text
interface PdfCertificationInfo {
  level: 1 | 2 | 3;
  permission: PdfCertificationPermission;
}
```

### PdfCertificationPermission

Type.

```text
type PdfCertificationPermission = 'no-changes' | 'form-filling' | 'annotations-and-forms';
```

### PdfDistinguishedName

Type.

```text
interface PdfDistinguishedName {
  text: string;
  commonName?: string;
  organization?: string;
  organizationalUnit?: string;
  country?: string;
  email?: string;
}
```

### PdfFieldLock

Type.

```text
type PdfFieldLock = 'all' | { include: string[] } | { exclude: string[] };
```

### PdfModificationReport

Type.

```text
interface PdfModificationReport {
  status: 'none' | 'allowed' | 'disallowed' | 'unknown';
  changes: PdfRevisionChange[];
  warnings?: PdfModificationWarning[];
}
```

### PdfModificationWarning

Type.

```text
interface PdfModificationWarning {
  code: 'annotation-covers-content';
  objectNumber: number;
  pageIndex: number;
  coveredRatio: number;
}
```

### PdfRevisionChange

Type.

```text
interface PdfRevisionChange {
  objectNumber: number;
  change: 'added' | 'changed' | 'removed';
  kind: RevisionChangeKind;
  ownerObjectNumber?: number;
  pageIndex?: number;
  coversContent?: boolean;
  coveredRatio?: number;
}
```

### PdfRevocationDetails

Type.

```text
interface PdfRevocationDetails {
  status: RevocationStatus;
  source?: 'ocsp' | 'crl' | 'callback';
  revokedAt?: string;
  reason?: string;
  thisUpdate?: string;
  nextUpdate?: string;
}
```

### PdfSignatureChain

Type.

```text
interface PdfSignatureChain {
  status: ChainStatus | 'unknown';
  certificates: PdfCertificateInfo[];
  /** Constraint violations of the chain: key usage, CA flag, path length, name constraints, validity of issuers. */
  problems: ChainProblem[];
}
```

### PdfSignatureSubFilter

Type.

```text
type PdfSignatureSubFilter = 'adbe.pkcs7.detached' | 'ETSI.CAdES.detached';
```

### PdfSignatureSummary

Type.

```text
type PdfSignatureSummary =
  'trusted' | 'valid-untrusted' | 'changed-after-signing' | 'revoked' | 'invalid' | 'unsupported';
```

### PdfSignatureTimestamp

Type.

```text
interface PdfSignatureTimestamp {
  time?: string;
  isValid: boolean;
  authority?: string;
  policy?: string;
  serialNumber?: string;
  error?: string;
  chain?: PdfSignatureChain;
  revocation?: RevocationStatus;
}
```

### PdfSignatureVerification

Type.

```text
interface PdfSignatureVerification {
  fieldName: string;
  type: 'signature' | 'certification' | 'timestamp';
  subFilter?: string;
  signerName?: string;
  reason?: string;
  location?: string;
  contactInfo?: string;
  signedAt?: string;
  signedAtSource?: 'timestamp' | 'signedAttribute' | 'dictionary';
  byteRange: number[];
  coversWholeFile: boolean;
  laterChanges: 'none' | 'signatures-only' | 'allowed' | 'disallowed' | 'unknown';
  integrity: 'intact' | 'modified' | 'unsupported';
  signature: CheckResult;
  signingCertificate: SigningCertificateCheck;
  digestAlgorithm?: HashName;
  signatureAlgorithm?: string;
  certificate?: PdfCertificateInfo;
  chain: PdfSignatureChain;
  isCertificateValidAtSigning?: boolean;
  isCertificateValidNow?: boolean;
  revocation: RevocationStatus;
  certificationLevel?: 1 | 2 | 3;
  certification?: PdfCertificationPermission;
  padesLevel?: PadesLevel;
  modification: PdfModificationReport;
  timestamp?: PdfSignatureTimestamp;
  isValid: boolean;
  isTrusted: boolean;
  summary: PdfSignatureSummary;
  /** Names of the trust lists that were not used because they are past their expiry date. */
  expiredTrustLists?: string[];
  warnings: PdfSignatureWarning[];
  error?: string;
}
```

### PdfSignatureWarning

Type.

```text
interface PdfSignatureWarning {
  code: 'annotation-covers-content';
  message: string;
  pageIndex: number;
  objectNumber: number;
  coveredRatio: number;
}
```

### PdfTrustList

Type.

```text
interface PdfTrustList {
  name: string;
  expires: Date;
  issued?: Date;
  /** DER bytes of the certificates that could be read. */
  certificates: Uint8Array[];
  entries: PdfCertificateInfo[];
  /** Certificates of the input that are not readable X.509 certificates. */
  rejected: number;
}
```

### PdfTrustListInput

Type.

```text
interface PdfTrustListInput {
  name: string;
  /** ISO 8601 date or `Date`. After it the list is not used. */
  expires: string | Date;
  issued?: string | Date;
  /** PEM text (one or several certificates) or DER bytes. */
  certificates: (string | Uint8Array)[];
}
```

### pemBlocks

Value, from `@birchui/pdf/engine`.

```text
function pemBlocks(pem: string, label: string): Uint8Array[];
```

### pemToDer

Value, from `@birchui/pdf/engine`.

```text
function pemToDer(pem: string, label?: string): Uint8Array;
```

### Pkcs12Contents

Type.

```text
interface Pkcs12Contents {
  privateKey: Uint8Array;
  privateKeyPem: string;
  certificate: Uint8Array;
  chain: Uint8Array[];
  friendlyName?: string;
}
```

### Pkcs12Error

Value, from `@birchui/pdf/engine`.

```text
class Pkcs12Error extends Error {
  constructor( readonly reason: Pkcs12ErrorReason, message: string, );
}
```

### Pkcs12ErrorReason

Type.

```text
type Pkcs12ErrorReason = 'password-incorrect' | 'unsupported' | 'malformed';
```

### RevisionChangeKind

Type.

```text
type RevisionChangeKind =
  'form' | 'annotation' | 'signature' | 'timestamp' | 'dss' | 'appearance' | 'metadata' | 'other';
```

### RevocationAnswer

Type.

```text
interface RevocationAnswer {
  status: 'good' | 'revoked' | 'unknown';
  revokedAt?: Date | string;
  reason?: string;
}
```

### RevocationCallback

Type.

```text
type RevocationCallback = (
  certificate: PdfCertificateInfo,
  issuer: PdfCertificateInfo,
) => RevocationAnswer | Promise<RevocationAnswer>;
```

### RevocationStatus

Type.

```text
type RevocationStatus = 'good' | 'revoked' | 'unknown' | 'not-checked';
```

### SignatureAppearanceOptions

Type.

```text
interface SignatureAppearanceOptions {
  text?: string[];
  image?: Uint8Array;
  showDate?: boolean;
  showReason?: boolean;
  showLocation?: boolean;
  fontSize?: number;
  textColor?: [number, number, number];
  borderColor?: [number, number, number] | null;
  borderWidth?: number;
  backgroundColor?: [number, number, number] | null;
}
```

### SignatureFieldPlacement

Type.

```text
interface SignatureFieldPlacement {
  name?: string;
  pageIndex: number;
  rect: [number, number, number, number];
}
```

### SignDigestCallback

Type.

```text
type SignDigestCallback = (digest: PdfBytes, info: SignDigestInfo) => Promise<Uint8Array> | Uint8Array;
```

### SignDigestInfo

Type.

```text
interface SignDigestInfo {
  algorithm: 'RSASSA-PKCS1-v1_5' | 'ECDSA';
  hash: HashName;
  curve?: 'P-256' | 'P-384' | 'P-521';
  signedAttributes: Uint8Array;
}
```

### signPdf

Value, from `@birchui/pdf/engine`.

```text
function signPdf(data: Uint8Array | ArrayBuffer, input: SignPdfOptions): Promise<PdfBytes>;
```

### SignPdfOptions

Type.

```text
interface SignPdfOptions {
  certificate?: Uint8Array | string;
  certificateChain?: (Uint8Array | string)[];
  privateKey?: string | CryptoKey;
  signDigest?: SignDigestCallback;
  pkcs12?: Uint8Array | ArrayBuffer;
  pkcs12Password?: string;
  timestamp?: TimestampCallback;
  reason?: string;
  location?: string;
  contactInfo?: string;
  name?: string;
  field?: string | SignatureFieldPlacement;
  appearance?: SignatureAppearanceOptions | false;
  certificationLevel?: 1 | 2 | 3;
  certify?: PdfCertificationPermission;
  subFilter?: PdfSignatureSubFilter;
  signedAt?: Date;
  placeholderSize?: number;
  password?: string;
  lockFields?: PdfFieldLock;
}
```

### TimestampCallback

Type.

```text
type TimestampCallback = (data: Uint8Array, info: TimestampRequestInfo) => Promise<Uint8Array> | Uint8Array;
```

### TimestampRequestInfo

Type.

```text
interface TimestampRequestInfo {
  hash: 'SHA-256';
  digest: Uint8Array;
}
```

### ValidationDataCallback

Type.

```text
type ValidationDataCallback = (
  request: ValidationDataRequest,
) => ValidationDataResponse | undefined | Promise<ValidationDataResponse | undefined>;
```

### ValidationDataRequest

Type.

```text
interface ValidationDataRequest {
  certificate: PdfCertificateInfo;
  issuer: PdfCertificateInfo;
  ocspUrls: string[];
  crlUrls: string[];
}
```

### ValidationDataResponse

Type.

```text
interface ValidationDataResponse {
  ocsp?: Uint8Array;
  crl?: Uint8Array;
}
```

### verifyPdfSignatures

Value, from `@birchui/pdf/engine`.

```text
function verifyPdfSignatures(data: Uint8Array | ArrayBuffer, options?: VerifySignaturesOptions): Promise<PdfSignatureVerification[]>;
```

### VerifySignaturesOptions

Type.

```text
interface VerifySignaturesOptions {
  trustedRoots?: (Uint8Array | string)[];
  /** Trust lists from `loadTrustList`. A list past its expiry date is not used and is named in the result. */
  trustLists?: PdfTrustList[];
  now?: Date;
  password?: string;
  ocsps?: Uint8Array[];
  crls?: Uint8Array[];
  checkRevocation?: RevocationCallback;
  requireRevocation?: boolean;
  limits?: Partial<PdfLimits>;
}
```

## Encryption and permissions

### EncryptionAlgorithm

Type.

```text
type EncryptionAlgorithm = 'rc4-40' | 'rc4-128' | 'aes-128' | 'aes-256';
```

### EncryptOptions

Type.

```text
interface EncryptOptions {
  userPassword?: string;
  ownerPassword?: string;
  permissions?: Partial<PdfPermissions>;
  algorithm?: EncryptionAlgorithm;
  encryptMetadata?: boolean;
}
```

### PdfCryptoUnavailableError

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
class PdfCryptoUnavailableError extends Error {
  constructor();
}
```

### PdfPasswordError

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
class PdfPasswordError extends Error {
  constructor(readonly reason: 'password-required' | 'password-incorrect' | 'unsupported');
}
```

### PdfPermissions

Type.

```text
interface PdfPermissions {
  print: boolean;
  printHighQuality: boolean;
  modify: boolean;
  copy: boolean;
  annotate: boolean;
  fillForms: boolean;
  extractForAccessibility: boolean;
  assemble: boolean;
}
```

### permissionsFromFlags

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function permissionsFromFlags(flags: number): PdfPermissions;
```

### permissionsToFlags

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function permissionsToFlags(permissions?: Partial<PdfPermissions>): number;
```

## Compare

### buildCompareReport

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function buildCompareReport(comparison: PdfComparison, options?: CompareReportOptions): string;
```

### ComparableDocument

Type.

```text
interface ComparableDocument {
  readonly pageCount: number;
  getPageText(pageIndex: number): ComparablePageText;
}
```

### ComparablePageText

Type.

```text
interface ComparablePageText {
  text: string;
  boxes: (PdfRect | undefined)[];
}
```

### CompareInput

Type.

```text
type CompareInput = Uint8Array | ArrayBuffer | ComparableDocument;
```

### comparePageTexts

Value, from `@birchui/pdf/engine`.

```text
function comparePageTexts(textsA: readonly ComparablePageText[], textsB: readonly ComparablePageText[], options?: ComparePdfOptions): PdfComparison;
```

### comparePdf

Value, from `@birchui/pdf/engine`.

```text
function comparePdf(a: CompareInput, b: CompareInput, options?: ComparePdfOptions): PdfComparison;
```

### comparePdfAsync

Value, from `@birchui/pdf/engine`.

```text
function comparePdfAsync(a: CompareInput, b: CompareInput, options?: ComparePdfAsyncOptions): Promise<PdfComparison>;
```

### ComparePdfAsyncOptions

Type.

```text
interface ComparePdfAsyncOptions extends ComparePdfOptions {
  password?: string;
  otherPassword?: string;
}
```

### ComparePdfOptions

Type.

```text
interface ComparePdfOptions {
  ignoreCase?: boolean;
  ignoreWhitespace?: boolean;
  annotations?: boolean;
  minMoveWords?: number;
  pageSimilarityThreshold?: number;
  colors?: { inserted?: string; deleted?: string; moved?: string };
  author?: string;
}
```

### CompareReportFormat

Type.

```text
type CompareReportFormat = 'html' | 'csv' | 'json';
```

### CompareReportLabels

Type.

```text
interface CompareReportLabels {
  title: string;
  first: string;
  second: string;
  page: string;
  change: string;
  text: string;
  inserted: string;
  deleted: string;
  moved: string;
  none: string;
  pages: string;
  words: string;
}
```

### CompareReportOptions

Type.

```text
interface CompareReportOptions {
  format?: CompareReportFormat;
  fileNameA?: string;
  fileNameB?: string;
  date?: Date | string;
  labels?: Partial<CompareReportLabels>;
}
```

### comparisonAnnotations

Value, from `@birchui/pdf/engine`.

```text
function comparisonAnnotations(changes: readonly PdfTextChange[], options?: Pick<ComparePdfOptions, "colors" | "author">): { a: AnnotationInput[]; b: AnnotationInput[]; };
```

### diffPixels

Value, from `@birchui/pdf`.

```text
function diffPixels(a: PixelBuffer, b: PixelBuffer, options?: PixelDiffOptions): PixelDiffResult;
```

### PageComparisonStatus

Type.

```text
type PageComparisonStatus = 'unchanged' | 'changed' | 'added' | 'removed' | 'moved';
```

### PdfComparison

Type.

```text
interface PdfComparison {
  pages: PdfPageComparison[];
  changes: PdfTextChange[];
  summary: PdfComparisonSummary;
  annotations?: { a: AnnotationInput[]; b: AnnotationInput[] };
}
```

### PdfComparisonSummary

Type.

```text
interface PdfComparisonSummary {
  pageCountA: number;
  pageCountB: number;
  pagesUnchanged: number;
  pagesChanged: number;
  pagesAdded: number;
  pagesRemoved: number;
  pagesMoved: number;
  insertions: number;
  deletions: number;
  moves: number;
  wordsInserted: number;
  wordsDeleted: number;
  wordsMoved: number;
  isIdentical: boolean;
}
```

### PdfPageComparison

Type.

```text
interface PdfPageComparison {
  status: PageComparisonStatus;
  pageIndexA?: number;
  pageIndexB?: number;
  similarity: number;
  changes: PdfTextChange[];
}
```

### PdfTextChange

Type.

```text
interface PdfTextChange {
  type: TextChangeType;
  text: string;
  pageIndexA?: number;
  pageIndexB?: number;
  rects: PdfRect[];
  fromRects?: PdfRect[];
  wordCount: number;
}
```

### PixelBuffer

Type.

```text
interface PixelBuffer {
  data: Uint8Array | Uint8ClampedArray;
  width: number;
  height: number;
}
```

### PixelDiffOptions

Type.

```text
interface PixelDiffOptions {
  tolerance?: number;
  color?: readonly [number, number, number];
  padding?: readonly [number, number, number, number];
  cellSize?: number;
  mergeDistance?: number;
  minRegionPixels?: number;
  maxRegions?: number;
}
```

### PixelDiffRegion

Type.

```text
interface PixelDiffRegion {
  x: number;
  y: number;
  width: number;
  height: number;
  changedPixels: number;
}
```

### PixelDiffResult

Type.

```text
interface PixelDiffResult {
  width: number;
  height: number;
  mask: Uint8ClampedArray<ArrayBuffer>;
  changedPixels: number;
  changedRatio: number;
  regions: PixelDiffRegion[];
}
```

### TextChangeType

Type.

```text
type TextChangeType = 'inserted' | 'deleted' | 'moved';
```

## Page and document tools

### AccessibilityCode

Type.

```text
type AccessibilityCode =
  | 'no-title'
  | 'title-not-shown'
  | 'no-language'
  | 'not-tagged'
  | 'figure-without-alt'
  | 'untagged-content'
  | 'reading-order'
  | 'page-without-text'
  | 'field-without-tooltip'
  | 'tab-order'
  | 'no-bookmarks';
```

### AccessibilityIssue

Type.

```text
interface AccessibilityIssue {
  code: AccessibilityCode;
  severity: 'error' | 'warning';
  message: string;
  pageIndex?: number;
  /** For `figure-without-alt`: the id to pass to `setAlternateText`. */
  figureId?: string;
}
```

### AccessibilityReport

Type.

```text
interface AccessibilityReport {
  isTagged: boolean;
  title?: string;
  language?: string;
  figures: PdfFigure[];
  issues: AccessibilityIssue[];
  /** True when no issue of severity `error` was found. It is a pre-flight check, not a statement of conformance. */
  passes: boolean;
}
```

### analyzeLayout

Value, from `@birchui/pdf/engine`.

```text
function analyzeLayout(source: OfficeExportSource, options?: OfficeExportOptions): OfficeBlock[];
```

### ArchiveFinding

Type.

```text
interface ArchiveFinding {
  rule: ArchiveRule;
  severity: ArchiveSeverity;
  message: string;
  pageIndex?: number;
}
```

### ArchiveFontUsage

Type.

```text
interface ArchiveFontUsage {
  name: string;
  isEmbedded: boolean;
  pages: number[];
}
```

### ArchiveReport

Type.

```text
interface ArchiveReport {
  isLikelyConformant: boolean;
  declared?: { part: number; conformance?: string };
  findings: ArchiveFinding[];
  fonts: ArchiveFontUsage[];
}
```

### ArchiveRule

Type.

```text
type ArchiveRule =
  | 'encryption'
  | 'fonts'
  | 'metadata'
  | 'output-intent'
  | 'javascript'
  | 'launch-action'
  | 'embedded-files'
  | 'transparency'
  | 'lzw'
  | 'file-id';
```

### ArchiveSeverity

Type.

```text
type ArchiveSeverity = 'error' | 'warning' | 'info';
```

### AttachmentInput

Type.

```text
type AttachmentInput = FileSpecInput;
```

### BackgroundOptions

Type.

```text
interface BackgroundOptions {
  color?: string;
  image?: Uint8Array;
  opacity?: number;
}
```

### BatesOptions

Type.

```text
interface BatesOptions {
  prefix?: string;
  suffix?: string;
  start?: number;
  digits?: number;
  position?: StampPosition;
  fontSize?: number;
  color?: string;
  font?: StandardFont;
  margin?: number;
  fonts?: FontRegistry;
}
```

### BlankScanOptions

Type.

```text
interface BlankScanOptions {
  /** Lightness from 0 to 255 at or above which a pixel counts as paper. */
  whiteLevel?: number;
  /** Share of pixels that may be darker than paper, for dust and scanner noise. */
  tolerance?: number;
  /** Share of each edge that is left out, where scanners leave shadows. */
  border?: number;
}
```

### blocksText

Value, from `@birchui/pdf/engine`.

```text
function blocksText(blocks: readonly OfficeBlock[]): string;
```

### blocksToDocx

Value, from `@birchui/pdf/engine`.

```text
function blocksToDocx(blocks: readonly OfficeBlock[], options?: { title?: string; }): PdfBytes;
```

### bookletOrder

Value, from `@birchui/pdf/engine`.

```text
function bookletOrder(pageCount: number, isRightToLeft?: boolean): number[][];
```

### buildSrgbProfile

Value, from `@birchui/pdf/engine`.

```text
function buildSrgbProfile(): Uint8Array;
```

### canonicalFontName

Value, from `@birchui/pdf/engine`.

```text
function canonicalFontName(baseFont: string): string;
```

### checkArchiveReadiness

Value, from `@birchui/pdf/engine`.

```text
function checkArchiveReadiness(input: Uint8Array | ArrayBuffer | ArchiveSource): ArchiveReport;
```

### convertToPdfA

Value, from `@birchui/pdf/engine`.

```text
function convertToPdfA(data: Uint8Array | ArrayBuffer, options?: PdfAConversionOptions): Promise<PdfAConversionResult>;
```

### createZip

Value, from `@birchui/pdf/engine`.

```text
function createZip(entries: readonly ZipEntry[]): PdfBytes;
```

### CropPagesOptions

Type.

```text
interface CropPagesOptions {
  removeContent?: boolean;
}
```

### DownsampleReport

Type.

```text
interface DownsampleReport {
  imagesDownsampled: number;
  imagesKept: number;
}
```

### embedMissingFonts

Value, from `@birchui/pdf/engine`.

```text
function embedMissingFonts(editor: PdfEditor, fonts?: Readonly<Record<string, Uint8Array>>): PdfAFontReplacement[];
```

### formatBatesNumber

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function formatBatesNumber(index: number, options?: BatesOptions): string;
```

### HeaderFooterOptions

Type.

```text
interface HeaderFooterOptions {
  header?: HeaderFooterSlots;
  footer?: HeaderFooterSlots;
  margin?: number | PageMargins;
  fontSize?: number;
  color?: string;
  font?: StandardFont;
  startNumber?: number;
  totalPages?: number;
  range?: { from?: number; to?: number };
  date?: Date | string;
  fileName?: string;
  fonts?: FontRegistry;
  /** How the stamped text is marked in the page content; `header` and `footer` by default. */
  layerKind?: 'header' | 'footer' | 'pageNumbers';
}
```

### HeaderFooterSlots

Type.

```text
interface HeaderFooterSlots {
  left?: string;
  center?: string;
  right?: string;
}
```

### ImagePageInput

Type.

```text
interface ImagePageInput {
  data: Uint8Array;
  dpi?: number;
}
```

### ImagePageSize

Type.

```text
type ImagePageSize = 'image' | 'a4' | 'letter' | { width: number; height: number };
```

### imagesToPdf

Value, from `@birchui/pdf/engine`.

```text
function imagesToPdf(images: readonly (Uint8Array | ImagePageInput)[], options?: ImagesToPdfOptions): Promise<PdfBytes>;
```

### ImagesToPdfOptions

Type.

```text
interface ImagesToPdfOptions {
  pageSize?: ImagePageSize;
  margin?: number;
  fit?: 'contain' | 'cover' | 'none';
  dpi?: number;
  metadata?: { title?: string; author?: string; subject?: string; keywords?: string; creator?: string };
  decodeImage?: ImageDecoder;
}
```

### ImposeOptions

Type.

```text
interface ImposeOptions {
  layout: 'n-up' | 'booklet';
  columns?: number;
  rows?: number;
  sheetSize?: { width: number; height: number };
  margin?: number;
  gutter?: number;
  rightToLeft?: boolean;
  password?: string;
}
```

### imposePdf

Value, from `@birchui/pdf/engine`.

```text
function imposePdf(data: Uint8Array | ArrayBuffer, options: ImposeOptions): Promise<PdfBytes>;
```

### LinearizeOptions

Type.

```text
interface LinearizeOptions {
  recompress?: boolean;
}
```

### linearizePdf

Value, from `@birchui/pdf/engine`.

```text
function linearizePdf(data: Uint8Array | ArrayBuffer, options?: LinearizeOptions): Promise<PdfBytes>;
```

### mergePdfs

Value, from `@birchui/pdf/engine`.

```text
function mergePdfs(inputs: readonly MergeFileInput[], options?: MergePdfsOptions): Promise<PdfBytes>;
```

### MergePdfsOptions

Type.

```text
interface MergePdfsOptions extends Omit<MergeFilesOptions, 'at'> {
  decodeImage?: ImageDecoder;
}
```

### OfficeBlock

Type.

```text
type OfficeBlock =
  | { kind: 'heading'; level: 1 | 2 | 3; runs: OfficeRun[]; pageIndex: number }
  | { kind: 'paragraph'; runs: OfficeRun[]; pageIndex: number }
  | { kind: 'list'; isOrdered: boolean; marker: string; runs: OfficeRun[]; pageIndex: number }
  | { kind: 'table'; rows: string[][]; pageIndex: number };
```

### OfficeExportOptions

Type.

```text
interface OfficeExportOptions {
  /** Pages to export, zero-based. Default: every page. */
  pages?: readonly number[];
  title?: string;
}
```

### OfficeExportSource

Type.

```text
interface OfficeExportSource {
  readonly pageCount: number;
  getStructuredText(pageIndex: number): PageTextStructure;
}
```

### OfficeRun

Type.

```text
interface OfficeRun {
  text: string;
  isBold?: boolean;
  isItalic?: boolean;
}
```

### OptimizeImageOptions

Type.

```text
interface OptimizeImageOptions {
  maxDpi: number;
  jpegQuality?: number;
}
```

### OptimizeOptions

Type.

```text
interface OptimizeOptions {
  /** False serialises every object anew, so the output has one spelling of stream and object syntax. */
  keepVerbatim?: boolean;
  objectStreams?: boolean;
  dedupe?: boolean;
  removeUnused?: boolean;
  recompress?: boolean;
  transform?: ObjectTransform;
  images?: OptimizeImageOptions;
  fonts?: boolean;
}
```

### optimizePdf

Value, from `@birchui/pdf/engine`.

```text
function optimizePdf(data: Uint8Array | ArrayBuffer, options?: OptimizeOptions): Promise<OptimizeResult>;
```

### OptimizeReport

Type.

```text
interface OptimizeReport extends Partial<DownsampleReport>, Partial<FontSubsetReport> {
  before: number;
  after: number;
  objectsBefore: number;
  objectsAfter: number;
  duplicatesMerged: number;
}
```

### OptimizeResult

Type.

```text
interface OptimizeResult {
  bytes: PdfBytes;
  report: OptimizeReport;
}
```

### OutlineItem

Type.

```text
interface OutlineItem {
  title: string;
  pageIndex?: number;
  left?: number;
  top?: number;
  zoom?: number;
  uri?: string;
  isOpen?: boolean;
  color?: string;
  isBold?: boolean;
  isItalic?: boolean;
  children?: OutlineItem[];
}
```

### PageAnchor

Type.

```text
type PageAnchor =
  | 'center'
  | 'top-left'
  | 'top-center'
  | 'top-right'
  | 'center-left'
  | 'center-right'
  | 'bottom-left'
  | 'bottom-center'
  | 'bottom-right';
```

### PageBoxes

Type.

```text
interface PageBoxes {
  media: PdfRect;
  crop: PdfRect;
  bleed: PdfRect;
  trim: PdfRect;
  art: PdfRect;
}
```

### PageBoxesPatch

Type.

```text
type PageBoxesPatch = { media?: PdfRect } & Partial<Record<Exclude<PageBoxKey, 'media'>, PdfRect | null>>;
```

### PageBoxKey

Type.

```text
type PageBoxKey = keyof PageBoxes;
```

### PageLabelRange

Type.

```text
interface PageLabelRange {
  startPage: number;
  style: PageLabelStyle;
  prefix?: string;
  start?: number;
}
```

### PageLabelStyle

Type.

```text
type PageLabelStyle = 'decimal' | 'roman-upper' | 'roman-lower' | 'alpha-upper' | 'alpha-lower' | 'none';
```

### PageLayerKind

Type.

```text
type PageLayerKind = 'watermark' | 'header' | 'footer' | 'background' | 'pageNumbers' | 'bates';
```

### PageMargins

Type.

```text
interface PageMargins {
  top?: number;
  bottom?: number;
  left?: number;
  right?: number;
}
```

### PageSelector

Type.

```text
type PageSelector = 'all' | 'odd' | 'even' | string;
```

### parsePageRanges

Value, from `@birchui/pdf/engine`.

```text
function parsePageRanges(text: string, pageCount: number): [number, number][];
```

### PdfAConversionOptions

Type.

```text
interface PdfAConversionOptions {
  keepAttachments?: boolean;
  fonts?: Readonly<Record<string, Uint8Array>>;
}
```

### PdfAConversionResult

Type.

```text
interface PdfAConversionResult {
  bytes: PdfBytes;
  isConformant: boolean;
  removed: string[];
  remaining: ArchiveFinding[];
  fonts: PdfAFontReplacement[];
  validation: PdfAValidation;
}
```

### PdfAFontReplacement

Type.

```text
interface PdfAFontReplacement {
  name: string;
  replacement: string;
  glyphs: number;
  mismatchedWidths: number;
}
```

### PdfARule

Type.

```text
type PdfARule =
  | 'header'
  | 'encryption'
  | 'file-id'
  | 'stream'
  | 'output-intent'
  | 'device-colour'
  | 'transparency'
  | 'image'
  | 'content'
  | 'xobject'
  | 'fonts'
  | 'annotations'
  | 'actions'
  | 'metadata'
  | 'forms'
  | 'embedded-files';
```

### PdfAttachment

Type.

```text
interface PdfAttachment extends FileSpecInfo {
  source: 'document' | 'annotation';
  pageIndex?: number;
}
```

### PdfAValidation

Type.

```text
interface PdfAValidation {
  profile: 'PDF/A-2b';
  validator: 'built-in';
  isValid: boolean;
  violations: PdfAViolation[];
  rulesChecked: PdfARule[];
}
```

### PdfAViolation

Type.

```text
interface PdfAViolation {
  rule: PdfARule;
  clause: string;
  severity: 'error' | 'warning';
  message: string;
  pageIndex?: number;
  object?: number;
}
```

### PdfCollection

Type.

```text
interface PdfCollection {
  view: PdfCollectionView;
  initialDocument?: string;
  fields: PdfCollectionField[];
  sort?: PdfCollectionSort[];
  items: PdfCollectionItem[];
}
```

### PdfCollectionField

Type.

```text
interface PdfCollectionField {
  key: string;
  name: string;
  type: PdfCollectionFieldType;
  order: number;
  isVisible: boolean;
}
```

### PdfCollectionFieldType

Type.

```text
type PdfCollectionFieldType =
  'text' | 'date' | 'number' | 'fileName' | 'description' | 'modified' | 'created' | 'size' | 'compressedSize';
```

### PdfCollectionItem

Type.

```text
interface PdfCollectionItem extends PdfAttachment {
  values: Record<string, PdfCollectionValue>;
}
```

### PdfCollectionSort

Type.

```text
interface PdfCollectionSort {
  key: string;
  isAscending: boolean;
}
```

### PdfCollectionValue

Type.

```text
type PdfCollectionValue = string | number | Date;
```

### PdfCollectionView

Type.

```text
type PdfCollectionView = 'details' | 'tile' | 'hidden';
```

### PdfFigure

Type.

```text
interface PdfFigure {
  /** Stable while the structure tree is not rewritten: the object number of the structure element. */
  id: string;
  pageIndex?: number;
  alternateText?: string;
  actualText?: string;
  rect?: PdfRect;
}
```

### PdfInitialPageLayout

Type.

```text
type PdfInitialPageLayout =
  'single' | 'continuous' | 'two-column' | 'two-column-cover' | 'two-page' | 'two-page-cover';
```

### PdfInitialPageMode

Type.

```text
type PdfInitialPageMode = 'none' | 'outlines' | 'thumbnails' | 'fullscreen' | 'layers' | 'attachments';
```

### PdfInitialView

Type.

```text
interface PdfInitialView {
  pageMode?: PdfInitialPageMode;
  pageLayout?: PdfInitialPageLayout;
  /** Page shown when the document opens, from 0. */
  openPage?: number;
  /** Zoom when the document opens: a factor (1 is 100%) or a fit mode. */
  zoom?: number | 'fit-page' | 'fit-width';
  /** Show the document title instead of the file name in the window title. */
  displayDocTitle?: boolean;
}
```

### PdfMetadata

Type.

```text
interface PdfMetadata {
  title?: string;
  author?: string;
  subject?: string;
  keywords?: string;
  creator?: string;
  producer?: string;
  created?: Date;
  modified?: Date;
  trapped?: boolean;
  custom: Record<string, string>;
  xmp?: string;
}
```

### PdfMetadataPatch

Type.

```text
interface PdfMetadataPatch {
  title?: string | null;
  author?: string | null;
  subject?: string | null;
  keywords?: string | null;
  creator?: string | null;
  producer?: string | null;
  created?: Date | null;
  modified?: Date | null;
  trapped?: boolean | null;
  custom?: Record<string, string | null>;
}
```

### SanitizeOptions

Type.

```text
interface SanitizeOptions {
  /** Document information, XMP packets and private application data. */
  metadata?: boolean;
  /** Layers that are switched off, together with the page content that belongs to them. */
  hiddenLayers?: boolean;
  /** Embedded files and file attachment annotations. */
  attachments?: boolean;
  /** JavaScript, open actions and additional actions. */
  scripts?: boolean;
  /** Every annotation except links and form fields. */
  comments?: boolean;
}
```

### sanitizePdf

Value, from `@birchui/pdf/engine`.

```text
function sanitizePdf(data: Uint8Array | ArrayBuffer, options?: SanitizeOptions): Promise<SanitizeResult>;
```

### SanitizeReport

Type.

```text
interface SanitizeReport {
  metadata: number;
  hiddenLayers: number;
  attachments: number;
  scripts: number;
  comments: number;
  before: number;
  after: number;
}
```

### SanitizeResult

Type.

```text
interface SanitizeResult {
  bytes: PdfBytes;
  report: SanitizeReport;
}
```

### selectPages

Value, from `@birchui/pdf/engine`.

```text
function selectPages(pageCount: number, selector: PageSelector): number[];
```

### SplitNaming

Type.

```text
interface SplitNaming {
  baseName?: string;
}
```

### SplitOptions

Type.

```text
type SplitOptions =
  | { ranges: string | readonly (readonly [number, number])[] }
  | { every: number }
  | { byBookmark: { level?: number } }
  | { maxBytes: number }
  | { byBlankPages: true };
```

### SplitPart

Type.

```text
interface SplitPart {
  bytes: PdfBytes;
  pageIndexes: number[];
  name: string;
  title?: string;
}
```

### splitPdf

Value, from `@birchui/pdf/engine`.

```text
function splitPdf(data: Uint8Array | ArrayBuffer, options: SplitOptions, naming?: SplitNaming): Promise<SplitPart[]>;
```

### StampImageOptions

Type.

```text
interface StampImageOptions {
  data: Uint8Array;
  rect?: PdfRect;
  position?: StampPosition;
  width?: number;
  height?: number;
  opacity?: number;
  rotation?: number;
  layer?: 'over' | 'under';
  margin?: number;
}
```

### StampPosition

Type.

```text
type StampPosition = PageAnchor | { x: number; y: number };
```

### StampTextOptions

Type.

```text
interface StampTextOptions {
  text: string;
  position?: StampPosition;
  fontSize?: number;
  color?: string;
  opacity?: number;
  rotation?: number;
  font?: StandardFont;
  layer?: 'over' | 'under';
  margin?: number;
  fonts?: FontRegistry;
}
```

### tablesToXlsx

Value, from `@birchui/pdf/engine`.

```text
function tablesToXlsx(tables: readonly (readonly string[][])[]): PdfBytes;
```

### validatePdfA

Value, from `@birchui/pdf/engine`.

```text
function validatePdfA(input: Uint8Array | ArrayBuffer | PdfFile): PdfAValidation;
```

### ZipEntry

Type.

```text
interface ZipEntry {
  name: string;
  bytes: Uint8Array;
  modified?: Date;
}
```

### zipSplitParts

Value, from `@birchui/pdf/engine`.

```text
function zipSplitParts(parts: readonly SplitPart[]): PdfBytes;
```

## Email messages

### convertMailFile

Value, from `@birchui/pdf/engine`.

```text
function convertMailFile(bytes: Uint8Array, hint?: MailFileHint, options?: MailToPdfOptions): Promise<MailConversion>;
```

### DecodedImage

Type.

```text
interface DecodedImage {
  width: number;
  height: number;
  data: Uint8Array | Uint8ClampedArray;
}
```

### decodeImageFile

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function decodeImageFile(bytes: Uint8Array, options?: PrepareImageOptions): Promise<DecodedImage>;
```

### decompressRtf

Value, from `@birchui/pdf/engine`.

```text
function decompressRtf(data: Uint8Array, options?: DecompressRtfOptions): Uint8Array;
```

### DecompressRtfOptions

Type.

```text
interface DecompressRtfOptions {
  verifyCrc?: boolean;
}
```

### detectImageFormat

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function detectImageFormat(bytes: Uint8Array): ImageFileFormat | undefined;
```

### detectMailFormat

Value, from `@birchui/pdf/engine`.

```text
function detectMailFormat(bytes: Uint8Array, hint?: MailFileHint): MailFormat | undefined;
```

### ImageDecoder

Type.

```text
type ImageDecoder = (
  bytes: Uint8Array,
  mimeType: string,
) => DecodedImage | undefined | Promise<DecodedImage | undefined>;
```

### ImageDecoderRequiredError

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
class ImageDecoderRequiredError extends ImageFormatError {
  constructor(readonly mimeType: string);
}
```

### ImageFileFormat

Type.

```text
type ImageFileFormat = 'png' | 'jpeg' | 'gif' | 'bmp' | 'tiff' | 'webp' | 'svg';
```

### imageMimeType

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function imageMimeType(format: ImageFileFormat): string;
```

### MailAddress

Type.

```text
interface MailAddress {
  name: string;
  address: string;
}
```

### MailAttachment

Type.

```text
interface MailAttachment {
  fileName: string;
  mimeType: string;
  data: Uint8Array;
  contentId?: string;
  isInline: boolean;
  embeddedMessage?: MailMessage;
}
```

### MailConversion

Type.

```text
interface MailConversion extends MailPdfResult {
  format: MailFormat;
  message: MailMessage;
}
```

### MailFileHint

Type.

```text
interface MailFileHint {
  fileName?: string;
  mimeType?: string;
}
```

### MailFormat

Type.

```text
type MailFormat = 'msg' | 'eml';
```

### MailFormatError

Value, from `@birchui/pdf/engine`.

```text
class MailFormatError extends Error {
  constructor(message: string);
}
```

### MailHeader

Type.

```text
interface MailHeader {
  name: string;
  value: string;
}
```

### MailMessage

Type.

```text
interface MailMessage {
  format: MailFormat;
  subject: string;
  from?: MailAddress;
  to: MailAddress[];
  cc: MailAddress[];
  bcc: MailAddress[];
  sentAt?: Date;
  text: string;
  html: string;
  headers: MailHeader[];
  attachments: MailAttachment[];
}
```

### MailOriginalFile

Type.

```text
interface MailOriginalFile {
  data: Uint8Array;
  fileName?: string;
}
```

### MailPageSize

Type.

```text
type MailPageSize = 'a4' | 'letter' | { width: number; height: number };
```

### MailPdfLabels

Type.

```text
interface MailPdfLabels {
  subject: string;
  from: string;
  to: string;
  cc: string;
  bcc: string;
  sent: string;
  attachments: string;
  noSubject: string;
  image: string;
}
```

### MailPdfResult

Type.

```text
interface MailPdfResult {
  bytes: PdfBytes;
  pageCount: number;
  substitutedCharacters: number;
  attachmentNames: string[];
  warnings: MailPdfWarning[];
}
```

### MailPdfWarning

Type.

```text
interface MailPdfWarning {
  code: MailPdfWarningCode;
  message: string;
  count: number;
}
```

### MailPdfWarningCode

Type.

```text
type MailPdfWarningCode =
  | 'substituted-characters'
  | 'remote-image'
  | 'missing-image'
  | 'unsupported-image'
  | 'unsafe-link'
  | 'embedded-message-converted';
```

### mailToPdf

Value, from `@birchui/pdf/engine`.

```text
function mailToPdf(message: MailMessage, options?: MailToPdfOptions): Promise<MailPdfResult>;
```

### MailToPdfOptions

Type.

```text
interface MailToPdfOptions {
  pageSize?: MailPageSize;
  margin?: number | PageMargins;
  fontSize?: number;
  fonts?: FontRegistry | readonly PdfFontSource[];
  fontFallback?: PdfFontFallback;
  allowMissingGlyphs?: boolean;
  includeAttachments?: boolean;
  attachOriginal?: Uint8Array | MailOriginalFile;
  preferPlainText?: boolean;
  labels?: Partial<MailPdfLabels>;
  formatDate?: (date: Date) => string;
}
```

### parseEml

Value, from `@birchui/pdf/engine`.

```text
function parseEml(bytes: Uint8Array | ArrayBuffer): MailMessage;
```

### parseMail

Value, from `@birchui/pdf/engine`.

```text
function parseMail(bytes: Uint8Array, hint?: MailFileHint): MailMessage;
```

### parseMsg

Value, from `@birchui/pdf/engine`.

```text
function parseMsg(bytes: Uint8Array | ArrayBuffer): MailMessage;
```

### prepareImage

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function prepareImage(bytes: Uint8Array, options?: PrepareImageOptions): Promise<AnnotationImage>;
```

### PrepareImageOptions

Type.

```text
interface PrepareImageOptions {
  decodeImage?: ImageDecoder;
  mimeType?: string;
}
```

### rtfToHtml

Value, from `@birchui/pdf/engine`.

```text
function rtfToHtml(rtf: Uint8Array | string): string;
```

### rtfToText

Value, from `@birchui/pdf/engine`.

```text
function rtfToText(rtf: Uint8Array | string): string;
```

## Fonts

### createFontRegistry

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function createFontRegistry(fonts?: readonly PdfFontSource[]): FontRegistry;
```

### EmbeddedText

Type.

```text
interface EmbeddedText {
  ref: PdfRef;
  fontName: string;
  encoded: Uint8Array;
  width: number;
  ascent: number;
  descent: number;
  isRtl: boolean;
  placements?: (GlyphPlacement | undefined)[];
}
```

### FontFormatError

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
class FontFormatError extends Error {
  constructor(message: string);
}
```

### FontRegistry

Type.

```text
interface FontRegistry {
  readonly isEmpty: boolean;
  readonly fontNames: readonly string[];
  add(source: PdfFontSource): boolean;
  hasGlyph(code: number): boolean;
  covers(text: string): boolean;
  needsEmbedding(text: string): boolean;
  embed(editor: PdfEditor | FontSink, text: string, preferredName?: string): EmbeddedText[];
  measure(text: string, preferredName?: string): number;
}
```

### MissingGlyphReport

Type.

```text
interface MissingGlyphReport {
  characters: string;
  scripts: TextScript[];
}
```

### PdfFontFallback

Type.

```text
type PdfFontFallback = (
  script: TextScript,
  characters: string,
) => Uint8Array | PdfFontSource | undefined | Promise<Uint8Array | PdfFontSource | undefined>;
```

### PdfFontSource

Type.

```text
interface PdfFontSource {
  name: string;
  data: Uint8Array;
}
```

### PdfMissingGlyphError

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
class PdfMissingGlyphError extends Error {
  readonly characters: string;
  readonly scripts: TextScript[];
  constructor(report: MissingGlyphReport);
}
```

### PdfTextRasterizer

Type.

```text
interface PdfTextRasterizer {
  /** Advance width of the text in points. */
  measure(text: string, style: RasterTextStyle): number;
  rasterize(text: string, style: RasterTextStyle): RasterizedText | undefined;
}
```

### RasterizedText

Type.

```text
interface RasterizedText {
  /** Bitmap size in pixels. */
  width: number;
  height: number;
  /** One byte of ink coverage per pixel, rows from the top. */
  coverage: Uint8Array;
  /** Pixels per point. */
  scale: number;
  /** Pixels from the left edge of the bitmap to the text origin. */
  originX: number;
  /** Pixels from the top edge of the bitmap to the baseline. */
  baseline: number;
}
```

### RasterTextStyle

Type.

```text
interface RasterTextStyle {
  fontSize: number;
}
```

## Files and errors

### ATTACHMENT_RELATIONSHIPS

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
const ATTACHMENT_RELATIONSHIPS: readonly AttachmentRelationship[];
```

### AttachmentRelationship

Type.

```text
type AttachmentRelationship =
  'Source' | 'Data' | 'Alternative' | 'Supplement' | 'EncryptedPayload' | 'FormData' | 'Schema' | 'Unspecified';
```

### decodeJpeg

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function decodeJpeg(bytes: Uint8Array, options?: JpegDecodeOptions): JpegImage;
```

### getDefaultPdfLimits

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function getDefaultPdfLimits(): PdfLimits;
```

### InflateError

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
class InflateError extends Error {
  constructor(message: string);
}
```

### JpegDecodeOptions

Type.

```text
interface JpegDecodeOptions {
  colorTransform?: boolean;
  maxPixels?: number;
}
```

### JpegError

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
class JpegError extends Error {
  constructor(message: string);
}
```

### JpegImage

Type.

```text
interface JpegImage {
  width: number;
  height: number;
  components: 1 | 3 | 4;
  data: Uint8Array;
  isProgressive: boolean;
  hasAdobeMarker: boolean;
  colorTransform: boolean;
  planes: JpegPlane[];
}
```

### mimeTypeForFileName

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function mimeTypeForFileName(fileName: string): string;
```

### PdfBytes

Type.

```text
type PdfBytes = Uint8Array<ArrayBuffer>;
```

### PdfLimitError

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
class PdfLimitError extends Error {
  constructor( readonly limit: PdfLimitName, readonly allowed: number, message: string, );
}
```

### PdfLimitName

Type.

```text
type PdfLimitName = keyof PdfLimits;
```

### PdfLimits

Type.

```text
interface PdfLimits {
  maxStreamBytes: number;
  maxExpansionRatio: number;
  maxTotalDecodedBytes: number;
  maxFilterChain: number;
  maxImagePixels: number;
  maxNestingDepth: number;
  maxTreeDepth: number;
  maxGraphicsStateDepth: number;
  maxContentOperations: number;
  maxPageContentBytes: number;
}
```

### pdfStyles

Value, from `@birchui/pdf`.

```text
const pdfStyles: "\n.lq-pdf {\n  --lq-pdf-font-family: var(--lq-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif);\n  --lq-pdf-font-size: var(--lq-font-size, 13px);\n  --lq-pdf-fg: var(--lq-fg, #1f2328);\n  --lq-pdf-bg: var(--lq-bg, #ffffff);\n  --lq-pdf-muted: var(--lq-muted-fg, #59...;
```

### PdfSyntaxError

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
class PdfSyntaxError extends Error {
  constructor( message: string, readonly offset: number, );
}
```

### PdfWriteError

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
class PdfWriteError extends Error {
  constructor(message: string);
}
```

### setDefaultPdfLimits

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function setDefaultPdfLimits(limits?: Partial<PdfLimits>): PdfLimits;
```

### toPdfBytes

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
function toPdfBytes(bytes: Uint8Array): PdfBytes;
```

### UnsupportedFilterError

Value, from `@birchui/pdf` and `@birchui/pdf/engine`.

```text
class UnsupportedFilterError extends Error {
  constructor(readonly filter: string);
}
```
