Files
html-to-pdf/gen.sh
2026-01-20 20:24:13 -07:00

27 lines
632 B
Bash
Executable File

DEV="192.168.1.179"
USER="chrome"
CHROME="/home/chrome/chrome/linux-144.0.7559.96/chrome-linux64/chrome"
KEYFILE="chrome"
if [[ -z $1 ]]; then
echo Requires argument
exit 1
fi
PRINT=""
if [[ $(printf $1 | tail -c 4) = "html" ]]; then
scp -i $KEYFILE $1 $USER@$DEV:/tmp/input.html
echo html;
PRINT="/tmp/input.html"
else
# This might be a bad idea, idk
echo Assuming argument 1 is a url: $1
PRINT=$1
fi
scp -i $KEYFILE -r extension $USER@$DEV:~/
ssh -i $KEYFILE $USER@$DEV $CHROME --headless=new --no-pdf-header-footer --print-to-pdf --load-extension="/home/$USER/extension" $PRINT
scp -i $KEYFILE $USER@$DEV:~/*.pdf ./