Yes, if you add a bigger page at the beginning of the pdf, it doesn't crop anymore. I've seen this bug for a long time, though
Python hack to add an empty page with size of biggest page in pdf.
PyPDF2 needed:
https://github.com/mstamy2/PyPDF2
Code:
import PyPDF2
import sys
ifile = sys.argv[1]
pdfinput = PyPDF2.PdfFileReader(open(ifile, "rb"))
pdfoutput = PyPDF2.PdfFileWriter()
print pdfinput.getDocumentInfo()
n = pdfinput.getNumPages()
maxw = 0
maxh = 0
page0 = pdfinput.getPage(0)
for i in range(n):
page = pdfinput.getPage(i)
w = page.cropBox.getWidth()
h = page.cropBox.getHeight()
if w > maxw: maxw = w
if h > maxh: maxh = h
print maxw, maxh
firstpage = page0.createBlankPage(None,float(maxw),float(maxh))
print "writing ..."
pdfoutput.addPage(firstpage)
for i in range(n):
page = pdfinput.getPage(i)
pdfoutput.addPage(page)
# finally, write "output" to document-output.pdf
outputStream = file("document-output.pdf", "wb")
pdfoutput.write(outputStream)