MCPcopy Create free account
hub / github.com/ActiveState/code / usage

Function usage

recipes/Python/576837_Crop_PDF_File_with_pyPdf/recipe-576837.py:9–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7from pyPdf import PdfFileWriter, PdfFileReader
8
9def usage ():
10 print """sjvr767\'s PDF Cropping Script.
11Example:
12my_pdf_crop.py -s -p 0.5 -i input.pdf -o output.pdf
13my_pdf_crop.py --skip --percent 0.5 -input input.pdf -output output.pdf
14\n
15REQUIRED OPTIONS:
16-p\t--percent
17The factor by which to crop. Must be positive and less than or equal to 1.
18
19-i\t--input
20The path to the file to be cropped.
21\n
22OPTIONAL:
23-s\t--skip
24Skip the first page. Ouptut file will not contain the first page of the input file.
25
26-o\t--output
27Specify the name and path of the output file. If none specified, the script appends \'cropped\' to the file name.
28
29-m\t--margin
30Specify additional absolute cropping, for fine tuning results.
31\t-m "left top right bottom"
32"""
33 sys.exit(0)
34
35def cut_length(dictionary, key, factor):
36 cut_factor = 1-factor

Callers 1

recipe-576837.pyFile · 0.70

Calls 1

exitMethod · 0.45

Tested by

no test coverage detected