Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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.
The docugenr8 library consists of three independent modules:
Install docugenr8 using pip:
pip install docugenr8
Create a PDF document with a text box and a table.
Create a file main.py with:
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")
Run the script with:
python main.py
This will generate a PDF file named output.pdf in the current directory.
Set global settings for the document:
from docugenr8.core import GlobalSettings
GlobalSettings.set_color("blue")
GlobalSettings.set_font("Arial")
GlobalSettings.set_font_size(14)
Link text boxes for continuous text flow:
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)
Customize table cells and borders:
Copy code
table.set_cell_color(0, 0, "lightgrey")
table.set_border_color("black")
Check out the interactive API documentation at API Docs.
This project is licensed under the terms of the MIT license.
FAQs
Generates document with fonts, images, and elements using a coordinate system.
We found that docugenr8 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.