#!/usr/bin/env python
#
# Take a USPS click-n-ship label and cut off half the page (instructions).
# This is useful to not waste 2x1 labels.
#
import copy, sys
from pyPdf import PdfFileWriter, PdfFileReader
input = PdfFileReader(sys.stdin)
output = PdfFileWriter()
for p in [input.getPage(i) for i in range(0,input.getNumPages())]:
(w, h) = p.mediaBox.upperRight
p.mediaBox.lowerRight = (w, h/2)
output.addPage(p)
output.write(sys.stdout)