How to convert PDF to Markdown to preserve formatting and title levels
Explain how to retain titles, lists, and tables as much as possible when converting PDF to Markdown. First determine the PDF type, then choose the conversion route, and finally check it one by one according to the title level, list and table, with general inspection methods attached.
Key points of this article
- PDF mainly records the font, font size and position, and does not record semantics such as "This is a secondary title". Before conversion, you must first determine whether the title can be recognized.
- Scanned documents with unselectable text must be OCRed first, otherwise the converted Markdown may be empty or full of garbled characters.
- Converting after sorting through an intermediate format such as Word is usually easier to preserve the title hierarchy and table structure than direct conversion.
- Tables, formulas and pictures are prone to distortion after conversion, so they must be checked separately and cannot just read the text.
- When choosing a free tool, look for file size limits, watermarks, privacy policies, and typography preservation.
If you have a PDF of a paper, product manual, or technical report and want to put it into a note-taking tool, code repository, or static website, you usually want to convert it to Markdown. What is a headache after the conversion is: the original first-level headings have become the main text, the list is squeezed into a paragraph, the tables are scattered into a bunch of symbols, and the original structure is no longer read.
This article is written for people who need to convert pdf to markdown and preserve the format. The focus is not on which tool to find, but on explaining clearly why the format and title level are lost, at which step they are lost, and what checks are done before and after conversion. These methods are suitable for most conversion routes. After reading, you will be able to judge which method is suitable for your PDF and know what to check after conversion.
Can I preserve the title hierarchy when converting PDF to Markdown? One sentence conclusion
Most of them can be retained, but only if the text in the PDF can be selected, the titles are visually distinct, and you are willing to use an intermediate format such as Word to organize them first. For scanned documents and documents with complex formatting, the title level usually needs to be filled in manually.
| your situation | Recommended practices | reason |
|---|---|---|
| The text can be selected and the title font size is clear | Direct conversion, then check the level | The text can be read completely, and the difference in font size can be used as a basis for judging the title. |
| Scans or text cannot be selected | OCR first, then convert | When there is no text layer, any conversion will only result in images |
| Multiple columns, multiple tables, complex headers and footers | Convert to Word first, then convert to Markdown | Heading styles and table structures in Word are easier to check and correct |
| Lots of mathematical formulas | Check formulas individually after conversion, retaining LaTeX source code if necessary | Formulas can easily become garbled characters or pictures and need to be confirmed one by one. |
| Only plain text content is required | Direct conversion, ignoring hierarchy | When no hierarchy is needed, alignment requirements are low and processing is easier. |
Before you start: Confirm these points first
- Whether text can be selected. Open the PDF, drag a section of text with the mouse and copy it. If the correct text can be copied, it means it is a text PDF; if it cannot be selected or garbled characters are copied, it is mostly a scanned document and requires OCR first, otherwise the conversion result will not be available.
- Is the title distinguished by font size and weight? Look through a few pages. If the first-level headings are obviously larger than the main text and the second-level headings are bold, there is a basis for hierarchy. If all text is the same size, the conversion tool cannot determine where the title is and can only rely on manual annotation.
- Whether it has multi-column layout and headers and footers. After multi-column conversion, the order of the left and right columns is often disrupted, and the page numbers and book titles in the header and footer are also mixed into the text. In this case, it is recommended to sort it out before converting.
- Number of tables and formulas. If there are few tables, you can manually modify them after conversion; if there are many tables or formulas, it is recommended to list them first and check them individually to avoid one complex table from dragging down the entire document.
- Where is Markdown used? Note-taking software, static websites and code warehouses do not all have the same syntax support for Markdown, such as table writing, mathematical formulas and table of contents generation. Confirm the target environment first, and then decide which special syntax to retain.
Steps to organize PDF into convertible Word files in OmniDoc
The following steps use the PDF editing function of the OmniDoc desktop client to first organize the PDF into a Word file, and then submit it to subsequent Markdown conversion. OmniDoc itself is not responsible for directly outputting hierarchical Markdown, so the purpose of this step is to clarify the structure.
- download and open the desktop client. visit download.omnidoc.top to download the version applicable to your system and open the file to be processed in the PDF editor.
- check whether the text is optional. if it is a scanned piece, use the OCR function to identify the text, and then select a paragraph of text to confirm that it can be selected and copied normally.
- merge paragraphs that have been taken apart. in contrast to the original text, use the paragraph text editing function to correct sentences that are broken due to typesetting. Only the text content is changed, not the layout.
- remove duplicate headers and footers. * delete the repeated titles, page numbers and other words on each page to prevent them from being transferred to Markdown as the text.
- Export to Word format. Select to export to Word, save it as a .docx file, and open it in Word to confirm the integrity of the content.
- style the title. * apply the "first-level heading" style to the first-level headings and the "second-level headings" style to the second-level headings in Word, and keep the text as ordinary paragraphs. This step determines whether subsequent levels can be identified.
- organize lists and forms. check whether the serial number and indentation of the list are continuous, and re-adjust the broken form to a regular row structure; if the table cannot be repaired, write it down and deal with it manually.
- convert to Markdown and check. after saving docx, you can use the general command line tool for document conversion or online conversion website conversion. Pay attention to the file privacy policy before conversion. The conversion results can be opened in the UniDoc Page Editor (app.unidoc.top) to check the title and table against the original text.
# check item by item after conversion
After you get the Markdown, don't just look at the first few paragraphs, it is recommended to check it item by item according to the list below.
| Check item | What do you think? | What if there's a problem? |
|---|---|---|
| Title level | Search for whether all lines starting with "#", quantity and level are the same as the original directory | One level less, go back to the Word complement and change it again; only individual headings can be manually modified directly. |
| Paragraphs and line breaks | Whether the text is independent of each paragraph and whether it has been cut by a hard line break. | Merge split paragraphs and delete extra blank lines |
| List | Whether the sequence number and indentation of ordered and unordered lists are continuous | When indentation is disordered, it is uniformly changed to a first-level list, and the nested relationship is adjusted manually. |
| Form | Whether the header and the number of columns are aligned, and whether redundant symbols are mixed in the cell. | The vertical bar in the cell can be changed to other symbols; complex tables can be retained as pictures and key data can be written in text below. |
| Formula | Whether the formula can be displayed properly, or there are still garbled codes. | Re-enter the formula, or keep it as a picture and indicate the source |
| Picture | Whether the picture is missing and whether the position is in the correct paragraph | Reinsert the picture and add the annotations |
| Text accuracy | Spot check a few paragraphs and compare them with the original sentence by sentence | The results of OCR and machine translation should be checked paragraph by paragraph, especially numbers, proper nouns and reference numbers. |
# which method is suitable for you?
- you just want to keep the content quickly: you can convert it directly. If the level is messed up, you can manually fill in a few titles with the editor. - put it into a static website or code repository: it is recommended to follow the Word intermediate format and check the title, table and directory step by step to ensure that the navigation and page structure are correct. - the original text is to scan books or old materials: OCR before finishing, the workload of manual revision will be significantly greater, so it is suitable to allow sufficient time to check page by page.
# frequently asked questions (FAQ)
1. Can I use the free PDF to Markdown tool?
Yes, but the selection depends on several aspects: file size limit, whether the output is watermarked, whether the file will be uploaded to the server and privacy policy, as well as the retention of title and form. When it comes to undisclosed contracts or draft papers, try not to release documents.
2. What's the difference between online conversion and local processing?
Online conversion usually requires uploading files, which is easy to operate, but confirm the retention period and privacy policy. Local processing files do not leave the computer, which is more suitable for sensitive data. The difference in title recognition between the two mainly depends on the structure of the PDF itself, not on the location of the processing.
3. After the conversion, the title is all changed into the text, what to do?
This usually means that the title in the source file is not styled, or there is no obvious difference in the font size between the title and the text in PDF. When you go back to Word, apply the primary and secondary title styles to the title and convert it again, which is more stable than adding "#" directly to Markdown, and it is easier to maintain later.
4. The form is messed up after conversion, can you save it as a picture directly?
Sure. The picture ensures that the appearance is consistent with the original text, but the contents of the table cannot be searched and copied. It is suggested that simple tables should be rewritten into Markdown tables as far as possible, while complex tables should be retained as pictures, and key data should be written next to them for easy retrieval and reference.
# Summary
The key to the conversion of pdf to markdown is to judge whether PDF can read the text, then sort out the title style with the help of intermediate formats such as Word, and finally check the title level, list and table item by item. Processed in this order, most documents get a well-structured Markdown that is easy to continue editing.


