Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Add a public API that gives the text of a file in reading order, for text-to-speech

Aperta
#1,221 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
android, cpp
Ambito
api, backend

Direzione di ricerca

Start by reading internal/html/pdf_file.cpp and the existing odr::internal::pdf::extract_text implementation, then inspect the public odr::PdfFile API and its Java binding. The issue proposes an API but leaves paragraph grouping, location representation, and list versus iterator design open. Done means decoded files expose text units in reading order with locations and no layout duplicates, through a JNI call per file or page.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

Context

OpenDocument.droid reads documents aloud with Android text-to-speech. It gets the text from the rendered HTML, because the core has no public API for it. For PDFs, this failed (opendocument-app/OpenDocument.droid#725). The fix is in opendocument-app/OpenDocument.droid#731, but it depends on internal details of the PDF HTML:

  • It reads the selection layer with the selector .p > .sel. It must skip the aria-hidden glyph layer (.vis), because both layers contain the text.
  • It joins the textContent of the lines, because .p has content-visibility:auto. A page off screen skips rendering, so its innerText is empty.

If the core changes this HTML, text-to-speech in the app stops with no error.

What exists now

  • odr::internal::pdf::extract_text gives the text runs of a page. The HTML writer in internal/html/pdf_file.cpp groups them into the lines of the .sel layer.
  • The public odr::PdfFile and its Java binding have only decrypt, annotate, is_annotatable, and permissions. They have no text API.
  • For documents, Java can walk Document.rootElement() and read Text.content(). That walk needs one JNI call for each element. PDF has no element tree.

Proposal

Add a public API that gives the text of a decoded file as a list of units in reading order:

  1. A unit is a paragraph if the format has paragraphs. For a PDF, it is a block of lines that the core groups as a paragraph, or one page if the core cannot group the lines.
  2. Each unit has a location in the HTML, for example a page index and an element ID. The app needs the location to scroll to the unit and to highlight it while it reads. Without a location, the API is worse than the HTML route.
  3. The text has no layout duplicates: no hidden glyph layers, and no hyphens that only break a line.
  4. The API is available in the JNI binding as one call, or as one call for each page. It must not need one JNI call for each element.

Questions

  • Can PDF paragraph grouping use the same code as the line grouping of the selection layer?
  • Does an iterator for each page fit better than one list, for large PDFs?
  • Can search and copy in the app use the same API later?

🤖 Generated with Claude Code

https://claude.ai/code/session_017ubFaJuyao9gkUwxwcXZQz

Lingua principale
C++
Stelle
41
Fork
10
Merge medio
11h 27m
PR unite (30g)
312

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di opendocument-app/OpenDocument.core

Tutte le issue di opendocument-app/OpenDocument.core

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.