Skip to content

Commit

Permalink
Render PDFs using decktape
Browse files Browse the repository at this point in the history
  • Loading branch information
royfrancis committed Oct 21, 2024
1 parent 9719544 commit d7f3458
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,15 @@ jobs:
docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v ${PWD}:/rmd ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE }} Rscript -e 'rmarkdown::render_site()'
# Generate PDFs
cd ${PATH_EXPORT}
#echo "Generating PDFs ..."
#docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v ${PWD}:/rmd ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE }} Rscript -e "l <- list.files('.',pattern='slide.+html');if(length(l)!=0) {for(i in 1:length(l)) pagedown::chrome_print(l[i],extra_args=c('--no-sandbox','--disable-dev-shm-usage','--disable-gpu'))};"
echo "Generating PDFs ..."
# docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v ${PWD}:/rmd ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE }} Rscript -e "l <- list.files('.',pattern='slide.+html');if(length(l)!=0) {for(i in 1:length(l)) pagedown::chrome_print(l[i],extra_args=c('--no-sandbox','--disable-dev-shm-usage','--disable-gpu'))};"
for html_file in slide_*.html; do
if [ -f "$html_file" ]; then
base_name="${html_file%.html}"
pdf_file="${base_name}.pdf"
docker run --rm -u "$(id -u "${USER}"):$(id -g "${USER}")" -v "${PWD}:/slides" astefanutti/decktape:3.12.0 "/slides/${html_file}" "/slides/${pdf_file}"
fi
done
cd ..
# Render canvas version of website by changing _site.yml
Expand Down Expand Up @@ -98,8 +105,15 @@ jobs:
cat temp > $i
rm -rf temp
done
#echo "Generating PDFs for HTML slides ..."
#docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v ${PWD}:/rmd ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE }} Rscript -e "l <- list.files('.',pattern='slide.+html');if(length(l)!=0) {for(i in 1:length(l)) pagedown::chrome_print(l[i],extra_args=c('--no-sandbox','--disable-dev-shm-usage','--disable-gpu'))};"
echo "Generating PDFs for HTML slides ..."
# docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v ${PWD}:/rmd ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE }} Rscript -e "l <- list.files('.',pattern='slide.+html');if(length(l)!=0) {for(i in 1:length(l)) pagedown::chrome_print(l[i],extra_args=c('--no-sandbox','--disable-dev-shm-usage','--disable-gpu'))};"
for html_file in slide_*.html; do
if [ -f "$html_file" ]; then
base_name="${html_file%.html}"
pdf_file="${base_name}.pdf"
docker run --rm -u "$(id -u "${USER}"):$(id -g "${USER}")" -v "${PWD}:/slides" astefanutti/decktape:3.12.0 "/slides/${html_file}" "/slides/${pdf_file}"
fi
done
cd ..
# List folder contents
Expand Down

0 comments on commit d7f3458

Please sign in to comment.