Skip to content
HTKapp
Browse the documentation

Text extraction module

The Text extraction module retrieves the text content of a PDF — the whole document, the current page or a custom range — to show it in an editable preview and export it in a text format. It also offers an optical character recognition (OCR) option for scanned documents. The module is available from the Conversion category of the Dashboard.

Extraction scope

The Options section offers three scopes through a segmented selector:

  • Current page: extracts only the content of the page currently displayed;
  • Whole document (default): goes through every page in order;
  • Custom range: opens a text field for entering numbers and ranges (1, 3-5, 8). Pages outside the bounds are ignored. If no valid page is selected, the preview shows "No valid page selected".

Output format

The second selector defines the format the text is laid out in:

  • Plain text (.txt): no formatting — the output is purely textual, ideal for a quick copy or automated processing;
  • Markdown (.md): keeps the paragraph structure and marks bold and italic (**, *) when the PDF's font carries them. No # headings: a PDF has no notion of a heading, only font sizes. Handy for reimporting the content into a notes editor (Obsidian, Bear, Notion, and so on);
  • EPUB (.epub): produces an e-book file readable in Apple Books, Calibre, Kobo, and so on. The book title is taken from the PDF metadata;
  • HTML (.html): produces a simple web page with standard HTML markup, keeping a minimum of formatting (paragraphs, line breaks, bold and italic).

One caveat, for both: bold and italic are only recognised when the font comes back named from the PDF — Helvetica, Arial, Times and their variants do; text set in Apple's system font (San Francisco) is read back without its traits and comes out as plain text.

The choice of format also determines the extension proposed when saving.

Using OCR

The Use OCR (text recognition) switch enables optical recognition of pages that contain no vector text layer:

  • Off (default): only the PDF text layer is read. For a digitally generated document, the result is fast and faithful;
  • On: on pages with no text (scans, images, screenshots), HtkPDF performs recognition through Apple's Vision engine. The result can take a few seconds per page depending on the resolution. HtkPDF tries accurate recognition first; if the engine refuses or does not answer within thirty seconds, the fast mode takes over for the rest of the session — the text arrives, a little less polished, rather than an empty preview.

OCR is only useful on scanned PDFs or ones containing textual images. On native PDFs it needlessly slows the processing. Recognition reads the page as displayed: a sideways scan or handwriting yields almost nothing — straighten the pages first with the Rotation module, then save.

Running the extraction

Click Extract text. While processing, the button reads "Extracting…" and stays disabled. Once finished, the result appears in the Preview section.

The preview is an editable text area: you can correct extraction errors (misrecognized characters, imprecise separations), delete passages or add your own content before exporting. A Clear button is available to empty the area.

If the preview stays empty after extraction, it usually means the page (or pages) contains no usable text — enable OCR to handle a scan.

Copying or saving

Once the text has been extracted and possibly edited, two actions are available in the footer bar:

Copy

Places the whole text on the macOS clipboard. You can then paste it (⌘V) into any application: text editor, browser, email, and so on.

Save

Opens a macOS save panel. The extension proposed by default depends on the chosen format:

  • Plain text: .txt;
  • Markdown: .md;
  • EPUB: .epub;
  • HTML: .html.

An "Export operation" dialog first reminds you that the action exports a file without modifying the original PDF. Confirm with I understand to complete the save.

For the EPUB format, HtkPDF writes the book itself, following the OCF container rules (the mimetype file first in the archive, uncompressed): a single chapter, “Extracted content”, with one paragraph per line of text. The PDF document title (the Title metadata field) is reused as the book title — “Extracted document” when it is empty — and the declared language is the application's.

Typical use cases

  • Quick quotation: extracting a precise passage to paste into an email or a working document;
  • Reimporting into an editor: retrieving the content of a PDF to rework it in Word, Pages or a Markdown editor;
  • Conversion to an e-book: generating an EPUB from a PDF book for comfortable reading on Kindle, Apple Books or Kobo;
  • Translation: extracting the text to run it through a translation service, then reintegrating it;
  • Digitisation (with OCR): retrieving the text of a scanned paper document, for example an old contract or a book.

Best practices

  • Always check the preview before saving: the quality of the extraction depends on the source PDF. Documents in columns, with headers or footers, can produce a result with mixed-up ordering;
  • OCR only when needed: on a native PDF, OCR adds nothing but slows processing considerably. Reserve it for scans;
  • For tables, the plain text or Markdown format does not preserve the tabular structure. Use the dedicated Extract Table module instead, which produces a CSV file usable in a spreadsheet.

Screenshots

1 screenshot — click to enlarge