Home > database >  How do make a telegram bot to read a pdf file sent by user and extract data from it?
How do make a telegram bot to read a pdf file sent by user and extract data from it?

Time:02-24

I have been checking on forums(stack overflow, git, Telegram APIs) to check how could I extract contents from a pdf file which is sent by user? I have created Telegram bot using python's python-telegram-bot library and as an efforts to try to solve my question, I had checked links eg: https://pypi.org/project/python-telegram-bot/ and https://python-telegram-bot.readthedocs.io/en/stable/index.html in search of functions but couldn't find anything there.

I did find methods to send a pdf file to user from bot and send a file from user to bot but there is nothing available where BOT can extract contents of pdf sent by user. Will be grateful if experts could guide me here.

CodePudding user response:

python-telegram-bot is a library that provides a wrapper for the Telegram Bot API. As such, it provides all the methods from the API as well as auxiliary functionality to build chat bots in general, including downloading files sent by users. Extracting contents from a received PDF file after download is however far beyond the scope of this library.

Of course there are other libraries that provide such functionality and that can be used in combinantion with python-telgram-bot. See e.g. camelot.


Disclaimer: I'm currently the maintainer of python-telegram-bot.

  • Related