blob: 90a6610938f5c280fc1f6fa9cf56fda0ea26c345 [file] [log] [blame]
#!/bin/sh -eu
in=$1
# Get absolute path to preserve relative links
abs_in=$(realpath "$in")
work_dir=$(dirname "$abs_in")
# Use Chrome with no shrinking, working from correct directory
cd "$work_dir"
R -e "pagedown::chrome_print('$(basename "$abs_in")',
options=list(
pageRanges='1',
paperWidth=33.11,
paperHeight=46.81,
marginTop=0,
marginBottom=0,
marginLeft=0,
marginRight=0,
printBackground=TRUE,
scale=0.98, # Compensate for ~2% print scaling
displayHeaderFooter=FALSE,
preferCSSPageSize=TRUE
),
extra_args = c(
'--disable-gpu',
'--no-sandbox',
'--disable-dev-shm-usage',
'--force-device-scale-factor=1',
'--disable-print-preview',
'--disable-background-timer-throttling',
'--allow-file-access-from-files',
'--force-color-profile=srgb',
'--disable-lcd-text',
'--disable-font-subpixel-positioning',
'--run-all-compositor-stages-before-draw'
)
)"