Skip to content

chrome_print() landscape = T not resizing HTML Widget on print? #325

@andrew-fuller

Description

@andrew-fuller

Hello.

I am creating a report in my R Shiny app that sends parameters to knit a html file and then runs chrome_print() on that to convert it to a PDF. The reason it is done this way is because I want to send my echarts4r widgets as parameters to save compute time and maintain SVG lossless quality.

The issue I am having is that when I set landscape = T it does not seem to adjust the widget to the width of the print area. It does print to the correct width when performing the operation manually through a non headless browser.

Here is a minimal example below:

R Markdown

---
title: "Untitled"
author: "fullera"
date: "`r Sys.Date()`"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
Output the plot

mtcars |>
  e_charts(cyl,renderer = 'svg') |>
  e_line(mpg) |> e_animation(show = F)

R Code

library(echarts4r)
library(pagedown)


pagedown::chrome_print(input = 'untitled.html', output = 'foo.pdf', options = list(landscape=T))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions