algorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request…
Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.
$ npx -y skills add smallnest/goskills --skill pdf --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/pdfContext preview
The summary Claude sees to decide when to auto-load this skill.
Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.
name: pdf description: Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale. license: Proprietary. LICENSE.txt has complete terms
This guide covers essential PDF processing operations using Python libraries and command-line tools. For advanced features, JavaScript libraries, and detailed examples, see reference.md. If you need to fill out a PDF form, read forms.md and follow its instructions.
from pypdf import PdfReader, PdfWriter
# Read a PDF
reader = PdfReader("document.pdf")
print(f"Pages: {len(reader.pages)}")
# Extract text
text = ""
for page in reader.pages:
text += page.extract_text()from pypdf import PdfWriter, PdfReader
writer = PdfWriter()
for pdf_file in ["doc1.pdf", "doc2.pdf", "doc3.pdf"]:
reader = PdfReader(pdf_file)
for page in reader.pages:
writer.add_page(page)
with open("merged.pdf", "wb") as output:
writer.write(output)reader = PdfReader("input.pdf")
for i, page in enumerate(reader.pages):
writer = PdfWriter()
writer.add_page(page)
with open(f"page_{i+1}.pdf", "wb") as output:
writer.write(output)reader = PdfReader("document.pdf")
meta = reader.metadata
print(f"Title: {meta.title}")
print(f"Author: {meta.author}")
print(f"Subject: {meta.subject}")
print(f"Creator: {meta.creator}")reader = PdfReader("input.pdf")
writer = PdfWriter()
page = reader.pages[0]
page.rotate(90) # Rotate 90 degrees clockwise
writer.add_page(page)
with open("rotated.pdf", "wb") as output:
writer.write(output)import pdfplumber
with pdfplumber.open("document.pdf") as pdf:
for page in pdf.pages:
text = page.extract_text()
print(text)with pdfplumber.open("document.pdf") as pdf:
for i, page in enumerate(pdf.pages):
tables = page.extract_tables()
for j, table in enumerate(tables):
print(f"Table {j+1} on page {i+1}:")
for row in table:
print(row)import pandas as pd
with pdfplumber.open("document.pdf") as pdf:
all_tables = []
for page in pdf.pages:
tables = page.extract_tables()
for table in tables:
if table: # Check if table is not empty
df = pd.DataFrame(table[1:], columns=table[0])
all_tables.append(df)
# Combine all tables
if all_tables:
combined_df = pd.concat(all_tables, ignore_index=True)
combined_df.to_excel("extracted_tables.xlsx", index=False)from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas
c = canvas.Canvas("hello.pdf", pagesize=letter)
width, height = letter
# Add text
c.drawString(100, height - 100, "Hello World!")
c.drawString(100, height - 120, "This is a PDF created with reportlab")
# Add a line
c.line(100, height - 140, 400, height - 140)
# Save
c.save()from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak
from reportlab.lib.styles import getSampleStyleSheet
doc = SimpleDocTemplate("report.pdf", pagesize=letter)
styles = getSampleStyleSheet()
story = []
# Add content
title = Paragraph("Report Title", styles['Title'])
story.append(title)
story.append(Spacer(1, 12))
body = Paragraph("This is the body of the report. " * 20, styles['Normal'])
story.append(body)
story.append(PageBreak())
# Page 2
story.append(Paragraph("Page 2", styles['Heading1']))
story.append(Paragraph("Content for page 2", styles['Normal']))
# Build PDF
doc.build(story)from reportlab.lib.pagesizes import letter
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.platypus import Paragraph, SimpleDocTemplate, Spacer
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.lib.enums import TA_LEFT
import os
# 尝试多个可能的字体路径
font_candidates = [
'/System/Library/Fonts/PingFang.ttc',
'/System/Library/Fonts/Supplemental/Songti.ttc',
'/System/Library/Fonts/Supplemental/STSong.ttf',
'/System/Library/Fonts/Supplemental/Kaiti.ttc',
'/System/Library/Fonts/Supplemental/Arial Unicode.ttf',
'/Library/Fonts/Arial Unicode.ttf',
]
font_registered = False
for font_path in font_candidates:
if os.path.exists(font_path):
try:
pdfmetrics.registerFont(TTFont('ChineseFont', font_path))
print(f"✓ 成功加载字体: {font_path}")
font_registered = True
break
except Exception as e:
print(f"✗ 尝试加载 {font_path} 失败: {e}")
if not font_registered:
print("\n❌ 未找到可用字体,请运行字体查找代码")
print("或手动指定字体路径")
exit(1)
# Create PDF
doc = SimpleDocTemplate("红腹锦鸡保护报告.pdf", pagesize=letter)
styles = getSampleStyleSheet()
# 创建支持中文的样式
styles.add(ParagraphStyle(
name='ChineseTitle',
fontName='ChineseFont',
fontSize=24,
leading=30,
alignment=TA_LEFT
))
styles.add(ParagraphStyle(
name='ChineseHeading',
fontName='ChineseFont',
fontSize=16,
leading=20
))
styles.add(ParagraphStyle(
name='ChineseNormal',
fontName='ChineseFont',
fontSize=12,
leading=18
))
story = []
# Title
story.append(Paragraph("红腹锦鸡保护报告", styles['ChineseTitle']))
story.append(Spacer(1, 12))
# 1. 红腹锦鸡的基本介绍
story.append(Paragraph("1. 红腹锦鸡的基本介绍", styles['ChineseHeading']))
story.append(ParagA powerful command-line tool to parse, manage, and execute Claude Skill packages. GoSkills is designed according to the specifications found in the official Claude documentation.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request…
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React,…
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's…
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to…
Frontend-focused code review skill for React/TypeScript/Tailwind projects. Analyzes code quality, security vulnerabilities (XSS,…
调用扣子(Coze)智能体 API 进行对话、工作流执行等操作。当用户需要集成 Coze 智能体、调用 Coze API、或开发 Coze 相关应用时使用。支持流式和非流式对话、工作流调用等功能。