Importing PDFs
nque can import a script from a PDF and build a show automatically. The pipeline runs entirely on-device — no network access is required.
Start an import from the Welcome dialog, the empty-state screen, or
File → Import PDF. A native picker prompts for a .pdf file. While the
import runs, a progress dialog reports the current phase and page.
How the pipeline decides what to do
Not every PDF is the same. Born-digital PDFs (exported from a word processor) carry a hidden text layer; scanned PDFs are just images. nque probes the first three pages:
- If the average number of meaningful characters per probed page is at least 50, the PDF is treated as text-bearing and its native text layer is extracted directly — fast and exact.
- Otherwise, the PDF is treated as scanned and falls back to rendering each page to an image and running OCR over it.
If native extraction fails (for example, an encrypted or unusual file), the import automatically falls through to the OCR path rather than failing.
Import phases
Progress is reported per phase:
| Phase | Meaning |
|---|---|
detect | Probing the PDF for a native text layer. |
extract | Extracting text from a native-text PDF. |
render | Rendering pages to images (scanned fallback). |
ocr | Recognising text from the rendered page images. |
classify | Structuring the extracted text into a show. |
Rendering is sequential while the heavier OCR inference runs in parallel.
Rendering the document and OCR is a computationally expensive process. Larger PDFs may take a long time to process.
From text to show
The extracted text is split into lines, each line is classified (heading, stage direction, dialog, or noise), and the classified lines are assembled into the section/cue tree. A final filter removes OCR artefacts and empty sections.
Cue splitting
Long dialogue is split into crisp cues by a deterministic algorithm:
- Sentences are split on
.,!, and?. - Sentences longer than the max cue length (default 140 characters) are split
at the strongest nearby punctuation (
;,:,—,,), falling back to a word boundary so no word is ever cut in half. - Fragments shorter than the min cue length (default 40 characters) are merged into a neighbouring cue.
After the import
If the current show has unsaved changes, you are asked to confirm before the import replaces it. The imported show gets its title from the PDF file name and a description noting the OCR source. Review it in edit mode and adjust anything OCR misread.
Scanned scripts can introduce stray characters, merged words, and misread punctuation. Expect to spot-check and correct imported cues.