Home > OS >  Why is pagedown::chrome_print() converting a solid color html element to a gradient?
Why is pagedown::chrome_print() converting a solid color html element to a gradient?

Time:11-18

I am using the enter image description here

Pdf screenshot: enter image description here

CodePudding user response:

I was able reproduce the issue only on github document preview: Gradiant on side bar


But if I open the same pdf in other viewer like google docs cv, it renders fine. Let me know which PDF viewer are you using that renders the gradient?

To fix this put following CSS rule in dd_cv.css:

@page {
    background: 0% 0% / 100% 0.1% linear-gradient(to left, var(--sidebar-background-color) var(--sidebar-background-width), white var(--sidebar-background-width));
}

This is the fixed PDF https://github.com/OnkarRuikar/catblock/blob/master/test/cv_fixed.pdf

You'll notice that language skill bars are still showing gradients. For that you need to edit cv_printing_functions.R file and modify function print_skill_bars with similar gradient syntax. OR in cv.rmd file provide your own glue_templet argument to the method call CV %>% print_skill_bars(...)


I created the pdfs on following package versions:

# run following commands to get versions of installed packages required by the `datadrivencv`

 pkg = tibble::tibble(
   Package = names(installed.packages()[,3]),
   Version = unname(installed.packages()[,3])
 )
 dplyr::filter(pkg, Package %in% c("dplyr", "tidyr", "glue", "readr", "googlesheets4", "lubridate", " purrr", "stringr", "magrittr", "pagedown", "fs", "icon", "whisker", "knitr", "rmarkdown" ,"testthat"))

Following are the versions installed on my machine at the moment:
# A tibble: 15 x 2
   Package       Version
   <chr>         <chr>  
 1 dplyr         1.0.7  
 2 fs            1.5.0  
 3 glue          1.4.2  
 4 googlesheets4 1.0.0  
 5 icon          0.1.0  
 6 knitr         1.36   
 7 lubridate     1.8.0  
 8 magrittr      2.0.1  
 9 pagedown      0.15   
10 readr         2.1.0  
11 rmarkdown     2.11   
12 stringr       1.4.0  
13 testthat      3.1.0  
14 tidyr         1.1.4  
15 whisker       0.4    
 
  • Related