Docs menu

API referenceStandards and warnings

Standards and warnings

Every PDF made from Markdown is accessible by default. Ask for an archival one, and read which standards and which language the file has.

Every PDF made from Markdown is accessible by default: a tagged PDF 2.0 file with its title and its document language, which claims PDF/UA-2 when the document meets it. Send accessible: false for an untagged file: in features, as ?accessible=false with a text/markdown body, or in the front matter. A value the request sends wins over the front matter. A PDF made from a template is not tagged. You state what else the file is for in features. The converter writes every standard the document can meet, and the answer tells which standards the file meets, why one was left out and which language the file has. A render does not fail for a standard unless you send standards: "strict".

POST /v1/render
{ "markdown": "---\ntitle: Annual report\n---\n# Annual report", "language": "en-GB",
  "features": { "archive": true } }

Intents#

accessible is on unless you send false; the other intents are off unless you send true. The MCP server takes the same keys, and archive, accessible and mathml also work in the document's front matter.

FeatureEffect
accessibleOn unless set to false. Tags, the title in the metadata and the document language. The PDF claims PDF/UA-2 when the document meets it. accessible: false writes an untagged file.
archive: trueArchive rules: no Info dictionary, an output intent, every font and file embedded. The PDF claims PDF/A-4, or PDF/A-4f when it carries attached files.
mathml: trueOne MathML file for each formula. This turns tagging on even with accessible: false, because the files are attached to the formula tags. An accessible PDF gets the files by itself when the document has formulas, because PDF/UA-2 requires MathML for formulas.
embed_source: trueThe Markdown source as an attached file.
standards: "strict"For archive pipelines: refuse the render with 422 when the PDF cannot meet a requested standard. The default is "best_effort".

You do not name PDF/A-4 or PDF/A-4f: the converter selects the level from the content. PDF/A-1, PDF/A-2, PDF/A-3 and PDF/A-4e are not available.

Document language#

An accessible PDF always records a document language. It is the request's language, else the front matter's language. Without either, the converter detects the main language of the text. When the text does not show it clearly, as with a short text, two close languages or text in several languages, the language is en. The detection runs inside the converter and sends the text nowhere, and the same document always gets the same language.

A detected language and en go into the PDF's tags only. The text is set as for a document without a language, so it is not hyphenated. To hyphenate, send language or set it in the front matter. A Markdown body sent as text/markdown takes it as the language query parameter: POST /v1/render?language=en-GB.

SourceWhere the language came from
documentThe request's language, else the front matter's language.
detectedThe main language of the text, which the converter detected.
defaulten, because the text does not show its language clearly: a short text, two close languages, or text in several languages.

What each request claims#

RequestWrittenStandards claimed
nothingPDF 2.0, tagged, with a document languagePDF/UA-2
accessible: falsePDF 2.0, untaggednone
archivetagged, archive rulesPDF/A-4 and PDF/UA-2
archive + mathml or embed_sourcethe same, with the attached files listedPDF/A-4f and PDF/UA-2
archive + accessible: falsePDF 2.0, untagged, archive rulesPDF/A-4
a document with formulastagged, MathML filesPDF/UA-2 (warning mathml_enabled); with archive, PDF/A-4f
mathml: false, formulastagged, no MathML filesnone (warning mathml_required)
mathml + accessible: falsetagged, MathML filesnone (warning tagging_enabled)
the watermarked downloada picture of each page, untaggednone (warning plan_raster when archive, accessible: true or mathml was sent)

How the answer reports it#

  • X-Legivel-Standards: the standards the file meets, such as PDF/A-4f, PDF/UA-2. Absent when the file claims none.
  • X-Legivel-Warnings: the warning codes, such as mathml_enabled, alt_text_missing. Absent when there is none. The codes are stable.
  • X-Legivel-Language: the tagged file's document language, such as en-GB, and X-Legivel-Language-Source: document, detected or default. Both absent when the file is not tagged.
  • The json delivery and the upload receipt carry standards, warnings and, for a tagged file, language and language_source. Each warning has a code, a message and, where the converter counts, detail.count.
  • The MCP result names the standards and the language with its source, gives each warning as a sentence, and says so in a sentence when the language was detected or is the default.

The file itself names only the standards it meets.

Warnings#

CodeWhenStandards keptWhat to do
language_missingaccessible, and the PDF has no document language. Only a converter version that does not detect the language reports it: the current one gives every accessible PDF a language.PDF/A; not PDF/UA-2Send language, or set language in the front matter.
title_missingaccessible, and the PDF has no title. Every PDF gets one: without a front matter title it takes the first level-1 heading, then the file name, else legivel.com document and the render time.PDF/A; not PDF/UA-2Set title in the front matter.
mathml_requiredaccessible with mathml: false and formulas in the document.PDF/A; not PDF/UA-2Remove mathml: false.
glyph_missingarchive or accessible, and no font can draw a character. The character shows as a placeholder (�, □ or ?), and copied text keeps the real character. The warning lists each such character, as U+1680. If the font has no placeholder either, the PDF leaves out the standards, and the warning names them.all; none without a placeholderRemove these characters or replace them.
unicode_invalidarchive or accessible, and text maps to U+0000, U+FEFF or U+FFFE. Control characters and a leading byte order mark are removed before this check.noneRemove these characters.
private_use_textaccessible, and the text has characters from the Unicode Private Use Area, which have no standard meaning.PDF/A; not PDF/UA-2Replace them with standard Unicode characters.
alt_text_missingaccessible, and an image has no alternative text: a Markdown image with empty alt text, an HTML img without alt, or an SVG without a title, description or text. The image is marked as decoration. An HTML img with alt="" is decoration on purpose and gives no warning.allGive each image that carries content an alternative text.
tagging_enabledmathml with accessible: false. Tagging is turned on.allNothing to do.
mathml_enabledaccessible, and the document has formulas. The MathML files are added.all; archive becomes 4fNothing to do.
plan_rasterarchive, accessible or mathml on the watermarked download, which is a picture of each page. Only a sent intent counts: accessible on by default gives no warning there, accessible: true does.noneDownload the PDF without a watermark.
engine_unsupportedarchive, accessible or mathml, and this converter version does not write standards yet.noneTry again after the next release.

Strict mode#

With standards: "strict", each warning that leaves a requested standard out refuses the render with 422 and the same code. So does glyph_missing, even when a placeholder keeps the standards. PDF/UA-2 counts as requested unless you send accessible: false: send it for a strict render that asks for PDF/A alone. A detected or default language does not refuse a render. The codes: language_missing (only from a converter version that does not detect the language), title_missing, mathml_required, glyph_missing, unicode_invalid, private_use_text, plan_raster and engine_unsupported. The error body lists every warning of the render in warnings, and the document is not counted. See Errors and quota.