I think all my friends have experienced , When you want to put PDF To WORD when , Typing by yourself, Herr left in front of you :
If you don't pay for it, you want to go whoring for nothing ?? Think beautifully ~
However , Bloggers don't shrink back , After all, it's a traditional virtue to face difficulties . therefore , Today's theme comes out : use python Write a PDF turn WORD Gadgets ( Based on a website interface ).
Many people study python, I don't know where to start .
Many people study python, After mastering the basic grammar , I don't know where to look for cases to start .
A lot of people who have done cases , But I don't know how to learn more advanced knowledge .
So for these three kinds of people , I will provide you with a good learning platform , Get a free video tutorial , electronic text , And the source code of the course !??¤
QQ Group :1057034340
One 、 Thought analysis
Search online , You can find a lot of PDF Tools for conversion , There are many online conversion sites , Like this :
that , Through the test interface provided by the website , We can use crawler simulation to implement the transformation .
There is no mistake ~ The idea is so simple and clear , Today's protagonist is :
https://app.xunjiepdf.com
Through packet capturing analysis , Know it's a POST request , Next use requests Library simulation can be .
It should be noted that , This interface is for testing only , So there are restrictions on the number of pages that can be converted , For more complete functions, please support the original version .
Two 、 My code
Ten thousand coders, There are 10000 kinds of codes, Here is my code , For reference only .
Import related libraries :
Execute the main function :
if __name__=='__main__': pdf2word = PDF2Word() pdf2word.convertPDF('001.pdf','')
Be careful : convertPDF Function has two arguments , The first one is the one that needs to be converted PDF, The second parameter is the converted directory .
run once , One click into the soul ,".docx" The files are already in my directory , Comfortable. ~
< END >