# PDF forms -> cloccojs forms

`scan.html` (open it in a browser through the playground, the PDFs next to it) reads the AcroForm widgets and the text of PDF forms with pdf.js and posts `scan.json`.
`convert.mjs` turns that scan into form designs (`data/formdesigns/*.json`):

* sections come from the headings of the PDF (numbered headings, "Wichtige Daten", "Angaben zu ... :"), paired headings of two-column pages (A / B) become two groups;
* labels come from the field tooltip, otherwise from the text left of / below / above the field;
* check boxes ja / nein (in a row or one below the other) become one radio item, tiny text widgets that are really check boxes are detected;
* every PDF page becomes a wizard page (`step`), a last page takes the upload pane and the confirmation;
* PDFs without text (outlined, like the Sachschadenanzeige) or without fields (scanned, like the Safefach application) are described by hand in `convert.mjs` (the latter with a repeating table);
* the original PDFs are copied to `data/docs/Forms/_Vorlagen` and are linked as "Original PDF" in the Forms view.

The result is a first draft: review the groups, labels and field order in the form designer.
Run: `node convert.mjs`.
