Skip to main content

This package aims to convert Office file types to PDF using Microsoft Office or LibreOffice.

Project description

msoffice2pdf

Форк для изменения кодировки строки

Python Flask

This package aims to convert Microsoft Office file types to PDF. This lib uses the comtypes package which makes it easy to access and implement custom, dispatch-based COM interfaces or LibreOffice software.

Prerequisites

Python >=3.6 installed on the environment.

Installation

Step 1:

pip3 install msoffice2pdf

Step 2

(Windons Only):

For Microsoft Office use:

  • Delete all cache files from the folder below in case there is any error with Microsoft Office conversion: C:\Users\<User>\AppData\Local\Programs\Python\Python39\Lib\site-packages\comtypes\gen

  • For Windows Server

Step 1:

Start > Run > dcomcnfg.exe

Step 2:

Select: Computers -> My Computer -> Config DCOM -> Microsoft Word 97-2003 Documents -> Properties Tab general select level authentication to None Tab security select customize and add All Tab identify select this user and add Admin user and password

Step 3:

Select: Computers -> My Computer -> Config DCOM -> Microsoft Excel Application -> Properties Tab general select level authentication to None Tab security select customize and add All Tab identify select this user and add Admin user and password

Step 4:

Select: Computers -> My Computer -> Config DCOM -> Microsoft PowerPoint Application -> Properties Tab general select level authentication to None Tab security select customize and add All Tab identify select this user and add Admin user and password

For LibreOffice use:

Install LibreOffice last version:

https://www.libreoffice.org/download/download/

(Ubuntu Only):

Install LibreOffice:

sudo add-apt-repository -y ppa:libreoffice/ppa

sudo apt-get update

sudo apt-get install libreoffice libreoffice-style-breeze

Example:

For use in Windows environment and soft=0 Microsoft Office must be installed.

For use in Windows environment and soft=1 you need the latest version of LibreOffice(soffice) installed.

For Ubuntu(linux) environment it is only possible to use soft=1, that is, LibreOffice(soffice).

Supported files: [".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".txt", ".xml"]

from msoffice2pdf import convert

output = convert(source="C:/Users/<User>/Downloads/file.docx", output_dir="C:/Users/<User>/Downloads", soft=0)

print(output)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

msoffice2pdf_utf_8-1.0.0.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

msoffice2pdf_UTF_8-1.0.0.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file msoffice2pdf_utf_8-1.0.0.1.tar.gz.

File metadata

  • Download URL: msoffice2pdf_utf_8-1.0.0.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.4

File hashes

Hashes for msoffice2pdf_utf_8-1.0.0.1.tar.gz
Algorithm Hash digest
SHA256 1800d12c950229141bec81f19dd9c040f217ab1cbc2be41b4485638e2df977f1
MD5 57803e5df9d83f326fca5a78821ddb63
BLAKE2b-256 a8488ad5d1f85339e224b7672fe52752a7198e627ab6f76ca14363097ab85ba7

See more details on using hashes here.

File details

Details for the file msoffice2pdf_UTF_8-1.0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for msoffice2pdf_UTF_8-1.0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 076e04eef5b6a3acd35a4f02d5e6c3f3a00a654eb0a9d3a6de85a7dc06df77bd
MD5 c9388f0f332ea6c782744b15174c8e75
BLAKE2b-256 e05dc2964ce472cc70c25436492944c75f9cbb4c3344ae8ae0fec22679975b6b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page