Use for creating, editing, extracting, OCRing, filling, and converting PDF documents.
from pypdf import PdfReader, PdfWriter
reader = PdfReader("document.pdf")
print(f"Pages: {len(reader.pages)}")
text = "".join(page.extract_text() or "" for page in reader.pages)
| Task | Tool | Details |
|---|---|---|
| Create PDF from scratch | ReportLab | libraries/reportlab.md [blocked] |
| Read / merge / split / rotate / encrypt | pypdf | — |
| Extract text and tables | pdfplumber | libraries/pdfplumber.md [blocked] |
| Render pages to images | pypdfium2 | libraries/pypdfium2.md [blocked] |
| Create/manipulate in JavaScript | pdf-lib | — |
| CLI merge/split/encrypt/optimize/repair | qpdf | libraries/cli-tools.md [blocked] |
| CLI text extraction | pdftotext | libraries/cli-tools.md [blocked] |
| CLI image extraction | pdfimages | libraries/cli-tools.md [blocked] |
| CLI page rendering | pdftoppm | libraries/cli-tools.md [blocked] |
| OCR scanned PDFs | pytesseract + pdf2image | Convert to images, then OCR |
| Fill PDF forms | pypdf or pdf-lib | form-filling.md [blocked] |
| Convert PDF to Word | pdf2docx (load docx skill) | See docx skill — Converting PDF to Word |
skills/design-foundations/SKILL.md for palette, fonts + PDF pairings, chart colors, and core principles (1 accent + neutrals, no decorative imagery, accessibility).skills/design-foundations/SKILL.md (PDF Pairings table + Font Strategy by Format). Default to a clean sans-serif (Inter, DM Sans, Work Sans)."Kortix" unless the user asks for a different organization or author namec.setTitle(...), c.setAuthor("Kortix") right after creating the canvas.
SimpleDocTemplate: pass title=..., author="Kortix" as constructor kwargs.
pdf-lib (JS): doc.setTitle(...), doc.setAuthor("Kortix").<super> tags, never Unicode superscripts)<a href> tag — never omit the URL or substitute a plain-text source name. See libraries/reportlab.md [blocked] (Source Citations) for the implementation pattern.<a href="..." color="blue"> markup. On the canvas, use canvas.linkURL(url, rect). See libraries/reportlab.md [blocked] (Hyperlinks).<sub> and <super> XML tags in Paragraph objects. For canvas text, manually adjust font size and y-offset. See libraries/reportlab.md [blocked] (Subscripts and Superscripts).pdftotext is the fastest option for plain text. Use pdfplumber when you need tables or coordinate data — don't use pypdf.extract_text() on large documents, it's slow.pdfimages extracts embedded images directly and is much faster than rendering whole pages. Only render with pypdfium2 or pdftoppm when you need a visual snapshot of the page layout.qpdf --split-pages to break up very large files before processing.pypdf to detect and decrypt (reader.is_encrypted / reader.decrypt(pw)). If you don't have the password, try qpdf --password=X --decrypt. Run qpdf --show-encryption to inspect what protection is applied.qpdf --check to diagnose structural problems, then qpdf --replace-input to attempt repair.import pytesseract
from pdf2image import convert_from_path
pages = convert_from_path("scan_output.pdf", dpi=300)
ocr_text = "\n\n".join(
f"--- Page {n} ---\n{pytesseract.image_to_string(pg)}"
for n, pg in enumerate(pages, 1)
)