DEV Community

Bervianto Leo Pratama
Bervianto Leo Pratama

Posted on • Originally published at Medium on

My First Telegram Bot

Convert PDF to JPEGs

Photo by William Hook on Unsplash

Background

I have though to build an application that automated my task. I usually do screen capture use print page as pdf after that convert it into images. I use print page because need the full pages. I know, why I’m not decided to find/create extension for that browser. I want this because I want not too specific browser. My solution should work for another task too. It’s good when I can cut some tasks.

My previous task is

  1. Print as PDF
  2. Open the PDF use GIMP
  3. Export as JPEG

The task will more complicated when I need convert much PDF. :( Also if I ended to use CLI tools that can convert JPEG also not really bring impact for me. So I decide to create a bot, you can just upload and receive the result. For me, that is easy task. :D

Finding the Libraries

The first time, I decide try to use NodeJS + Typescript to do this. I want to use this because I more familiar than Python. Unfortunatelly, I can’t find good libraries that meet my requirement to convert PDF to images. Maybe I’m not spend much time to find it, so I decide to change my plan. I use Python, I see the libraries very comfort to me.

The problems

Photo by Tim Gouw on Unsplash

Yeah, I have code and debug about +6 hours. I’m not familiar with Python also my big problem is Documentation. Why? I think, I wrong to decide the telegram libraries that I will be used. I use a library that not bring me enough documentation, how to process the file, how to process the upload file, my core code not explained at the docs! I need to find out from issues, commit, and the source code itself. It bring me some frustration situation.

The Result

My first telegram bot, use to help me convert pdf to images automatically, I need this. 😅 Spend much times, because long time not use python and very limited documentation about library that I want to be used, so I spend time to read the source code too. So bad I thing. 🙄 But, I'm happy, finally have own tool to convert it automatically, just upload. Not like my previous step, need manually convert it. 🤣 Btw, why I don't use another free tools. I can't know how safe the privacy. So, I use my own. 😃

You can see my result in my instagram. :D Actually this is really spend much time. The first taught, I will do it in small times, but no, so sad for me.

bervProject/my-telegram-bot

I also want to share my Github Link. Feel free bring me some suggestion to update it! I’m so sorry not bring full details how technically I create the bot. You can ask me for the details if you need. :)

Photo by Austin Park on Unsplash

Next step

For the next step or my next plan, I want to add feature to have image recognition. Such as for classification. I also think to have text classification about News Categories, but it is about HOAX! So my idea, you can only bring me the link, I will give you the classification, is it the news HOAX or not. I am really interested with the Machine Learning or AI for now. How wonderful. Thank you so much for read my little article.

Top comments (0)