Converting an EU regulation (Spanish edition) to EPUB
Updated:
An EU regulation in the Official Journal converts well for running text: on the 144-page Spanish edition of the AI Act the EpubCC engine removed every running header, built one chapter per article from the PDF outline and reached a 4-gram precision of 0.982. Some numbered points are detached from their text, and other engines recover slightly more continuous text.
Original and result
A long legal act in Spanish: recitals numbered (1) to (180), articles with numbered paragraphs and lettered points, a running header with the Official Journal reference on every page, and annexes.


Download source PDF Download the sample EPUB
Where the result is good
Every page repeats the language code, the Official Journal reference and the page number. The engine detects them by comparing pages and removes all of them (margin leak 0.000 against 0.753 for pdf_oxide extract_text and 1.000 for PDFium).
The PDF outline lists every article, so each article becomes a chapter with its own title («Definiciones», «Prácticas de IA prohibidas»…), and the reader's table of contents can jump to any of them. The language is detected as es.
Where it is not
Legal texts set their paragraph numbers in a hanging indent. When two or more consecutive numbers sit in that indent, the engine can read them as a separate column and write the numbers apart from their text. The words are all there; the pairing is lost. The same happens in UK Acts, which is why we have not published a UK case yet.
Source and licence
- Document
- Regulation (EU) 2024/1689, Artificial Intelligence Act (Official Journal, Spanish edition)
- Licence
- Reuse authorised, including commercial (Decision 2011/833/EU; EUR-Lex legal notice), © European Union
- Pages
- 144
- Traits
- text PDF, one column, repeated headers, chapters, Spanish, legal text
Regulation (EU) 2024/1689 (Artificial Intelligence Act), Spanish edition, Official Journal of the European Union, L series, 12 July 2024, ELI http://data.europa.eu/eli/reg/2024/1689/oj. © European Union, https://eur-lex.europa.eu, 1998-2026. Reused under Decision 2011/833/EU; only the Official Journal edition is authentic. The EPUB is our conversion.
Settings used
- Engine: EpubCC engine at commit 3b74b26, the binary that generated the images and the sample (2026-11-04).
- Pages: the whole document for the figures; pages 46–47 for the images and the sample EPUB.
- Benchmark figures: a run of 2026-11-04 with the same binary, every engine on the whole document; this document is not yet part of the published benchmark.
- Options: none. The engine has no per-document settings yet; the same defaults apply to every file.
Validation and results
EPUBCheck EPUBCheck on our EPUB: 0 errors, 0 warnings.
EPUBCheck 5.4.0 on the downloadable sample: 0 errors, 0 warnings (checked 2026-11-04).
- Pages
- 144
- Time
- 0.53 s
- Peak memory
- 27 MB
- Language detected
- es
- Chapters
- 125, one per article, from the PDF outline
- Running headers removed
- 401
- 4-gram precision
- 0.982 (pdf_oxide 0.965, OpenDataLoader 0.994)
- Quality warnings
- none
Benchmark run of 2026-11-04, not yet part of the published benchmark.
| Engine | 8-gram recall |
|---|---|
| EpubCC engine (EPUB output) | 0.974 |
| EpubCC engine (plain text) | 0.969 |
| pdf_oxide · extract_text | 0.988 |
| pdf_oxide · to_plain_text (XY-cut) | 0.988 |
| pdf_oxide · Markdown | 0.988 |
| PDFium · text().all() | 0.989 |
| OpenDataLoader PDF (local mode) | 0.996 |
| pdftotext (Poppler) | 0.986 |
Limitations we observed
- Numbered points can come loose from their text: in the definitions, «2)», «3)» and «4)» became paragraphs of their own, followed by the three definitions; in the recitals, «(156)» and «(157)» did too. The hanging numbers are read as a narrow column.
- The book title is the PDF's metadata title, which is the full official title (about 400 characters) with «Texto pertinente a efectos del EEE» glued to it.
- One chapter per article gives 125 chapters; the table of contents is long but follows the PDF outline.
- PDFium (0.989), pdf_oxide (0.988) and OpenDataLoader (0.996) have a higher 8-gram recall than our engine (0.974) on this document.