PDF to TXT

Copy the text layer from a PDF into a .txt download. A scanned page with no text comes out empty. For a scan, use PDF OCR and keep this PDF.

How to use this tool

  1. Add one PDF.
  2. Choose Download TXT. The button says Extracting… while the pages are read.
  3. The download is the PDF name with .txt instead of .pdf. Each page in the file starts with a line --- Page N ---.
  4. The box on the page shows the first 4000 characters of that text, with an ellipsis when the preview is cut. The download is the full text, not the preview.
  5. Success says Text extracted. A failure says PDF to text failed.

Text layer only

Each page calls getTextContent and joins the string items with spaces. There is no OCR step on this page. A photographed contract will download a file of page headings and little else. Use the OCR page when you need guessed letters from a picture.

The preview slice is full.slice(0, 4000). If you see an ellipsis, the .txt is longer than the box. Open the download. Do not copy the preview and assume it is the whole document.

PDF to text failed means the document could not be opened. There is no password field. Text extracted means the file was written. Check a page boundary in the .txt. The marker is --- Page N --- so you can see where one page ended.

The preview is a slice

The box shows 4000 characters. The .txt continues past that slice. Page markers look like --- Page N ---. Empty sections mean that page had no text layer. Open the downloaded file, not only the box.

The words, without the layout

Download the text file and search for a sentence from the first page and one from the last. If both are there, the text layer was readable. Columns may come out in a strange order because a text file has no columns. A scanned page contributes nothing until you run OCR. This export does not keep fonts, images, or the page breaks as you saw them.

Common questions

Is the preview the whole document?
No. The box stops at 4000 characters. Download TXT is the full extract.
How are pages marked?
Each page starts with --- Page N --- and the words from that page.
What do I get if the PDF has a text layer?
A text download of that layer. A scan with no text layer will not invent the words. Use PDF OCR for a picture of a page.
Is the text file the whole PDF, including pictures?
No. You get the text layer, with pages marked in the file. Pictures are not described. The preview can be shorter than the download. If the PDF has no text layer, the text file will be thin or empty.