pdf-lambda-crop/auto-crop.py
2025-10-07 14:17:39 -04:00

17 lines
355 B
Python

import io
import sys
from cropper import AutoSettings, auto_crop
if len(sys.argv) < 2:
print("Usage: python test.py <pdf_path>")
sys.exit(1)
pdf_path = sys.argv[1]
with open(pdf_path, "rb") as fh:
content = io.BytesIO(fh.read())
buffer = auto_crop(content, AutoSettings())
with open("cropped.pdf", "wb") as fh:
fh.write(buffer.read())