docugenr8


Namedocugenr8 JSON
Version 0.0.18 PyPI version JSON
download
home_pageNone
SummaryGenerates document with fonts, images, and elements using a coordinate system.
upload_time2024-06-23 21:33:04
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT
keywords document-generation pdf font-customization image-integration coordinate-system text-formatting python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # docugenr8: A Library for Generating Documents

docugenr8 is a Python library designed to help you generate various types of documents effortlessly. Currently, it supports creating PDF files, and work is underway to extend its capabilities to generate BMP, PNG, JPEG, TIFF, ODT, DOCX, and RTF documents.

## Key Features

- **Simple Global Settings**: Easily change global settings such as colors, fonts, and font sizes. No need to redefine these settings each time; the most recent settings are automatically applied to all new elements.
- **Effortless Text Box Creation**: Create text boxes without worrying about text line placement. Text box horizontal alignment options: right, centered, left, and justified. Text box vertical alignment options: top, bottom, center, justified-between-lines, and justified-between-paragraphs.
- **Advanced Paragraph Formatting**: Customize paragraph formatting with options like line height, tab size, word splitting, and indents.
- **Page Numbers**: Insert page numbers (current page and total pages) anywhere in the text box. Use the standard numbering style or add a custom to match your need, like Roman.
- **Linked Text Boxes**: Link text boxes together for continuous text flow. Create text boxes that span multiple pages, or write text in two or more columns on a single page.
- **Table Creation and Customization**: Easily create and fill tables. Customize cell and border colors individually or by rows and columns.
- **PDF Optimization**: Significantly reduce document size (up to 40 times) with font subsetting.
- **Minimal Dependencies**: Currently, it only depends on fonttools. Work is underway to make it a zero-dependency library.

## Structure

The docugenr8 library consists of three independent modules:

### docugenr8-core

- Generates the structure of the document.
- Adds fonts and images for use in documents.
- Defines document structure, including pages, shapes, images, tables, and text boxes.
- Utilizes a coordinate system with x, y positions, width, and height.
- Allows customization of font size, color, name, background, and border color.

### docugenr8-shared

- Defines data transfer objects (DTOs) to facilitate data transfer between modules.
- Contains shared functions used across all modules.

### docugenr8-pdf

- Creates PDF files by reading DTOs created by the core module.
- Implements font subsetting to significantly reduce file size.

## Installation

Install docugenr8 using pip:

```sh
pip install docugenr8
```

## Example

Create a PDF document with a text box and a table.

Create a file main.py with:

```python
from docugenr8.document import Document

# Create a new document
doc = Document()

# Add a font to the document, and define the name and location
# This will automatically select the font for further use
doc.add_font("calibri", "./fonts/calibri.ttf")

# Add a page to the document. A4 has a standard width of 595.2 pixels and a height of 843.04.
doc.add_page(width=595.2, height=842.04)

# Change the font size
doc.settings.font_size = 14

# Create a text area with location and dimensions
text_area = doc.create_textarea(x=50, y=50, width=100, height=100)

# Add some text to the text area
text_area.add_text("The quick brown fox jumped over the lazy dog. 1234567890")

# Add the text area to the first page of the document
doc.pages[0].add_content(text_area)

# Output to pdf file
doc.output_to_file("pdf", "output.pdf")
```

## Usage
Run the script with:
```sh
python main.py
```

This will generate a PDF file named output.pdf in the current directory.

## Advanced Usage

### Global Settings

Set global settings for the document:

```python
from docugenr8.core import GlobalSettings

GlobalSettings.set_color("blue")
GlobalSettings.set_font("Arial")
GlobalSettings.set_font_size(14)
```

### Linked Text Boxes
Link text boxes for continuous text flow:

```python
text_box1 = TextBox(x=50, y=700, width=500, height=100, text="Part 1", font_size=12)
text_box2 = TextBox(x=50, y=600, width=500, height=100, text="Part 2", font_size=12)
text_box1.link(text_box2)
doc.add_text_box(text_box1)
doc.add_text_box(text_box2)
```

### Table Customization
Customize table cells and borders:

```python
Copy code
table.set_cell_color(0, 0, "lightgrey")
table.set_border_color("black")
```

## Interactive Documentation
Check out the interactive API documentation at API Docs.

## License
This project is licensed under the terms of the MIT license.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "docugenr8",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "document-generation, PDF, font-customization, image-integration, coordinate-system, text-formatting, python",
    "author": null,
    "author_email": "Vladimir Jovanovic <vladimirjo@protonmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/80/f8/0a06c6735d3a36dfa98c7ebcdec74863c5282846d56b95f98416a115e9f7/docugenr8-0.0.18.tar.gz",
    "platform": null,
    "description": "# docugenr8: A Library for Generating Documents\n\ndocugenr8 is a Python library designed to help you generate various types of documents effortlessly. Currently, it supports creating PDF files, and work is underway to extend its capabilities to generate BMP, PNG, JPEG, TIFF, ODT, DOCX, and RTF documents.\n\n## Key Features\n\n- **Simple Global Settings**: Easily change global settings such as colors, fonts, and font sizes. No need to redefine these settings each time; the most recent settings are automatically applied to all new elements.\n- **Effortless Text Box Creation**: Create text boxes without worrying about text line placement. Text box horizontal alignment options: right, centered, left, and justified. Text box vertical alignment options: top, bottom, center, justified-between-lines, and justified-between-paragraphs.\n- **Advanced Paragraph Formatting**: Customize paragraph formatting with options like line height, tab size, word splitting, and indents.\n- **Page Numbers**: Insert page numbers (current page and total pages) anywhere in the text box. Use the standard numbering style or add a custom to match your need, like Roman.\n- **Linked Text Boxes**: Link text boxes together for continuous text flow. Create text boxes that span multiple pages, or write text in two or more columns on a single page.\n- **Table Creation and Customization**: Easily create and fill tables. Customize cell and border colors individually or by rows and columns.\n- **PDF Optimization**: Significantly reduce document size (up to 40 times) with font subsetting.\n- **Minimal Dependencies**: Currently, it only depends on fonttools. Work is underway to make it a zero-dependency library.\n\n## Structure\n\nThe docugenr8 library consists of three independent modules:\n\n### docugenr8-core\n\n- Generates the structure of the document.\n- Adds fonts and images for use in documents.\n- Defines document structure, including pages, shapes, images, tables, and text boxes.\n- Utilizes a coordinate system with x, y positions, width, and height.\n- Allows customization of font size, color, name, background, and border color.\n\n### docugenr8-shared\n\n- Defines data transfer objects (DTOs) to facilitate data transfer between modules.\n- Contains shared functions used across all modules.\n\n### docugenr8-pdf\n\n- Creates PDF files by reading DTOs created by the core module.\n- Implements font subsetting to significantly reduce file size.\n\n## Installation\n\nInstall docugenr8 using pip:\n\n```sh\npip install docugenr8\n```\n\n## Example\n\nCreate a PDF document with a text box and a table.\n\nCreate a file main.py with:\n\n```python\nfrom docugenr8.document import Document\n\n# Create a new document\ndoc = Document()\n\n# Add a font to the document, and define the name and location\n# This will automatically select the font for further use\ndoc.add_font(\"calibri\", \"./fonts/calibri.ttf\")\n\n# Add a page to the document. A4 has a standard width of 595.2 pixels and a height of 843.04.\ndoc.add_page(width=595.2, height=842.04)\n\n# Change the font size\ndoc.settings.font_size = 14\n\n# Create a text area with location and dimensions\ntext_area = doc.create_textarea(x=50, y=50, width=100, height=100)\n\n# Add some text to the text area\ntext_area.add_text(\"The quick brown fox jumped over the lazy dog. 1234567890\")\n\n# Add the text area to the first page of the document\ndoc.pages[0].add_content(text_area)\n\n# Output to pdf file\ndoc.output_to_file(\"pdf\", \"output.pdf\")\n```\n\n## Usage\nRun the script with:\n```sh\npython main.py\n```\n\nThis will generate a PDF file named output.pdf in the current directory.\n\n## Advanced Usage\n\n### Global Settings\n\nSet global settings for the document:\n\n```python\nfrom docugenr8.core import GlobalSettings\n\nGlobalSettings.set_color(\"blue\")\nGlobalSettings.set_font(\"Arial\")\nGlobalSettings.set_font_size(14)\n```\n\n### Linked Text Boxes\nLink text boxes for continuous text flow:\n\n```python\ntext_box1 = TextBox(x=50, y=700, width=500, height=100, text=\"Part 1\", font_size=12)\ntext_box2 = TextBox(x=50, y=600, width=500, height=100, text=\"Part 2\", font_size=12)\ntext_box1.link(text_box2)\ndoc.add_text_box(text_box1)\ndoc.add_text_box(text_box2)\n```\n\n### Table Customization\nCustomize table cells and borders:\n\n```python\nCopy code\ntable.set_cell_color(0, 0, \"lightgrey\")\ntable.set_border_color(\"black\")\n```\n\n## Interactive Documentation\nCheck out the interactive API documentation at API Docs.\n\n## License\nThis project is licensed under the terms of the MIT license.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Generates document with fonts, images, and elements using a coordinate system.",
    "version": "0.0.18",
    "project_urls": null,
    "split_keywords": [
        "document-generation",
        " pdf",
        " font-customization",
        " image-integration",
        " coordinate-system",
        " text-formatting",
        " python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "598010cc6147f5fa0f636be4f26986a6019d751b734c94358cf186af2eb5b6a3",
                "md5": "ce2608d8847321abd673ca5a078f328d",
                "sha256": "df25689470966caaa56fb1802f9fa6b9c99ea38358cefe234d62d1d64ea941ca"
            },
            "downloads": -1,
            "filename": "docugenr8-0.0.18-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ce2608d8847321abd673ca5a078f328d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 8129,
            "upload_time": "2024-06-23T21:33:02",
            "upload_time_iso_8601": "2024-06-23T21:33:02.324358Z",
            "url": "https://files.pythonhosted.org/packages/59/80/10cc6147f5fa0f636be4f26986a6019d751b734c94358cf186af2eb5b6a3/docugenr8-0.0.18-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "80f80a06c6735d3a36dfa98c7ebcdec74863c5282846d56b95f98416a115e9f7",
                "md5": "0ff609d66e73d384a607599b008a733b",
                "sha256": "40e98f4e52a8c47d0667523b17ccc46d705b20a3f20946d4adecd9c7e59a32e2"
            },
            "downloads": -1,
            "filename": "docugenr8-0.0.18.tar.gz",
            "has_sig": false,
            "md5_digest": "0ff609d66e73d384a607599b008a733b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 10248,
            "upload_time": "2024-06-23T21:33:04",
            "upload_time_iso_8601": "2024-06-23T21:33:04.148355Z",
            "url": "https://files.pythonhosted.org/packages/80/f8/0a06c6735d3a36dfa98c7ebcdec74863c5282846d56b95f98416a115e9f7/docugenr8-0.0.18.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-23 21:33:04",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "docugenr8"
}
        
Elapsed time: 0.47042s