About • Features • Layout • How to Run • Technologies • Contribute • License • Contributors
The pyloremgen library is a Python package designed to easily generate Lorem Ipsum text and create PDFs with Lorem Ipsum content. Lorem Ipsum is placeholder text commonly used in the printing and typesetting industry.
-
Lorem Ipsum Paragraphs: Generate Lorem Ipsum paragraphs effortlessly with the
paragraphsmethod. -
Random Words Generation: Create a string of random words using the
wordsmethod, allowing customization of the number of words. -
Shopping List Generation: Quickly generate a shopping list with randomly selected items using the
shopping_listmethod. -
PDF Generation: Create PDF documents with Lorem Ipsum content using the
PDFGeneratorclass. You can specify the number of pages and choose whether to include a cover page.
To use the pyloremgen library, you first need to install it. You can install it using pip:
pip install pyloremgenImport the LoremIpsum class and create an instance:
from pyloremgen.generator.lorem_text import LoremIpsum
lorem_generator = LoremIpsum()To generate Lorem Ipsum paragraphs, use the paragraphs method:
lorem_paragraphs = lorem_generator.paragraphs(paragraphs_numbers=3, size="medium", start_with_lorem_ipsum=True)
print(lorem_paragraphs)This will generate three Lorem Ipsum paragraphs, starting with the default "Lorem ipsum" text.
To generate a string of random words, use the words method:
lorem_words = lorem_generator.words(words_numbers=50)
print(lorem_words)This will generate a string containing 50 random words.
To generate a shopping list of randomly selected items, use the shopping_list method:
shopping_list = lorem_generator.shopping_list(items_count=5)
print(shopping_list)This will generate a shopping list with 5 randomly selected items.
Import the PDFGenerator class and create an instance:
from pyloremgen.generator.lorem_pdf import PDFGenerator
pdf_generator = PDFGenerator()To generate a PDF document, use the generate_pdf method:
pdf_generator.generate_pdf(filename="example.pdf", num_pages=5, cover_page_count=True)This will create a PDF named example.pdf with 5 pages, including a cover page.
Here are some additional examples:
# Example 1: Generating 2 paragraphs without starting with "Lorem ipsum"
lorem_text = lorem_generator.paragraphs(paragraphs_numbers=2, start_with_lorem_ipsum=False)
# Example 2: Generating a string of 20 random words
random_words = lorem_generator.words(words_numbers=20)
# Example 3: Generating a shopping list with 3 items
shopping_items = lorem_generator.shopping_list(items_count=3)
# Example 4: Generating a PDF with 3 pages and no cover page
pdf_generator.generate_pdf(filename="sample.pdf", num_pages=3, cover_page_count=False)Feel free to customize the parameters based on your needs.
- Python
reportlab(for PDF generation)pyloremgen(for Lorem Ipsum text generation)
Help the community make this project even more amazing. Read how to contribute by clicking here. I am convinced that together we will achieve incredible things!
This project is licensed under the MIT License.
💜 A big thanks 👏 to these folks who brought this project from the realm of ideas to execution!
Vitório Cavaleheiro 👨🚀 |