striprtf


Namestriprtf JSON
Version 0.0.26 PyPI version JSON
download
home_pagehttps://github.com/joshy/striprtf
SummaryA simple library to convert rtf to text
upload_time2023-07-20 14:30:36
maintainer
docs_urlNone
authorJoshy Cyriac
requires_python
licenseBSD-3-Clause
keywords rtf
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # striprtf
![Build status](https://github.com/joshy/striprtf/workflows/striprtf%20build/badge.svg)

## Purpose
This is a simple library to convert rtf files to python strings. A lot of
medical documents are written in rtf format which is not ideal for parsing
and further processing. This library converts it to plain old text.

## How to use
```python
from striprtf.striprtf import rtf_to_text
rtf = "some rtf encoded string"
text = rtf_to_text(rtf)
print(text)
```

If you want to use a different encoding than `cp1252` you can pass it via the parameter `encoding`. This 
is only taken into account if no explicit codepage has been set. 
```python
from striprtf.striprtf import rtf_to_text
rtf = "some rtf encoded string in latin1"
text = rtf_to_text(rtf, encoding="latin-1")
print(text)
```

Sometimes UnicodeDecodingErrors can happen because of various reasons.
In this case you can try to relax the encoding process like this:
```python
from striprtf.striprtf import rtf_to_text
rtf = "some rtf encoded string"
text = rtf_to_text(rtf, errors="ignore")
print(text)
```

## How to use online
If you don't want to install, there is also an online version available at https://striprtf.dev which can be used for free. 


## History
[Pyth](https://github.com/brendonh/pyth) was not working for the rtf files I
had. The next best thing was this gist:
https://gist.github.com/gilsondev/7c1d2d753ddb522e7bc22511cfb08676

~~Very few additions where made, e.g. better formatting of tables. ~~

In the meantime some encodings bugs have been fixed. :-)

## Pushing to PyPi
 * pip install twine


Run commands
```
python setup.py sdist bdist_wheel
twine upload -r testpypi dist/*
twine upload -r pypi dist/*
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/joshy/striprtf",
    "name": "striprtf",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "rtf",
    "author": "Joshy Cyriac",
    "author_email": "joshy@posteo.ch",
    "download_url": "https://files.pythonhosted.org/packages/25/20/3d419008265346452d09e5dadfd5d045b64b40d8fc31af40588e6c76997a/striprtf-0.0.26.tar.gz",
    "platform": null,
    "description": "# striprtf\n![Build status](https://github.com/joshy/striprtf/workflows/striprtf%20build/badge.svg)\n\n## Purpose\nThis is a simple library to convert rtf files to python strings. A lot of\nmedical documents are written in rtf format which is not ideal for parsing\nand further processing. This library converts it to plain old text.\n\n## How to use\n```python\nfrom striprtf.striprtf import rtf_to_text\nrtf = \"some rtf encoded string\"\ntext = rtf_to_text(rtf)\nprint(text)\n```\n\nIf you want to use a different encoding than `cp1252` you can pass it via the parameter `encoding`. This \nis only taken into account if no explicit codepage has been set. \n```python\nfrom striprtf.striprtf import rtf_to_text\nrtf = \"some rtf encoded string in latin1\"\ntext = rtf_to_text(rtf, encoding=\"latin-1\")\nprint(text)\n```\n\nSometimes UnicodeDecodingErrors can happen because of various reasons.\nIn this case you can try to relax the encoding process like this:\n```python\nfrom striprtf.striprtf import rtf_to_text\nrtf = \"some rtf encoded string\"\ntext = rtf_to_text(rtf, errors=\"ignore\")\nprint(text)\n```\n\n## How to use online\nIf you don't want to install, there is also an online version available at https://striprtf.dev which can be used for free. \n\n\n## History\n[Pyth](https://github.com/brendonh/pyth) was not working for the rtf files I\nhad. The next best thing was this gist:\nhttps://gist.github.com/gilsondev/7c1d2d753ddb522e7bc22511cfb08676\n\n~~Very few additions where made, e.g. better formatting of tables. ~~\n\nIn the meantime some encodings bugs have been fixed. :-)\n\n## Pushing to PyPi\n * pip install twine\n\n\nRun commands\n```\npython setup.py sdist bdist_wheel\ntwine upload -r testpypi dist/*\ntwine upload -r pypi dist/*\n```\n\n\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "A simple library to convert rtf to text",
    "version": "0.0.26",
    "project_urls": {
        "Download": "https://github.com/joshy/striprtf/archive/v0.0.26.tar.gz",
        "Homepage": "https://github.com/joshy/striprtf"
    },
    "split_keywords": [
        "rtf"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a3cf0fea4f4ba3fc2772ac2419278aa9f6964124d4302117d61bc055758e000c",
                "md5": "72a482de8dea9d12f00285c489a5953a",
                "sha256": "8c8f9d32083cdc2e8bfb149455aa1cc5a4e0a035893bedc75db8b73becb3a1bb"
            },
            "downloads": -1,
            "filename": "striprtf-0.0.26-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "72a482de8dea9d12f00285c489a5953a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6914,
            "upload_time": "2023-07-20T14:30:35",
            "upload_time_iso_8601": "2023-07-20T14:30:35.338229Z",
            "url": "https://files.pythonhosted.org/packages/a3/cf/0fea4f4ba3fc2772ac2419278aa9f6964124d4302117d61bc055758e000c/striprtf-0.0.26-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "25203d419008265346452d09e5dadfd5d045b64b40d8fc31af40588e6c76997a",
                "md5": "86a12171f7231c38f02ab903be87b895",
                "sha256": "fdb2bba7ac440072d1c41eab50d8d74ae88f60a8b6575c6e2c7805dc462093aa"
            },
            "downloads": -1,
            "filename": "striprtf-0.0.26.tar.gz",
            "has_sig": false,
            "md5_digest": "86a12171f7231c38f02ab903be87b895",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6258,
            "upload_time": "2023-07-20T14:30:36",
            "upload_time_iso_8601": "2023-07-20T14:30:36.290738Z",
            "url": "https://files.pythonhosted.org/packages/25/20/3d419008265346452d09e5dadfd5d045b64b40d8fc31af40588e6c76997a/striprtf-0.0.26.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-20 14:30:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "joshy",
    "github_project": "striprtf",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "striprtf"
}
        
Elapsed time: 0.09018s