Test cases / pdf

deft pdf crop

Trim pages: --margin, --box, --auto

1 run on real files, 4 tests on generated files, not shown. 0 failed.

Real-file tasks

Real files and a plain-language job, from the agent benchmark. These are the reference answers, not an agent run.

Trim page marginsPassed

Cut 15mm off every side of the pages of paper.pdf and save the result as tight.pdf.

deft pdf crop paper.pdf --margin 15mm -o tight.pdf

Input

paper.pdf 992.5 KB · 14 pages
Page 1Page 2Page 3

Output

page.png 31.6 KB · 527x707
page.png
tight.pdf 936.0 KB · 14 pages
Page 1Page 2Page 3
Automatic checks (1)
  • python: code = "import subprocess\nfrom PIL import Image\nsubprocess.check_call(['gs', '-q', '-dSAFER', '-dBATCH', '-dNOPAUSE', '-dUseCropBox', '-sDEVICE=png16m', '-r72', '-dFirstPage=1', '-dLastPage=1', '-sOutputFile=page.png', 'tight.pdf'])\nw, h = Image.open('page.png').size\nassert abs(w - 527) <= 3 and abs(h - 707) <= 3, (w, h)\n"