# PDF Redaction Regression Pack JP (version 0.1.0)

PDFs that are hard to redact properly, each with what it is a trap for and what a correct result looks like.
They are the files RedactDrop's engine is tested against before every release. For people who build or test PDF
redaction: developers, QA, security reviewers.

## What is in it

- **106 PDFs.**
  - 24 are made the way real software makes PDFs: 9 by Chrome's "Save as PDF" (Skia/PDF), 14 by pdf-lib (3 of
    them place a picture of a page, as a scan does) and 1 encrypted by hand.
  - 12 are Japanese documents of the kinds people in Japan redact: an invoice with its registration number,
    a withholding slip, a payslip, a page laid out like a residence certificate, a lease, a bank statement, a resume,
    a My Number notice, two in vertical writing, one with ruby and one in full-width digits (Chrome, Yu Gothic and
    Yu Mincho).
  - 70 are hand-built to reproduce one trap each. Most of them came out of adversarial reviews of the engine.
- **`manifest.json`** describes every file:
  - `categories`: the traps it holds (see below)
  - `pages` and `japanese` (whether pdf.js reads Japanese text in it)
  - `terms` (the words to remove) and `keep` (text that must still be there afterwards)
  - `expected`: what RedactDrop's engine does with it today. That is `written` or `refused` (with the reasons),
    the number of matches, and, per page, the black boxes it paints.
- **`expected/<file>.json`** holds the same per-file data (full pack only).

Boxes are `[x0, y0, x1, y1]` in PDF user space: points, with the origin at the bottom left (ISO 32000-1, 8.3.2.3).
A refusal is an expected result too: the engine does not write a page it cannot redact and check as it should.

| Category | What it tests |
|---|---|
| `hidden-text` | Text a reader does not see: ActualText, marked content, structure tree, unused objects |
| `metadata-and-revisions` | Document information, XMP, earlier revisions, object streams, encryption |
| `fonts-and-encoding` | Type 3, Differences, CID fonts, no ToUnicode, PDFDocEncoding, surrogate pairs |
| `text-layout` | Split and kerned TJ, rotation, vertical writing, columns, tables, spacing |
| `resources-and-xobjects` | Inherited, shared and nested resources and Form XObjects, name collisions |
| `annotations-forms-attachments` | Annotations, form fields, attachments, links, bookmarks, actions |
| `images-and-filters` | Inline images, data after a JPEG's end, predictors, filter chains, scans |
| `syntax-edge-cases` | Invalid strings and names, duplicate keys, unknown operators |
| `over-redaction-controls` | The word is not there, and nothing may be damaged |
| `scale` | Many pages |
| `japanese-documents` | Japanese text and documents: invoices, payroll, resident records, leases, vertical writing, ruby, full-width digits |

## Samples

Three files and their expected results are free to download:

- `c02-report-ja-2col.pdf`: Japanese, two columns, a table, header and footer (Chrome)
- `p10-metadata-structure.pdf`: the words in Info, XMP, the structure tree and ActualText (pdf-lib)
- `r1-inherited-resources.pdf`: a word in a Form XObject that inherits its page's resources, drawn in split TJ (hand-built)

## People and data

Every name, address, number and code word in these files is made up. The card numbers are well-known test numbers
and the e-mail addresses use `example.com`. In the Japanese documents every address is on “0 丁目”, which no town has, the invoice registration number has a check digit that does not match, and the My Number is a test number. No file was ever a real document. Each one is made by a script, and before
it is packed each file is searched for anything that would identify a person or a machine.

## Licence (provisional)

For evaluation only: use these files to test your own PDF redaction software. Do not resell or redistribute them.
Final terms will be set before the full pack is offered.

## Contact

hello@tekiba.app

---

# PDF 黒塗り回帰パック JP（版 0.1.0）

きちんと黒塗りするのが難しい PDF を集め、それぞれに「何の落とし穴か」と「正しい結果はどうなるか」を付けたものです。
RedactDrop のエンジンを公開のたびに試しているファイルそのものです。PDF の黒塗りを作る人・試す人（開発者・QA・
セキュリティの確認をする人）向けです。

## 中身

- **PDF 106 本。**
  - 24 本は実際のソフトと同じ作り方のもの（Chrome の「PDF に保存」〔Skia/PDF〕で 9 本、pdf-lib で 14 本〔うち 3 本は
    スキャンのようにページの画像を置いたもの〕、手で暗号化した 1 本）
  - 12 本は日本で黒塗りされることの多い書類（登録番号つきの請求書、源泉徴収票、給与明細、住民票の写し風、
    賃貸借契約書、銀行の取引明細、履歴書、個人番号のお知らせ、縦書き 2 本、ルビ付き、全角数字。Chrome と游ゴシック・游明朝）
  - 70 本は落とし穴を 1 つずつ再現するよう手で組んだもの（多くはエンジンへの厳しいレビューで見つかったもの）
- **`manifest.json`** に各ファイルの次の情報があります。
  - `categories`：落とし穴の分類（下の表）
  - `pages`・`japanese`：ページ数と、pdf.js が日本語の文字を読むかどうか
  - `terms`：消す語句
  - `keep`：消した後も残っているべき文
  - `expected`：RedactDrop のエンジンのいまの結果。`written`（書き出す）か `refused`（理由つきで書き出さない）、
    一致の数、ページごとの黒い矩形
- **`expected/<file>.json`**：同じものをファイルごとに（全体版のみ）。

矩形は PDF のユーザー空間の `[x0, y0, x1, y1]` です（ポイント単位、原点は左下。ISO 32000-1 の 8.3.2.3）。
書き出さないことも期待される結果です。エンジンは、正しく黒塗りして確かめられないページを書き出しません。

分類は上の表のとおりです（見えない文字、文書情報と以前の版、フォントと文字コード、文字の並べ方、リソースと
フォーム XObject、注釈・フォーム・添付、画像とフィルター、構文の境目、消しすぎないことの対照、ページ数、日本語の文字と書類）。

## サンプル

3 本とその期待結果は無料でダウンロードできます（上の「Samples」と同じファイルです）。

## 人とデータ

ファイルの中の名前・住所・番号・合言葉はすべて架空です。カード番号はよく知られた試験用の番号、メールアドレスは
`example.com` です。日本の書類の住所はどれも、どの町にも無い「0 丁目」です。請求書の登録番号は検査用数字が合わない番号、個人番号は試験用の番号です。実在の文書を元にしたファイルはありません。どのファイルもスクリプトで作り、パックに入れる前に、
人や機械を特定できるものが入っていないかを検索しています。

## 利用条件（仮）

評価目的に限ります。ご自分の PDF 黒塗りソフトを試すために使ってください。再販売・再配布はできません。
全体版を出す前に正式な条件を決めます。

## 連絡先

hello@tekiba.app
