# item-by-item troubleshooting and repair
Explain the various reasons why garbled characters, confusing paragraphs, or table deformations occur when converting PDF to TXT. We will teach you how to first determine whether it is a problem with the scanned document, encoding, or typesetting, and then troubleshoot and fix it in order, and give you ways to avoid recurrence.
#What should I do if the PDF is converted to TXT with garbled characters or the format is messed up?
Key points of this article
- First determine whether the PDF has a text layer. Scanned documents that cannot select Chinese characters must be OCRed first, otherwise the transferred TXT will be either blank or garbled.
- Chinese garbled characters are mostly caused by the inconsistency between the TXT encoding and the opening method. Saving in UTF-8 can usually solve the problem.
- Multiple columns, tables, headers and footers will disrupt the reading order. TXT has no layout information and needs to be manually sorted or deleted.
- After conversion, numbers, names, and proper nouns must be randomly checked. Both OCR and machine conversion may cause errors. Important content must be checked item by item.
Convert PDF to TXT, usually for copying content, full-text search, or importing into other programs. When you open it, you will find that the Chinese characters are turned into question marks or squares, the paragraphs are cut into pieces, and the tables and multi-column content are crowded into a ball. Many people subconsciously try another online conversion website, but the result is still the same.
The problem lies in the fundamental difference between PDF and TXT. PDF records "where each word is placed on the page", while TXT is just a string of characters plus line breaks. The causes of garbled characters, serialization, and misalignment are different, and the correction methods are also different. Therefore, it is more effective to first determine which layer the problem belongs to than to retransmit it repeatedly.
After reading this article, you can determine whether the PDF in your hand is a scan, know how to check the TXT encoding, handle the problems caused by multiple columns, tables, headers and footers, and know how to check the content after conversion.
What should I do if the PDF to TXT is garbled? One sentence conclusion
Let’s talk about the conclusion first: Don’t rush to re-convert it first, first check whether you can select text in the PDF and what encoding to use to save the TXT. Most garbled characters and blank spaces can be solved by changing the encoding or doing OCR first; only when the typesetting itself is very complicated, you need to change the way of processing.
| your situation | Recommended practices | reason |
|---|---|---|
| The entire page is blank, or Chinese characters cannot be selected in the PDF | Do OCR on the PDF first, then export the text | The scanned document does not have a text layer, and direct conversion will only result in blank or garbled characters. |
| Text can be selected, but the Chinese TXT is a question mark or a box | Re-save the TXT with UTF-8, then change the encoding and open it for verification | The encoding is inconsistent with the opening method, and the text itself is not wrong. |
| Text is normal, but paragraphs are chopped up and columns are mixed together | Organize manually according to reading order, or export to Word first and then organize | TXT has no format information and can only be output in position order during conversion. |
| The table becomes a series of numbers and spaces | The table is processed in Excel, and only the main text is retained in TXT | TXT cannot express row and column structure |
| The display is normal, but the characters transferred are wrong. | Write down the wrong characters and compare them with another conversion method. | Font mapping is missing, character encoding is inconsistent with screen display |
First determine what kind of problem it is
| symptoms | Common causes | How to confirm |
|---|---|---|
| The entire page is blank or has only a few characters | Scanned copy, the page is a picture, there is no text layer | Use the mouse to drag and select a piece of text in the reader. If you cannot select it or can only select the entire block, it is a picture. |
| Chinese characters turn into question marks, squares or strange symbols | The TXT encoding is inconsistent with the opening method, or the font mapping is missing | Use a text editor to open them in UTF-8 and GBK to see which one is normal; compare the same text in the PDF |
| English is normal, only Chinese or special symbols are wrong. | The font is embedded in a special way, and some characters do not have standard coding. | Turn only one page and write down whether the wrong character is a rare word or symbol. |
| Frequent line breaks between sentences | PDF each line is a separate block of text, output by line | See if there is a line in the original and whether there is no full stop at the end of the line. |
| The left and right columns are interlaced. | Multi-column typesetting, output in coordinate order | Check whether the columns are divided against the original PDF and whether you skip lines frequently when reading in TXT. |
| The page number, header and footer appear repeatedly in the text. | Elements repeated on each page are output as body | Search for page numbers or header text to see if every page appears |
By sorting from easy to difficult, most of the problems can be located in the first few steps:
- Confirm the text layer: drag and select a piece of text in the PDF reader. If it can be selected, it means that there is a text layer, and most of the problems lie in coding or typesetting; if not, you need to do OCR first.
two. OCR the scanned part: OCR the scanned version of PDF in the PDF editor of the OmniDoc desktop client. After the recognition is completed, check whether the text on the first few pages is accurate. If you find the wrong words, you can directly modify the paragraph text.
- Check the TXT encoding: open it in UTF-8 with the system's own text editor. If the Chinese is normal, it means that the coding is fine; if the code is garbled, change the GBK code to open it, find the normal one, and save it with UTF-8.
- Check the font mapping: if the PDF screen shows normal and garbled code after transfer, write down the location and type of garbled characters. This type of problem is usually a lack of font mapping, so you can first export PDF to Word, then save it from Word to plain text (.txt), and compare the results twice.
- Organize multiple columns and sentences: manually assemble the contents in reading order in TXT and merge the sentences that have been cut off. It is processed in segments for a long time, and each paragraph is saved once to avoid one-time large-scale replacement errors.
- Delete headers, footers and page numbers: use the editor's find and replace function to search for repeated header text and page number numbers, confirm them one by one and then delete them, instead of replacing them as a whole.
- Repair broken hyphens: English papers often have hyphens at the end of lines, such as "impor-" followed by "tant". Look for "hyphen plus newline" combinations and merge them into complete words, but avoid hyphenated words such as "well-known".
- Check the key contents: spot-check the words near the numbers, names, proper nouns and formulas, and compare them with the original PDF item by item.
# how to avoid the next occurrence
-drag and select a paragraph of text before conversion to confirm whether the PDF has a text layer. OCR the scanned piece first, and then convert the TXT. -use UTF-8 to save and open TXT. When passing files back and forth between different systems, check the completeness of the Chinese language after each save. -when there are tables, columns, or charts in the original text, organize the layout in the PDF editor or Word, and then export the text. Don't expect TXT to retain typesetting. -keep an original PDF or Word file. TXT is only used for retrieval and copying. If there is a problem, you can go back to the original text and deal with it again at any time.
# frequently asked questions (FAQ)
1. Can I fix the disorder in the format of TXT translation?
TXT does not save the layout, and the missing paragraph structure cannot be recovered from TXT itself. A more feasible remedy is to go back to the original PDF, export it to Word and then sort it out, or manually assemble it in reading order directly in TXT.
2. The scanned version of PDF still has typos when it finishes OCR. What should I do?
OCR will have recognition errors, especially obscure pages, small font sizes and obscure words. It is recommended to revise paragraph by paragraph with the original. Numbers, names and proper nouns should be checked item by item. Do not assume that all the recognition results are correct.
3. The results of the same PDF are different in different tools. Why?
Different tools extract text in different order, font mapping, and line breaking rules, so the output will be different. When you encounter a problem, you can use the same page to compare the two results and choose the one with fewer errors as the starting point.
4. Can TXT keep the form?
No, I can't. TXT can only express text and line breaks, but cannot express row and column structures. Tables are more suitable for converting to Excel or exporting to Excel directly in the PDF editor before processing.
# Summary
When there is a problem from PDF to TXT, it is efficient to distinguish whether there is no text layer, the coding is inconsistent, or the typesetting order is disrupted, and then dealt with according to the corresponding method. Be sure to spot-check numbers and proper nouns after the conversion, because both OCR and machine conversion can go wrong.


