https://github.com/delimitry/compressed_rtf
Compressed Rich Text Format (RTF) compression and decompression in Python
https://github.com/delimitry/compressed_rtf
compressed-rtf lzfu mela python2 python3 rtf
Last synced: 3 months ago
JSON representation
Compressed Rich Text Format (RTF) compression and decompression in Python
- Host: GitHub
- URL: https://github.com/delimitry/compressed_rtf
- Owner: delimitry
- License: mit
- Created: 2016-02-16T21:46:44.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2025-06-29T18:37:40.000Z (7 months ago)
- Last Synced: 2025-07-30T15:47:01.679Z (6 months ago)
- Topics: compressed-rtf, lzfu, mela, python2, python3, rtf
- Language: Python
- Size: 59.6 KB
- Stars: 23
- Watchers: 5
- Forks: 15
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# compressed_rtf
[](https://pypi.org/project/compressed-rtf/)
[](https://github.com/delimitry/compressed_rtf/blob/master/LICENSE)
Compressed Rich Text Format (RTF) compression worker in Python
Description:
------------
Compressed RTF also known as "LZFu" compression format
Based on Rich Text Format (RTF) Compression Algorithm:
https://msdn.microsoft.com/en-us/library/cc463890(v=exchg.80).aspx
Usage example:
--------------
```python
>>> from compressed_rtf import compress, decompress
>>>
>>> data = '{\\rtf1\\ansi\\ansicpg1252\\pard test}'
>>> comp = compress(data, compressed=True) # compressed
>>> comp
'#\x00\x00\x00"\x00\x00\x00LZFu3\\\xe8t\x03\x00\n\x00rcpg125\x922\n\xf3 t\x07\x90t}\x0f\x10'
>>>
>>> raw = compress(data, compressed=False) # raw/uncompressed
>>> raw
'.\x00\x00\x00"\x00\x00\x00MELA \xdf\x12\xce{\\rtf1\\ansi\\ansicpg1252\\pard test}'
>>>
>>> decompress(comp)
'{\\rtf1\\ansi\\ansicpg1252\\pard test}'
>>>
>>> decompress(raw)
'{\\rtf1\\ansi\\ansicpg1252\\pard test}'
>>>
```
License:
--------
Released under [The MIT License](https://github.com/delimitry/compressed_rtf/blob/master/LICENSE).