5 Commits

Author SHA1 Message Date
Bel LaPointe
91799b978a oh gen 2023-10-19 10:30:43 -06:00
Bel LaPointe
abf22cc58b ohhhh closing curly 2023-10-19 10:27:35 -06:00
Bel LaPointe
7bc307d28c whitespace 2023-10-19 10:25:59 -06:00
Bel LaPointe
1d25cbcfb3 oop 2023-10-19 10:25:26 -06:00
Bel LaPointe
7ca8071baf create headless_homebrew_pdf.sh for local use 2023-10-19 10:17:40 -06:00
6 changed files with 43 additions and 32 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
@@ -73,6 +46,9 @@ echo; ls $outdir/public/BreeLaPointeResume.pdf
echo asserting ${basename_f%.ttf}.woff2
grep -R "${basename_f%.ttf}.woff2" "$outdir/public"
done
find "$outdir/public" -type f | grep -v public.fonts | while read -r f; do
sed -i 's#type="font/ttf"#type="font/woff2"#g' "$f"
done
du -sh "$outdir/public/fonts/"*
)

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

View File

@@ -5,7 +5,7 @@
<link rel="preload" as="font" href="./fonts/Lato-Bold.ttf" type="font/ttf" crossorigin="anonymous">
</link>
<style>
@media print { .no-print, .no-print * { visibility: hidden !important; }
@media print { .no-print, .no-print * { visibility: hidden !important; } }
@font-face {font-family: "Roboto"; src: url("./fonts/Roboto-Regular.ttf");}
@font-face {font-family: "Roboto"; src: url("./fonts/Roboto-Bold.ttf"); font-weight: bold;}@font-face {font-family: "Lato"; src: url("./fonts/Lato-Regular.ttf");}
@font-face {font-family: "Lato"; src: url("./fonts/Lato-Bold.ttf"); font-weight: bold;}@font-face {font-family: "Montserrat"; src: url("./fonts/Montserrat-Regular.ttf");}

Binary file not shown.

View File

@@ -5,7 +5,7 @@
<link rel="preload" as="font" href="./fonts/Lato-Bold.ttf" type="font/ttf" crossorigin="anonymous">
</link>
<style>
@media print { .no-print, .no-print * { visibility: hidden !important; }
@media print { .no-print, .no-print * { visibility: hidden !important; } }
@font-face {font-family: "Roboto"; src: url("./fonts/Roboto-Regular.ttf");}
@font-face {font-family: "Roboto"; src: url("./fonts/Roboto-Bold.ttf"); font-weight: bold;}@font-face {font-family: "Lato"; src: url("./fonts/Lato-Regular.ttf");}
@font-face {font-family: "Lato"; src: url("./fonts/Lato-Bold.ttf"); font-weight: bold;}@font-face {font-family: "Montserrat"; src: url("./fonts/Montserrat-Regular.ttf");}

View File

@@ -63,4 +63,3 @@ resume:
- 'Platforms: Docker, Hashicorp, Linux/Unix, AWS, Jenkins, REST, Microservices, Git'
- 'Datastores: MongoDB, Redis, S3, Couchbase, DynamoDB'