public function crop($inputPDFPath, $outputPDFPath, $padding = 10, $x2 = null, $y1 = null, $y2 = null)
    {
        $inputDoc = new \PDFDoc($inputPDFPath);
        $inputDoc->InitSecurityHandler();

        $iterator = $inputDoc->GetPageIterator();
        for ($iterator; $iterator->HasNext(); $iterator->Next()) {
            $mediaBox = new \Rect($iterator->Current()->GetMediaBox());

            $mediaBox->x1 += $padding;
            $mediaBox->x2 -= empty($x2) ? $padding : $x2;
            $mediaBox->y1 += empty($y1) ? $padding : $y1;
            $mediaBox->y2 -= empty($y2) ? $padding : $y2;

            $mediaBox->Update();
        }

        $inputDoc->Save($outputPDFPath, 0);
        $inputDoc->Close();
    }