create headless_homebrew_pdf.sh for local use

main
Bel LaPointe 2023-10-19 10:17:40 -06:00
parent 8e119c59e0
commit 7ca8071baf
3 changed files with 38 additions and 29 deletions

View File

@ -23,35 +23,8 @@ rm -rf $outdir
mkdir -p $outdir/public
cp homebrew/homebrew.html $outdir/public/index.html
cp -r ./homebrew/fonts $outdir/public/
echo PRINTING PDF
echo ...which google
which google-chrome-stable
echo ...which miniserve
which miniserve
miniserve $outdir/public &
pid=${!}
until curl localhost:8080; do sleep 5; done
google-chrome-stable \
--no-sandbox \
--headless \
--disable-gpu \
--print-to-pdf=$outdir/public/BreeLaPointeResume.pdf \
--run-all-compositor-stages-before-draw \
--no-pdf-header-footer \
http://localhost:8080/index.html
get_state() {
cksum $outdir/public/BreeLaPointeResume.pdf | awk '{print $1}'
}
state=$(get_state)
while true; do
sleep 5
if [ "$state" == "$(get_state)" ]; then
break
fi
done
kill $pid || true
echo; ls $outdir/public/BreeLaPointeResume.pdf
cp homebrew/homebrew.pdf $outdir/public/BreeLaPointeResume.pdf
ls $outdir/public/BreeLaPointeResume.pdf
(
if ! which woff2_compress; then

36
headless_homebrew_pdf.sh Normal file
View File

@ -0,0 +1,36 @@
#! /bin/sh
set -o pipefail
set -e
set -u
cd src
echo PRINTING PDF
echo ...which google
which google-chrome-stable
echo ...which miniserve
which miniserve
miniserve ./homebrew/ &
pid=${!}
until curl localhost:8080; do sleep 5; done
google-chrome-stable \
--no-sandbox \
--headless \
--disable-gpu \
--print-to-pdf=./homebrew/homebrew.pdf \
--run-all-compositor-stages-before-draw \
--no-pdf-header-footer \
http://localhost:8080/homebrew.html
get_state() {
cksum ./homebrew/homebrew.pdf | awk '{print $1}'
}
state=$(get_state)
while true; do
sleep 5
if [ "$state" == "$(get_state)" ]; then
break
fi
done
kill $pid || true
echo

Binary file not shown.