# msoffice2pdf
[![Python](https://badgen.net/badge/language/python/orange?icon=python)]()
[![Flask](https://badgen.net/badge/type/library/red?icon=)]()
>_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](https://www.python.org/downloads/)**_ **>=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"]**
```python
from msoffice2pdf import convert
output = convert(source="C:/Users/<User>/Downloads/file.docx", output_dir="C:/Users/<User>/Downloads", soft=0)
print(output)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/robsonlimadeveloper/msoffice2pdf",
"name": "msoffice2pdf",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "msoffice, pdf, convert, libreoffice, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .txt, .xml",
"author": "Robson Soares de Lima",
"author_email": "Robson Soares de Lima <robsonlimadeveloper@gmail.com>",
"download_url": null,
"platform": null,
"description": "# msoffice2pdf\r\n\r\n[![Python](https://badgen.net/badge/language/python/orange?icon=python)]()\r\n[![Flask](https://badgen.net/badge/type/library/red?icon=)]()\r\n\r\n>_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._\r\n\r\n### Prerequisites\r\n\r\n*_**[Python](https://www.python.org/downloads/)**_ **>=3.6** installed on the environment.*\r\n\r\n### Installation\r\n\r\nStep 1:\r\n\r\n```\r\npip3 install msoffice2pdf\r\n```\r\n\r\nStep 2\r\n\r\n### (Windons Only):\r\n\r\nFor Microsoft Office use:\r\n\r\n* Delete all cache files from the folder below in case there is any error with Microsoft Office conversion:\r\n `C:\\Users\\<User>\\AppData\\Local\\Programs\\Python\\Python39\\Lib\\site-packages\\comtypes\\gen`\r\n\r\n* For Windows Server\r\n\r\n> **Step 1:**\r\n>\r\n> Start > Run > dcomcnfg.exe\r\n>\r\n> **Step 2:**\r\n>\r\n> Select: Computers -> My Computer -> Config DCOM -> Microsoft Word 97-2003 Documents -> Properties\r\n> Tab general select level authentication to None\r\n> Tab security select customize and add All\r\n> Tab identify select this user and add Admin user and password\r\n> \r\n> **Step 3:**\r\n> \r\n> Select: Computers -> My Computer -> Config DCOM -> Microsoft Excel Application -> Properties\r\n> Tab general select level authentication to None\r\n> Tab security select customize and add All\r\n> Tab identify select this user and add Admin user and password\r\n> \r\n> **Step 4:**\r\n> \r\n> Select: Computers -> My Computer -> Config DCOM -> Microsoft PowerPoint Application -> Properties\r\n> Tab general select level authentication to None\r\n> Tab security select customize and add All\r\n> Tab identify select this user and add Admin user and password\r\n\r\n\r\nFor LibreOffice use:\r\n\r\nInstall LibreOffice last version:\r\n\r\nhttps://www.libreoffice.org/download/download/\r\n\r\n### (Ubuntu Only):\r\n\r\nInstall **LibreOffice**:\r\n\r\n`sudo add-apt-repository -y ppa:libreoffice/ppa`\r\n\r\n`sudo apt-get update`\r\n\r\n`sudo apt-get install libreoffice libreoffice-style-breeze`\r\n\r\n### Example:\r\n\r\nFor use in `Windows` environment and `soft=0` Microsoft Office must be installed.\r\n\r\nFor use in `Windows` environment and `soft=1` you need the latest version of LibreOffice(soffice) installed.\r\n\r\nFor `Ubuntu(linux)` environment it is only possible to use `soft=1`, that is, LibreOffice(soffice).\r\n\r\nSupported files: **[\".doc\", \".docx\", \".xls\", \".xlsx\", \".ppt\", \".pptx\", \".txt\", \".xml\"]**\r\n\r\n```python\r\nfrom msoffice2pdf import convert\r\n\r\noutput = convert(source=\"C:/Users/<User>/Downloads/file.docx\", output_dir=\"C:/Users/<User>/Downloads\", soft=0)\r\n\r\nprint(output)\r\n```\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "This package aims to convert Office file types to PDF using Microsoft Office or LibreOffice.",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/robsonlimadeveloper/msoffice2pdf"
},
"split_keywords": [
"msoffice",
" pdf",
" convert",
" libreoffice",
" .doc",
" .docx",
" .xls",
" .xlsx",
" .ppt",
" .pptx",
" .txt",
" .xml"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c2413214ef12bd4009db82654f5f52b82cde9bb241996415c4acde56319a590f",
"md5": "c10fa493ceee0dd02c2f7b8621309b63",
"sha256": "450505aedb027ed530a5d8d5ac5c0de046141f5256d41198434be21a95da99c5"
},
"downloads": -1,
"filename": "msoffice2pdf-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c10fa493ceee0dd02c2f7b8621309b63",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 5104,
"upload_time": "2024-05-23T06:37:01",
"upload_time_iso_8601": "2024-05-23T06:37:01.203822Z",
"url": "https://files.pythonhosted.org/packages/c2/41/3214ef12bd4009db82654f5f52b82cde9bb241996415c4acde56319a590f/msoffice2pdf-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-23 06:37:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "robsonlimadeveloper",
"github_project": "msoffice2pdf",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "msoffice2pdf"
}