pdfExtract

Extract selected 1-based page numbers from the first selected PDF. If source is omitted, the first discovered PDF in the current working folder is used.

Function

pdfExtract(pages, output_file="extracted.pdf", source=None)

Parameters

pages

Type: iterable of int

Page numbers using normal human numbering: the first page is `1`. Every page number must be a positive integer and must exist in the selected PDF.

output_file

Type: str, default "extracted.pdf"

Name of the extracted PDF. The file is written inside `extracted pdfs/`.

source

Type: path, iterable of paths, or None

Optional explicit PDF input. When several are supplied, the first one is used, matching the function's single-input behavior.

Returns

A `Path` pointing to the extracted PDF, or `None` when no PDFs are found.

Examples

Extract pages from the first discovered PDF

pdfExtract([1, 2, 5])

Use a specific PDF

pdfExtract([1, 2], source="report.pdf")

Extract from a merged result

pdfExtract([1, 3], source=pdfMerge())

Dynamic input behavior

When source is omitted, Toolvix discovers matching files in the current working folder. When source is supplied, only the supplied files are processed. This makes nested pipelines deterministic.

Back to function index · Nesting and chaining