Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to convert PDF file to markdown format

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to convert PDF files into markdown format, with a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand it.

Baidu searches for keywords from pdf to makrdown, and most of the results are the reverse conversion, that is, markdown text to PDF format.

But there are few solutions from PDF to markdown.

I happen to have this requirement at work, so I have implemented a solution by myself.

The following figure is a PDF file opened in PDF XChange Editor, and I want to export its contents in markdown format.

(1) first export the PDF to word format with the suffix. docx

(2) use typora to obtain the markdown source code of the word document:

At this time, the task is only half done, because typora is converted to markdown format. If the original word document contains pictures, and these images exist in markdown in the form of local images, then if I directly post the markdown containing the tags of these local images to the markdown-supporting communities such as profile Book, CSDN, Open Source China, Tencent Cloud and Aliyun, these local images will not be displayed.

Therefore, we must find an efficient way to upload the local images contained in the word to the network, and then replace the local image tags with the generated markdown tags containing the image network url.

(3) change the suffix of the word file from .docx to .zip. After decompression, you can find all the local files in the subfolder media of the folder word.

Upload all these local files to the website and generate the following url:

I have written a tool that combines the markdown source code that contains only local image tags with the source code that contains the above online image url tags. After that, the local image tags will be replaced by online picture tags:

This tool is available from my github:

Https://github.com/i042416/KnowlegeRepository/blob/master/practice/255_markdown_tool.html

The following figure shows the effect of my original PDF converted to markdown format and published in a community, which is exactly the same as the original PDF:

Thank you for reading this article carefully. I hope the article "how to convert PDF files into markdown format" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report