dot-print_svg_with_chrome: Print an SVG file to pdf using chrome

.print_svg_with_chromeR Documentation

Print an SVG file to pdf using chrome

Description

Create a the same size as the SVG file using chrome or chromium

Usage

.print_svg_with_chrome(
  svgFile,
  pdfFile = tempfile(fileext = ".pdf"),
  chromeBinary = getOption("ggrrr.chrome", default = .find_chrome()),
  maxWidth = NULL,
  maxHeight = NULL
)

Arguments

svgFile

the input svg file

pdfFile

the output pdf file

chromeBinary

the location of chrome or chromium binary

maxWidth

the maximum width of the output in inches

maxHeight

the maximum height of the output in inches

Value

the pdf file path

Examples

try({
 plot = ggplot2::ggplot(ggplot2::diamonds, ggplot2::aes(x=carat,y=price,color = color))+
   ggplot2::geom_point()+
   ggplot2::annotate("label",x=2,y=10000,label="Hello \u2014 world", family="Kings")+
   ggplot2::labs(tag = "A")+
   ggplot2::xlab("Carat\u2082")+
   ggplot2::ylab("price\u2265")

 res = plot %>% .gg_save_as(filename=tempfile(), formats=c("svg"))
 tmp = .print_svg_with_chrome(res$svg)

 # browseURL(tmp)
 # The resulting pdf has fonts embedded.
})

terminological/ggrrr documentation built on June 15, 2024, 6:35 a.m.