I process PDF files in an existing Perl framework. Some of the incoming files have very large page sizes. What I would like to do:
- Check if the input file's page size is larger than a specific format
f(A4/Letter) - If it is larger than
f: scale it down tof.
This is the corresponding command in Unix using GhostScript:
gs -sPAPERSIZE=a4 -dFIXEDMEDIA -dPSFitPage -o <outputFile> -sDEVICE=pdfwrite <inputFile>
Is there a way to do this within Perl, i.e. without requiring to call external tools? I checked the modules PDF and CAM::PDF, but the documentation does not really cover my issue and I couldn't find a straight-forward solution.