Someone asked me to code a program that translates French-language PDF files to English, and I thought that maybe I could convert the PDF files to Word documents or some other text document with a program I coded in C++, and then translate the text using Python's xgoogle library. Is programming this indirect translation process even feasible, and if so, how do I go about doing it? Thank you for your reply in advance.

If under Linux, you can use the "pdftotext" command (from package "poppler-utils"). Then, you can use "libtranslate-bin" package to install a text translator program and use it with "translate-bin" command. So, your problem can be entirely solved by:

$ pdftotext my_file.pdf my_file.txt
$ translate-bin -s google -f en -t fr my_file.txt > mon_fichier.txt

You only need to wrap these two calls in a shell, and you are done.

Comments
thats great! :)
you made it too easy :)

Thank you for your replies:

@Nathan Hopefully this library can suffice.

@Dragon He wants me to code it; in other words, he's discouraging me from using already-made software, but maybe I can convince him to use this, then use the translation feature in Word.

@mike That would be very useful, but unfortunately, we're using Windows V_V.

>>but unfortunately, we're using Windows V_V.

If I had a dime for everytime I heard that...

You can actually get pdftotext for Windows as well.

And libtranslate is an open-source library, so you can try to either port it to windows or just grab the relevant parts of the source code.

>>but unfortunately, we're using Windows V_V.

If I had a dime for everytime I heard that...

You can actually get pdftotext for Windows as well.

And libtranslate is an open-source library, so you can try to either port it to windows or just grab the relevant parts of the source code.

I am really grateful for your help. Hope things work out for me with this little project.

This article has been dead for over six months. Start a new discussion instead.