Token导航 LogoToken导航

Agent Skill · 前端设计

reportlab(reportlab 搜索)

reportlab 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

reportlab 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证为 MIT,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 8,640。

总安装 269周安装 11GitHub Stars 508下载 87核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:reportlab(reportlab 搜索)
来源仓库:https://github.com/jimmc414/kosmos
仓库路径:skills/reportlab
安装命令:
npx skills add https://github.com/jimmc414/kosmos --skill reportlab
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/jimmc414/kosmos --skill reportlab

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

reportlab 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合整理项目状态与变更事项。它支持围绕仓库活动、代码提交和协作流程进行信息提取与组织,适用于开发协作场景。

通过 npx skills add 命令从指定 GitHub 仓库安装,需结合原始 README 核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写操作。reportlab 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/reportlab

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/jimmc414/kosmos --skill reportlab;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

reportlab 怎么安装?

在终端执行 npx skills add https://github.com/jimmc414/kosmos --skill reportlab。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

reportlab 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

reportlab 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

reportlab 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

reportlab 用的人多吗?

公开数据是累计安装 269 次,近一周安装 11 次,下载 87 次,GitHub 508 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

reportlab 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
reportlab

reportlab 搜索 · 本页

269508需要联网MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

ReportLab PDF Generation

Overview

ReportLab is a powerful Python library for programmatic PDF generation. Create anything from simple documents to complex reports with tables, charts, images, and interactive forms.

Two main approaches:

  • Canvas API (low-level): Direct drawing with coordinate-based positioning - use for precise layouts
  • Platypus (high-level): Flowing document layout with automatic page breaks - use for multi-page documents

Core capabilities:

  • Text with rich formatting and custom fonts
  • Tables with complex styling and cell spanning
  • Charts (bar, line, pie, area, scatter)
  • Barcodes and QR codes (Code128, EAN, QR, etc.)
  • Images with transparency
  • PDF features (links, bookmarks, forms, encryption)

Choosing the Right Approach

Use Canvas API when:

  • Creating labels, business cards, certificates
  • Precise positioning is critical (x, y coordinates)
  • Single-page documents or simple layouts
  • Drawing graphics, shapes, and custom designs
  • Adding barcodes or QR codes at specific locations

Use Platypus when:

  • Creating multi-page documents (reports, articles, books)
  • Content should flow automatically across pages
  • Need headers/footers that repeat on each page
  • Working with paragraphs that can split across pages
  • Building complex documents with table of contents

Use Both when:

  • Complex reports need both flowing content AND precise positioning
  • Adding headers/footers to Platypus documents (use onPage callback with Canvas)
  • Embedding custom graphics (Canvas) within flowing documents (Platypus)

Quick Start Examples

Simple Canvas Document

from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
from reportlab.lib.units import inch

c = canvas.Canvas("output.pdf", pagesize=letter)
width, height = letter

# Draw text
c.setFont("Helvetica-Bold", 24)
c.drawString(inch, height - inch, "Hello ReportLab!")

# Draw a rectangle
c.setFillColorRGB(0.2, 0.4, 0.8)
c.rect(inch, 5*inch, 4*inch, 2*inch, fill=1)

# Save
c.showPage()
c.save()

Simple Platypus Document

from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.units import inch

doc = SimpleDocTemplate("output.pdf", pagesize=letter)
story = []
styles = getSampleStyleSheet()

# Add content
story.append(Paragraph("Document Title", styles['Title']))
story.append(Spacer(1, 0.2*inch))
story.append(Paragraph("This is body text with <b>bold</b> and <i>italic</i>.", styles['BodyText']))

# Build PDF
doc.build(story)

Common Tasks

Creating Tables

Tables work with both Canvas (via Drawing) and Platypus (as Flowables):

from reportlab.platypus import Table, TableStyle
from reportlab.lib import colors
from reportlab.lib.units import inch

# Define data
data = [
    ['Product', 'Q1', 'Q2', 'Q3', 'Q4'],
    ['Widget A', '100', '150', '130', '180'],
    ['Widget B', '80', '120', '110', '160'],
]

# Create table
table = Table(data, colWidths=[2*inch, 1*inch, 1*inch, 1*inch, 1*inch])

# Apply styling
style = TableStyle([
    # Header row
    ('BACKGROUND', (0, 0), (-1, 0), colors.darkblue),
    ('TEXTCOLOR', (0, 0), (-1, 0), colors.whitesmoke),
    ('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
    ('ALIGN', (0, 0), (-1, -1), 'CENTER'),

    # Data rows
    ('ROWBACKGROUNDS', (0, 1), (-1, -1), [colors.white, colors.lightgrey]),
    ('GRID', (0, 0), (-1, -1), 1, colors.black),
])

table.setStyle(style)

# Add to Platypus story
story.append(table)

# Or draw on Canvas
table.wrapOn(c, width, height)
table.drawOn(c, x, y)

Detailed table reference: See references/tables_reference.md for cell spanning, borders, alignment, and advanced styling.

Creating Charts

Charts use the graphics framework and can be added to both Canvas and Platypus:

from reportlab.graphics.shapes import Drawing
from reportlab.graphics.charts.barcharts import VerticalBarChart
from reportlab.lib import colors

# Create drawing
drawing = Drawing(400, 200)

# Create chart
chart = VerticalBarChart()
chart.x = 50
chart.y = 50
chart.width = 300
chart.height = 125

# Set data
chart.data = [[100, 150, 130, 180, 140]]
chart.categoryAxis.categoryNames = ['Q1', 'Q2', 'Q3', 'Q4', 'Q5']

# Style
chart.bars[0].fillColor = colors.blue
chart.valueAxis.valueMin = 0
chart.valueAxis.valueMax = 200

# Add to drawing
drawing.add(chart)

# Use in Platypus
story.append(drawing)

# Or render directly to PDF
from reportlab.graphics import renderPDF
renderPDF.drawToFile(drawing, 'chart.pdf', 'Chart Title')

Available chart types: Bar (vertical/horizontal), Line, Pie, Area, Scatter Detailed charts reference: See references/charts_reference.md for all chart types, styling, legends, and customization.

Adding Barcodes and QR Codes

from reportlab.graphics.barcode import code128
from reportlab.graphics.barcode.qr import QrCodeWidget
from reportlab.graphics.shapes import Drawing
from reportlab.graphics import renderPDF

# Code128 barcode (general purpose)
barcode = code128.Code128("ABC123456789", barHeight=0.5*inch)

# On Canvas
barcode.drawOn(c, x, y)

# QR Code
qr = QrCodeWidget("https://example.com")
qr.barWidth = 2*inch
qr.barHeight = 2*inch

# Wrap in Drawing for Platypus
d = Drawing()
d.add(qr)
story.append(d)

Supported formats: Code128, Code39, EAN-13, EAN-8, UPC-A, ISBN, QR, Data Matrix, and 20+ more Detailed barcode reference: See references/barcodes_reference.md for all formats and usage examples.

Working with Text and Fonts

from reportlab.platypus import Paragraph
from reportlab.lib.styles import ParagraphStyle
from reportlab.lib.enums import TA_JUSTIFY

# Create custom style
custom_style = ParagraphStyle(
    'CustomStyle',
    fontSize=12,
    leading=14,           # Line spacing
    alignment=TA_JUSTIFY,
    spaceAfter=10,
    textColor=colors.black,
)

# Paragraph with inline formatting
text = """
This paragraph has <b>bold</b>, <i>italic</i>, and <u>underlined</u> text.
You can also use <font color="blue">colors</font> and <font size="14">different sizes</font>.
Chemical formula: H<sub>2</sub>O, Einstein: E=mc<sup>2</sup>
"""

para = Paragraph(text, custom_style)
story.append(para)

Using custom fonts:

from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont

# Register TrueType font
pdfmetrics.registerFont(TTFont('CustomFont', 'CustomFont.ttf'))

# Use in Canvas
c.setFont('CustomFont', 12)

# Use in Paragraph style
style = ParagraphStyle('Custom', fontName='CustomFont', fontSize=12)

Detailed text reference: See references/text_and_fonts.md for paragraph styles, font families, Asian languages, Greek letters, and formatting.

Adding Images

from reportlab.platypus import Image
from reportlab.lib.units import inch

# In Platypus
img = Image('photo.jpg', width=4*inch, height=3*inch)
story.append(img)

# Maintain aspect ratio
img = Image('photo.jpg', width=4*inch, height=3*inch, kind='proportional')

# In Canvas
c.drawImage('photo.jpg', x, y, width=4*inch, height=3*inch)

# With transparency (mask white background)
c.drawImage('logo.png', x, y, mask=[255,255,255,255,255,255])

Creating Forms

from reportlab.pdfgen import canvas
from reportlab.lib.colors import black, white, lightgrey

c = canvas.Canvas("form.pdf")

# Text field
c.acroForm.textfield(
    name="name",
    tooltip="Enter your name",
    x=100, y=700,
    width=200, height=20,
    borderColor=black,
    fillColor=lightgrey,
    forceBorder=True
)

# Checkbox
c.acroForm.checkbox(
    name="agree",
    x=100, y=650,
    size=20,
    buttonStyle='check',
    checked=False
)

# Dropdown
c.acroForm.choice(
    name="country",
    x=100, y=600,
    width=150, height=20,
    options=[("United States", "US"), ("Canada", "CA")],
    forceBorder=True
)

c.save()

Detailed PDF features reference: See references/pdf_features.md for forms, links, bookmarks, encryption, and metadata.

Headers and Footers

For Platypus documents, use page callbacks:

from reportlab.platypus import BaseDocTemplate, PageTemplate, Frame

def add_header_footer(canvas, doc):
    """Called on each page"""
    canvas.saveState()

    # Header
    canvas.setFont('Helvetica', 9)
    canvas.drawString(inch, height - 0.5*inch, "Document Title")

    # Footer
    canvas.drawRightString(width - inch, 0.5*inch, f"Page {doc.page}")

    canvas.restoreState()

# Set up document
doc = BaseDocTemplate("output.pdf")
frame = Frame(doc.leftMargin, doc.bottomMargin, doc.width, doc.height, id='normal')
template = PageTemplate(id='normal', frames=[frame], onPage=add_header_footer)
doc.addPageTemplates([template])

# Build with story
doc.build(story)

Helper Scripts

This skill includes helper scripts for common tasks:

Quick Document Generator

Use scripts/quick_document.py for rapid document creation:

from scripts.quick_document import create_simple_document, create_styled_table

# Simple document from content blocks
content = [
    {'type': 'heading', 'content': 'Introduction'},
    {'type': 'paragraph', 'content': 'Your text here...'},
    {'type': 'bullet', 'content': 'Bullet point'},
]

create_simple_document("output.pdf", "My Document", content_blocks=content)

# Styled tables with presets
data = [['Header1', 'Header2'], ['Data1', 'Data2']]
table = create_styled_table(data, style_name='striped')  # 'default', 'striped', 'minimal', 'report'

Template Examples

Complete working examples in assets/:

Invoice Template

assets/invoice_template.py - Professional invoice with:

  • Company and client information
  • Itemized table with calculations
  • Tax and totals
  • Terms and notes
  • Logo placement
from assets.invoice_template import create_invoice

create_invoice(
    filename="invoice.pdf",
    invoice_number="INV-2024-001",
    invoice_date="January 15, 2024",
    due_date="February 15, 2024",
    company_info={'name': 'Acme Corp', 'address': '...', 'phone': '...', 'email': '...'},
    client_info={'name': 'Client Name', ...},
    items=[
        {'description': 'Service', 'quantity': 1, 'unit_price': 500.00},
        ...
    ],
    tax_rate=0.08,
    notes="Thank you for your business!",
)

Report Template

assets/report_template.py - Multi-page business report with:

  • Cover page
  • Table of contents
  • Multiple sections with subsections
  • Charts and tables
  • Headers and footers
from assets.report_template import create_report

report_data = {
    'title': 'Quarterly Report',
    'subtitle': 'Q4 2023',
    'author': 'Analytics Team',
    'sections': [
        {
            'title': 'Executive Summary',
            'content': 'Report content...',
            'table_data': {...},
            'chart_data': {...}
        },
        ...
    ]
}

create_report("report.pdf", report_data)

Reference Documentation

Comprehensive API references organized by feature:

  • references/canvas_api.md - Low-level Canvas: drawing primitives, coordinates, transformations, state management, images, paths
  • references/platypus_guide.md - High-level Platypus: document templates, frames, flowables, page layouts, TOC
  • references/text_and_fonts.md - Text formatting: paragraph styles, inline markup, custom fonts, Asian languages, bullets, sequences
  • references/tables_reference.md - Tables: creation, styling, cell spanning, borders, alignment, colors, gradients
  • references/charts_reference.md - Charts: all chart types, data handling, axes, legends, colors, rendering
  • references/barcodes_reference.md - Barcodes: Code128, QR codes, EAN, UPC, postal codes, and 20+ formats
  • references/pdf_features.md - PDF features: links, bookmarks, forms, encryption, metadata, page transitions

Best Practices

Coordinate System (Canvas)

  • Origin (0, 0) is lower-left corner (not top-left)
  • Y-axis points upward
  • Units are in points (72 points = 1 inch)
  • Always specify page size explicitly
from reportlab.lib.pagesizes import letter
from reportlab.lib.units import inch

width, height = letter
margin = inch

# Top of page
y_top = height - margin

# Bottom of page
y_bottom = margin

Choosing Page Size

from reportlab.lib.pagesizes import letter, A4, landscape

# US Letter (8.5" x 11")
pagesize=letter

# ISO A4 (210mm x 297mm)
pagesize=A4

# Landscape
pagesize=landscape(letter)

# Custom
pagesize=(6*inch, 9*inch)

Performance Tips

  1. Use drawImage() over drawInlineImage() - caches images for reuse
  2. Enable compression for large files: canvas.Canvas("file.pdf", pageCompression=1)
  3. Reuse styles - create once, use throughout document
  4. Use Forms/XObjects for repeated graphics

Common Patterns

Centering text on Canvas:

text = "Centered Text"
text_width = c.stringWidth(text, "Helvetica", 12)
x = (width - text_width) / 2
c.drawString(x, y, text)

# Or use built-in
c.drawCentredString(width/2, y, text)

Page breaks in Platypus:

from reportlab.platypus import PageBreak

story.append(PageBreak())

Keep content together (no split):

from reportlab.platypus import KeepTogether

story.append(KeepTogether([
    heading,
    paragraph1,
    paragraph2,
]))

Alternate row colors:

style = TableStyle([
    ('ROWBACKGROUNDS', (0, 1), (-1, -1), [colors.white, colors.lightgrey]),
])

Troubleshooting

Text overlaps or disappears:

  • Check Y-coordinates - remember origin is bottom-left
  • Ensure text fits within page bounds
  • Verify leading (line spacing) is greater than fontSize

Table doesn't fit on page:

  • Reduce column widths
  • Decrease font size
  • Use landscape orientation
  • Enable table splitting with repeatRows

Barcode not scanning:

  • Increase barHeight (try 0.5 inch minimum)
  • Set quiet=1 for quiet zones
  • Test print quality (300+ DPI recommended)
  • Validate data format for barcode type

Font not found:

  • Register TrueType fonts with pdfmetrics.registerFont()
  • Use font family name exactly as registered
  • Check font file path is correct

Images have white background:

  • Use mask parameter to make white transparent
  • Provide RGB range to mask: mask=[255,255,255,255,255,255]
  • Or use PNG with alpha channel

Example Workflows

Creating an Invoice

  1. Start with invoice template from assets/invoice_template.py
  2. Customize company info, logo path
  3. Add items with descriptions, quantities, prices
  4. Set tax rate if applicable
  5. Add notes and payment terms
  6. Generate PDF

Creating a Report

  1. Start with report template from assets/report_template.py
  2. Define sections with titles and content
  3. Add tables for data using create_styled_table()
  4. Add charts using graphics framework
  5. Build with doc.multiBuild(story) for TOC

Creating a Certificate

  1. Use Canvas API for precise positioning
  2. Load custom fonts for elegant typography
  3. Add border graphics or image background
  4. Position text elements (name, date, achievement)
  5. Optional: Add QR code for verification

Creating Labels with Barcodes

  1. Use Canvas with custom page size (label dimensions)
  2. Calculate grid positions for multiple labels per page
  3. Draw label content (text, images)
  4. Add barcode at specific position
  5. Use showPage() between labels or grids

Installation

uv pip install reportlab

# For image support
uv pip install pillow

# For charts
uv pip install reportlab[renderPM]

# For barcode support (included in reportlab)
# QR codes require: uv pip install qrcode

When to Use This Skill

This skill should be used when:

  • Generating PDF documents programmatically
  • Creating invoices, receipts, or billing documents
  • Building reports with tables and charts
  • Generating certificates, badges, or credentials
  • Creating shipping labels or product labels with barcodes
  • Designing forms or fillable PDFs
  • Producing multi-page documents with consistent formatting
  • Converting data to PDF format for archival or distribution
  • Creating custom layouts that require precise positioning

This skill provides comprehensive guidance for all ReportLab capabilities, from simple documents to complex multi-page reports with charts, tables, and interactive elements.

平台分布

Claude Code

29.36%
按下载量换算26

windsurf

23.66%
按下载量换算21

OpenCode

19.56%
按下载量换算17

Codex

12.9%
按下载量换算11

Antigravity

7.45%
按下载量换算6

Gemini CLI

3.76%
按下载量换算3

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills