Resize PDF on Upload

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • czcpf
    Senior Member
    • Aug 2022
    • 160

    Resize PDF on Upload

    Hello,

    I would like to resize any PDF a user uploads through fields like file within ESPO to keep things consistent across my application.

    I was considering using ghostscript and executing in in shell command via php : (maybe there is an alternative somehow using built in pdf engine of espo ?

    gs \

    -o output.pdf \

    -sDEVICE=pdfwrite \

    -sPAPERSIZE=letter \

    -dFIXEDMEDIA \

    -dPDFFitPage \

    -dCompatibilityLevel=1.4 \

    input.pdf

    In any case, I'm wondering is there a hook or where I should hook into the upload script backend ie:

    pseudo php:

    check if file type being uploaded is pdf
    resize pdf to letter and save attachment as normal.


    Now that I'm writing this, it might be easier to implement some cron job that resizes all my PDF's as well. So for that, I would just need to know if either of the build-in pdf engine in espo has a resize capability.
Working...