aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 566b335544c7c02babd79966945e574c062937a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# PDF2TXT + Translator 1.0.0

A single-page, browser-only tool that pulls the text out of a PDF. The document is
opened and parsed **on your own machine** — nothing is uploaded anywhere. There is no
server, no account, no sign-up and no tracking code in the app.

## What the tool actually does

- **Load one file at a time** — drag & drop it onto the drop zone or click to choose it.
  The picker accepts `.pdf`, `.txt`, `.md` and `.json`.
- **Extract text from a PDF** — every page is read with the bundled PDF.js and joined
  into one plain-text document, with a progress bar (`Page i/total`).
- **Or paste text directly** into the paste box and press *Load Pasted Text*.
- **Edit the result** in a full-size editor (Select All / Deselect All / Fullscreen).
- **Download TXT** (`extracted.txt`) or **Copy All** to the clipboard.
- **Optional language-model steps** — Clean, Translate, Validate, or a combined
  workflow: `Clean → Translate → Validate`, `Translate → Validate`,
  `Clean → Validate`, `Translate Only`, `Clean Only`.
- **Translate into 16 target languages** offered in the page: English, Spanish, French,
  German, Italian, Portuguese, Chinese, Japanese, Korean, Russian, Arabic, Hindi,
  Turkish, Dutch, Polish, Swedish. Text is split into 1,500-character chunks and sent
  one chunk at a time, with pause and stop buttons and a token counter.
- **Settings tab** — API source (Proxied `/ollama`, Local `localhost:11434`, or a Custom
  URL), optional API key, *Refresh Models* (reads `/api/tags`), and chunk size.

It does **not** do OCR, batch/multi-file processing, or translation presets. A scanned
PDF with no text layer will come out empty.

## What you receive

```
pdf2txt/
├── src/index.html          the whole application (HTML + CSS + JS, no build step)
├── vendor/pdf.min.js       PDF.js core library
├── vendor/pdf.worker.min.js PDF.js worker
├── docs/USAGE.md           step-by-step guide for non-technical users
├── README.md               this file
├── CHANGELOG.md
├── LICENSE
└── VERSION
```

## How to run it

The page loads PDF.js as a Web Worker, and browsers refuse to start a worker from a
`file://` URL. So double-clicking `src/index.html` will load but extraction will fail.
Serve the folder over plain HTTP instead — no dependencies, Python 3 is enough:

```bash
cd products/pdf2txt
python3 -m http.server 8000
```

Then open <http://localhost:8000/src/index.html>. Any static web server works the same
way; upload the whole `pdf2txt` folder to any host and open `src/index.html`.

## Optional translation

Translation is **off by default in the sense that you must point it at a model**. The
page talks to an Ollama-compatible API using `POST /api/generate`. The model used for
offline translation is named in the page's Local model list as:

```
translategemma:latest
```

To use it entirely offline:

1. Install [Ollama](https://ollama.com) and run `ollama pull translategemma:latest`.
2. In the app open the **Config** tab, set **API Source** to `Local (localhost:11434)`.
3. In the **Translate** section pick `translategemma:latest` as the Translation Model.
4. Choose a target language and press **Translate**.

Two honest caveats about the shipped defaults:

- The default **API Source** is `Proxied (/ollama)`, which expects a server-side proxy
  at `/ollama`. On a plain static host use `Local` or a `Custom URL`.
- The default **Translation Model** is `glm-5.3-flash:cloud` — a cloud model. For a fully
  local, offline run you must switch it to `translategemma:latest` (or another model you
  have pulled, such as `llama3.2:latest` or `qwen2.5:7b-instruct`).

Without a reachable model endpoint, PDF extraction, editing, copy and TXT download all
still work; only the Clean/Translate/Validate buttons fail.

## Licence

MIT © 2026 Akan Goksu Valdes — see [LICENSE](LICENSE). The files in `vendor/` are
PDF.js and remain under the Apache License 2.0.