GithubHelp home page GithubHelp logo

5l1v3r1 / doc2pdf-bot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alejandrofuster/doc2pdf-bot

0.0 1.0 0.0 11 KB

๐Ÿ“ Convert DOC or DOCX to PDF using a Telegram Bot ๐Ÿ’ฌ

License: MIT License

Python 100.00%

doc2pdf-bot's Introduction

Doc2Pdf-bot

Convert DOC or DOCX using a Telegram Bot

Getting Started

If you want to run this bot locally on your machine you only have to install the requirements, edit Secrets.py with your token and run:

python bot.py

Then, go to Telegram and start it with the /start command.

Requirements

This code needs:

  • LibreOffice
  • Linux (Althought can be ported easily to Windows or MacOs)
  • Python

You can install the necessary python dependencies by moving to the project directory and running:

pip install -r requirements.txt

Deployment

I deployed this script in Heroku. For the deployment using Heroku is necessary to create some files:

  1. Create a file named Procfile with the following content:
worker: python Bot.py	
  1. An Aptfile with the following content:
libreoffice
libxfixes3
libxinerama-dev
libxinerama1
libxdamage1
libglu1-mesa:i386
  1. You will need Java for LibreOffice, so create a dummy pom.xml like the following:
<?xml version="1.0" encoding="UTF-8"?>
<project>
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.dummy</groupId>
   <artifactId>dummy</artifactId>
   <version>1.0-SNAPSHOT</version>
   <packaging>pom</packaging>
</project>
  1. Create an app on Heroku, using CLI or Dashboard.
  2. Add the buildpacks:
heroku/java
https://github.com/heroku/heroku-buildpack-apt.git
heroku/python
  1. LibreOffice will give you an issue with libGL.so.1, so you must run the following command:
ln -s ~/.apt/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 ~/.apt/usr/lib/x86_64-linux-gnu/

You can make it run by forking and editing https://github.com/heroku/heroku-buildpack-apt.git or adding the following line (at main) to the Bot.py:

subprocess.call("""ln -s  ~/.apt/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 ~/.apt/usr/lib/x86_64-linux-gnu/""", shell=True)
  1. Now you can finally deploy your app and scale your dyno!
heroku ps:scale worker=1

Contributing

Feel free to contribute to this repository, but first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

doc2pdf-bot's People

Contributors

alejandrofuster avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.