Files
visa/forms/README.md
T
grabowski a2cedcdd7e
CI / secret scan (push) Successful in 5s
CI / fmt, clippy, tests (push) Successful in 39s
Phase 5: the Immigration Bureau's forms, filled in from the records
A Forms tab on each person fills in TM.7, STM.2, STM.9, STM.11 and STM.1
for an extension of stay, TM.47 for a 90-day report and TM.8 for a re-entry
permit. The Bureau's blank pages (forms/, with their sources and checksums)
go unchanged into a new PDF, and the values are written on the dotted lines
in Sarabun; boxes are ticked and the title circled where a form asks.
scripts/gen_layout.py measures the blanks into src/papers/layout.rs.

The tab says what would stay blank and links to where it is added. What only
the application says (the date, the office, the reason, the days, a trip) is
carried in the links and never stored. The extension's five forms also come
in one PDF. Opening or downloading a form is audited as entity "form" with
the forms' codes, never their values.

Migration 0005 adds what STM.1 and STM.11 ask of the company (capital,
revenue, equity, staff, a coordinator), a work permit's salary and contract
dates, and where an arrival came from. The Nix package now takes forms/.
2026-11-18 12:30:03 +07:00

48 lines
4.0 KiB
Markdown

# The blank forms
The Immigration Bureau's forms that the app fills in (`src/papers`), kept
unchanged as the Bureau publishes them. The app lays each page into a new PDF
and writes the values on its dotted lines, so a filled-in form looks like one
filled in by hand, only legible.
They come from the downloads of Immigration Division 1 at
https://bangkok.immigration.go.th/en/downloads_en/, fetched on November 18,
2026. The STM forms are the versions of 2025. The forms are the Bureau's own,
for every immigration office; Chiang Mai Immigration's website offers no
downloads of its own.
| Form | File | What it is | SHA-256 |
| ---- | ---- | ---------- | ------- |
| [TM.7](https://bangkok.immigration.go.th/wp-content/uploads/2021/06/14%E0%B8%84%E0%B8%B3%E0%B8%82%E0%B8%AD%E0%B8%AD%E0%B8%99%E0%B8%B8%E0%B8%8D%E0%B8%B2%E0%B8%95%E0%B9%80%E0%B8%9E%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B8%AD%E0%B8%A2%E0%B8%B9%E0%B9%88%E0%B9%83%E0%B8%99%E0%B8%A3%E0%B8%B2%E0%B8%8A%E0%B8%AD%E0%B8%B2%E0%B8%93%E0%B8%B2%E0%B8%88%E0%B8%B1%E0%B8%81%E0%B8%A3%E0%B9%80%E0%B8%9B%E0%B9%87%E0%B8%99%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%8A%E0%B8%B1%E0%B9%88%E0%B8%A7%E0%B8%84%E0%B8%A3%E0%B8%B2%E0%B8%A7%E0%B8%95%E0%B9%88%E0%B8%AD%E0%B9%84%E0%B8%9B-%E0%B8%95%E0%B8%A1.7.pdf) | `tm7.pdf` | Application for extension of temporary stay | `93bcd4b4fda4a9e88329e313112a6bd6d17a8f604f16392734f72a647fc8b62d` |
| [STM.2](https://bangkok.immigration.go.th/wp-content/uploads/STM-2-FORM-2025.pdf) | `stm2.pdf` | Acknowledgment of the conditions of a temporary stay | `0675fcd31ad6ee5ad50ca38f0ba115a82378e81faa7cab1aea22dbfb5335c35e` |
| [STM.9](https://bangkok.immigration.go.th/wp-content/uploads/STM-9-FORM-2025.pdf) | `stm9.pdf` | Acknowledgment of the penalties for overstay | `c9939371a18e4b8cd74b2a8bc88377ac39f53d9a8049dc28b832917e300eccb6` |
| [STM.11](https://bangkok.immigration.go.th/wp-content/uploads/STM-11-FORM-2025.pdf) | `stm11.pdf` | Consent to the checking of the application | `41b86da3094ec86837512f0d3b84871dd75ffed8c70fcd415a33d26704d74612` |
| [STM.1](https://bangkok.immigration.go.th/wp-content/uploads/STM-1-FORM-2025.pdf) | `stm1.pdf` | Certificate of employment, from the employer | `591484049f81d8c3c86bc118413b85521fa8935e2d00a7b85c48747e3d790cf1` |
| [TM.47](https://bangkok.immigration.go.th/wp-content/uploads/Form-TM-47.pdf) | `tm47.pdf` | Notification of staying longer than 90 days | `2208dc2aa65f82dc8e2129759d6eb2e8bf1185b271c4e02c3803a527dd5ccbac` |
| [TM.8](https://bangkok.immigration.go.th/wp-content/uploads/2021/06/15%E0%B8%84%E0%B8%B3%E0%B8%82%E0%B8%AD%E0%B8%AD%E0%B8%99%E0%B8%B8%E0%B8%8D%E0%B8%B2%E0%B8%95%E0%B9%80%E0%B8%9E%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B8%81%E0%B8%A5%E0%B8%B1%E0%B8%9A%E0%B9%80%E0%B8%82%E0%B9%89%E0%B8%B2%E0%B8%A1%E0%B8%B2%E0%B9%83%E0%B8%99%E0%B8%A3%E0%B8%B2%E0%B8%8A%E0%B8%AD%E0%B8%B2%E0%B8%93%E0%B8%B2%E0%B8%88%E0%B8%B1%E0%B8%81%E0%B8%A3%E0%B8%AD%E0%B8%B5%E0%B8%81-%E0%B8%95%E0%B8%A1.8.pdf) | `tm8.pdf` | Application for a re-entry permit | `2bcd666622f0aa99e16e4bcbac8d3eec8c06566d620e3a3d7d9799aaab41920a` |
## Where the values go
`scripts/gen_layout.py` finds the dotted lines and the boxes in these PDFs and
writes `src/papers/layout.rs`, which says where each value goes. TM.47 has no
dotted lines, so its blanks are measured from the lines drawn on it.
`scripts/form_blanks.py` lists a form's dotted lines with their labels, which
helps when a form changes:
```sh
uv run --with pymupdf python scripts/form_blanks.py forms/tm7.pdf
uv run --with pymupdf python scripts/gen_layout.py
```
`gen_layout.py` formats its output with rustfmt, so a rerun on the same forms
gives the same file. When the Bureau publishes a new version of a form,
replace the file, run `gen_layout.py` again, update the table above, and check every page of the
filled-in form against the blank before the change goes live.
## The font
The values are written in Sarabun Regular (`fonts/Sarabun-Regular.ttf`), the
font the forms themselves use, by Cadson Demak, under the SIL Open Font
License 1.1 (`fonts/OFL.txt`), from
https://github.com/google/fonts/tree/main/ofl/sarabun.