Docs/PDF standards

PDF standards

Forme 0.25.0 exposes accessibility and archival claims on Document. pdfcn-vue uses Forme's document root directly, so these props pass through serialization to the renderer.

Choose a claim and PDF version

  • tagged enables a structure tree. Tagging alone does not establish PDF/UA conformance.
  • pdfUa requests PDF/UA-1 on PDF 1.7. Set a title and document language.
  • pdfa accepts 2a, 2b, 2u, 3a, 3b, and 3u on PDF 1.7.
  • pdfUa2 requests PDF/UA-2 and implies PDF 2.0. pdfa="4" and pdfa="4f" also imply PDF 2.0 and can be combined with pdfUa2. PDF/A-4 alone is an archival claim without an accessibility claim.
  • Do not combine pdfUa with pdfUa2, or PDF 1.7 claims with pdfVersion="2.0". Forme rejects incompatible claims. Every font must be embedded for PDF 2.0 output.

StandardsDocument.vue

<script setup lang="ts">
  import type { FontRegistration, FormeDocument } from '@formepdf/vue';
  import { Document, H1, Page, Text } from '@formepdf/vue';

  defineProps<{
    fonts?: FontRegistration[];
    pdfUa?: boolean;
    pdfUa2?: boolean;
    pdfa?: FormeDocument['pdfa'];
    pdfVersion?: FormeDocument['pdfVersion'];
  }>();
</script>

<template>
  <Document
    title="Standards example"
    author="Example team"
    lang="en"
    :fonts="fonts"
    :pdf-ua="pdfUa"
    :pdf-ua2="pdfUa2"
    :pdfa="pdfa"
    :pdf-version="pdfVersion"
  >
    <Page
      size="A4"
      :margin="48"
    >
      <H1>Standards example</H1>
      <Text>Keep the document reading order explicit.</Text>
    </Page>
  </Document>
</template>

Embed fonts and inspect warnings

Website CSS fonts are not PDF fonts. Supply embeddable font files for every family and weight used by the document. The server example below assumes you provide the named Liberation Sans files. Register them before serialization; register italic variants too if your document uses them. Choose fonts whose license permits embedding.

Server font registration and rendering

import { readFile } from 'node:fs/promises'
import { Font, renderDocumentWithLayout } from '@formepdf/vue'
import StandardsDocument from '@/components/pdf/StandardsDocument.vue'

Font.register({ family: 'Helvetica', src: new Uint8Array(await readFile('./fonts/LiberationSans-Regular.ttf')) })
Font.register({ family: 'Helvetica', fontWeight: 700, src: new Uint8Array(await readFile('./fonts/LiberationSans-Bold.ttf')) })

const result = await renderDocumentWithLayout(StandardsDocument, {
  props: { pdfUa: true, pdfa: '2a', pdfVersion: '1.7' },
})
if (result.warnings.length > 0) {
  throw new Error(`PDF_RENDER_WARNINGS: ${result.warnings.join('; ')}`)
}
const bytes = result.pdf

Forme can emit PDF/UA-1 metadata while warning that a default font is unembedded. renderDocumentWithLayout returns those warnings. A PDF header, structure tree, or XMP conformance identifier proves that a feature was emitted, not that the whole file complies.

Validate the finished document

Use semantic headings, logical reading order, meaningful link text, and appropriate table structure. Review image alternatives and form accessibility for your actual content. Decorative content must not interrupt the reading order. Inspect the generated structure and test it with assistive technology.

Run an external validator such as veraPDF against the exact profile required by your recipient. Automated validation and a manual accessibility review are separate checks. This library's render tests do not certify PDF/A or PDF/UA conformance. Consult the Forme documentation for the engine's current capabilities.

Edit the theme tokens

Try the theme builder