A PDF can look perfectly readable on screen and still give your application almost no useful text. Some pages contain selectable text, some are images, and some mix the two with tables and diagrams.
If the extraction is wrong, a generated lesson can be fluent while teaching from incomplete material. Inspect the source path before adjusting the model's instructions.
What is the difference between PDF text extraction and OCR?
Text extraction reads the text information present in a document. Optical character recognition, or OCR, estimates text from an image of a page. A scanned textbook often needs the second path.
Neither process automatically preserves the meaning of the layout. A two-column page can become interleaved text. A diagram can lose the relationship between its labels. A table can keep all its words while losing which value belongs to which row.
For a document-based AI feature, that means extraction quality is part of answer quality. Do not treat it as a file-upload detail.
Choose a small test set with different page structures
Use material you are permitted to process and share. Include a clean text page, a photographed page, a table, a diagram and an intentionally poor scan.
| Source | Check after extraction |
|---|---|
| Selectable PDF text | Sentence order and missing symbols |
| Scanned page | Recognition errors and skipped lines |
| Two-column layout | Reading order |
| Table or chart | Relationship between labels and values |
| Page with a diagram | Whether important visual meaning is absent |
The expected result can be a warning rather than a repaired page. It is better to tell the teacher that a source needs inspection than to hide an extraction failure inside confident lesson text.
Let the user inspect the material before generation
A source preview is a useful intervention point. Show the text that will reach the model and let the teacher check whether the important section survived.
Preserve the imported file and page references so the user can return to the original. If the app removes headers, joins paragraphs or limits input length, that transformation can affect what the model is able to use.
Do not silently crop the source and present the resulting lesson as a complete treatment of the chapter. A shorter selected section can be a good input, provided its scope is visible.
How the ChalkLens workflow connects extraction to teaching
I built ChalkLens as a laptop-oriented workflow using Flutter, native PDF extraction, local OCR and local Gemma inference:
Textbook PDF -> macOS PDFKit -----------+
|
Scanned page -> Native OCR -------------+-> Source review
|
v
Local Gemma model
|
v
Lesson kit -> Present modeThe documented demo begins with a short source so the teacher can inspect extraction, generate a lesson kit and use it in the classroom interface. Saved lessons also make the output available after the original generation request has finished.
The ChalkLens source repository includes a sample PDF and setup information. It demonstrates the application workflow; it does not establish measured learning improvements or classroom adoption.
Review the lesson as teaching material, not just valid output
A complete output object can still contain a weak explanation or a question that the source does not support. Check whether the explanation follows the source, whether examples fit the learner, and whether the questions have defensible answers.
For a factual detail that depends on a diagram, compare the original page with the generated explanation. Text recognition cannot recover a visual relationship it never represented.
Teacher editing should be a normal part of the product. A local model does not make subject-matter review unnecessary, and a well-formatted lesson is not proof of correctness.
Questions about document-based classroom AI
Can OCR understand every diagram?
No. Recognizing labels does not necessarily recover how the elements relate. Use a workflow that can flag missing visual information or let a teacher supply context.
Should the whole textbook go into one request?
Usually the useful starting point is a defined lesson section. Large inputs increase preparation and review work and may exceed the chosen model's practical limits.
Does offline processing guarantee accurate lessons?
No. It addresses where the computation runs and whether a remote connection is required. Source quality and output review remain separate concerns.
Try the repository's sample source, then replace it with one difficult page of your own. Compare the extraction before comparing the generated lessons. The ChalkLens case study shows how that preparation connects to the classroom interface.