Datasets:
File size: 2,944 Bytes
2fb1450 1176402 2fb1450 1176402 2fb1450 1176402 2fb1450 1176402 2fb1450 1176402 2fb1450 1176402 2fb1450 1176402 2fb1450 1176402 7079631 2fb1450 1176402 2fb1450 1176402 2fb1450 1176402 2fb1450 1176402 2fb1450 41c8350 2fb1450 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | ---
license: mit
task_categories:
- tabular-classification
tags:
- pdf
- pdf-repair
- test-corpus
- synthetic
pretty_name: PDF Corruption Lab
size_categories:
- 1K<n<10K
configs:
- config_name: features
data_files: features/train.csv
default: true
---
# pdf-corruption-lab
A **fully synthetic** corpus of damaged PDF files with a known kind and severity
of damage, the scripts that generate it, and a ready-to-use feature table.
It is meant for testing and benchmarking PDF repair / recovery tools and for
training small damage-type classifiers.
Everything here is original: documents are built from scratch with
[`pdf-lib`](https://github.com/Hopding/pdf-lib) (MIT). No third-party
documents or models are included.
## What is in this repository
| Path | Description |
|---|---|
| `output/` | 7 hand-checkable reference files: one valid PDF and 6 damaged variants, plus `manifest.json` |
| `training/` | 1,200 randomized PDFs (200 per class: pages, fonts, text and images vary) and `labels.csv` |
| `features/train.csv` | 12 byte-level structural features + label for each training file (powers the dataset viewer) |
| `generate.js` | regenerates the reference files in `output/` |
| `gen_training.js` | regenerates the randomized training set (seeded, reproducible) |
## Damage classes
| Class | Damage | Severity (1-5) |
|---|---|---|
| `valid` | none | 0 |
| `missing_eof` | trailing `%%EOF` removed | 1 |
| `invalid_startxref` | `startxref` value is non-numeric | 2 |
| `scrambled_xref` | xref offsets replaced with bogus values | 3 |
| `bad_root_reference` | trailer `/Root` points to a missing object | 3 |
| `truncated` | file cut at a random point (30-90 % of its length) | 4-5 |
## Features (`features/train.csv`)
`has_pdf_header`, `eof_in_last_1k`, `ends_with_eof`, `startxref_present`,
`startxref_numeric`, `startxref_points_to_xref`, `xref_valid_fraction`,
`has_trailer`, `root_object_exists`, `obj_endobj_gap`, `stream_endstream_gap`,
`log10_size`, and `label`. The extraction code is in the model repo:
[`utilvo-com/pdf-damage-classifier`](https://huggingface.co/utilvo-com/pdf-damage-classifier).
## Regenerate
```bash
npm install
node generate.js ./output
node gen_training.js ./training 200
```
## Suggested evaluation for repair tools
For each damaged file, run your tool and record:
1. Does the output open in a strict parser?
2. How many pages were recovered?
3. Was the embedded image preserved (where present)?
## Limitations
All files are generated by `pdf-lib` with classic xref tables (no object streams
or xref streams) and each file has a single kind of damage. Real-world
corruption (bit flips, mixed damage, files from other producers, encryption) is
not represented. Treat results here as a controlled benchmark, not as a
guarantee for real files.
## Disclosure
Maintained by the Utilvo team. The organization profile links to our website.
## License
MIT. See `LICENSE`.
|