Title: | Paginate the HTML Output of R Markdown with CSS for Print |
---|---|
Description: | Use the paged media properties in CSS and the JavaScript library 'paged.js' to split the content of an HTML document into discrete pages. Each page can have its page size, page numbers, margin boxes, and running headers, etc. Applications of this package include books, letters, reports, papers, business cards, resumes, and posters. |
Authors: | Yihui Xie [aut, cre] , Romain Lesur [aut, cph] , Christophe Dervieux [ctb] , Brent Thorne [aut] , Xianying Tan [aut] , Atsushi Yasumoto [ctb] , Posit Software, PBC [cph, fnd], Adam Hyde [ctb] (paged.js in resources/js/), Min-Zhong Lu [ctb] (resume.css in resources/css/), Zulko [ctb] (poster-relaxed.css in resources/css/) |
Maintainer: | Yihui Xie <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.21.1 |
Built: | 2024-10-11 16:18:10 UTC |
Source: | https://github.com/rstudio/pagedown |
This output format is similar to html_paged
. The only
difference is in the default stylesheets.
book_crc(..., css = c("crc-page", "default-page", "default", "crc"))
book_crc(..., css = c("crc-page", "default-page", "default", "crc"))
... , css
|
Arguments passed to |
An R Markdown output format.
This output format is based on an example in the Github repo https://github.com/RelaxedJS/ReLaXed-examples. See https://pagedown.rbind.io/business-card/ for an example.
business_card(template = pkg_resource("html", "card.html"))
business_card(template = pkg_resource("html", "card.html"))
template |
The path to the Pandoc template to convert Markdown to HTML. |
An R Markdown output format.
pagedown::business_card()
pagedown::business_card()
Print an HTML page to PDF or capture a PNG/JPEG screenshot through the Chrome DevTools Protocol. Google Chrome or Microsoft Edge (or Chromium on Linux) must be installed prior to using this function.
chrome_print( input, output = xfun::with_ext(input, format), wait = 2, browser = "google-chrome", format = c("pdf", "png", "jpeg"), options = list(), selector = "body", box_model = c("border", "content", "margin", "padding"), scale = 1, work_dir = tempfile(), timeout = 30, extra_args = c("--disable-gpu"), verbose = 0, async = FALSE, outline = gs_available(), encoding )
chrome_print( input, output = xfun::with_ext(input, format), wait = 2, browser = "google-chrome", format = c("pdf", "png", "jpeg"), options = list(), selector = "body", box_model = c("border", "content", "margin", "padding"), scale = 1, work_dir = tempfile(), timeout = 30, extra_args = c("--disable-gpu"), verbose = 0, async = FALSE, outline = gs_available(), encoding )
input |
A URL or local file path to an HTML page, or a path to a local
file that can be rendered to HTML via |
output |
The output filename. For a local web page ‘foo/bar.html’, the default PDF output is ‘foo/bar.pdf’; for a remote URL ‘https://www.example.org/foo/bar.html’, the default output will be ‘bar.pdf’ under the current working directory. The same rules apply for screenshots. |
wait |
The number of seconds to wait for the page to load before printing (in certain cases, the page may not be immediately ready for printing, especially there are JavaScript applications on the page, so you may need to wait for a longer time). |
browser |
Path to Google Chrome, Microsoft Edge or Chromium. This
function will try to find it automatically via |
format |
The output format. |
options |
A list of page options. See
|
selector |
A CSS selector used when capturing a screenshot. |
box_model |
The CSS box model used when capturing a screenshot. |
scale |
The scale factor used for screenshot. |
work_dir |
Name of headless Chrome working directory. If the default temporary directory doesn't work, you may try to use a subdirectory of your home directory. |
timeout |
The number of seconds before canceling the document generation. Use a larger value if the document takes longer to build. |
extra_args |
Extra command-line arguments to be passed to Chrome. |
verbose |
Level of verbosity: |
async |
Execute |
outline |
If not |
encoding |
Not used. This argument is required by RStudio IDE. |
Path of the output file (invisibly). If async
is TRUE
,
this is a promise
value.
https://developer.chrome.com/blog/headless-chrome/
On Windows, this function tries to find Chrome or Edge from the registry. On
macOS, it returns a hard-coded path of Chrome under ‘/Applications’. On
Linux, it searches for chromium-browser
and google-chrome
from the system's PATH variable.
find_chrome()
find_chrome()
A character string.
This output format is similar to html_paged
. The only differences are
in the default stylesheets and the default value of the fig_caption
parameter which is set to FALSE
. See
https://pagedown.rbind.io/html-letter/ for an example.
html_letter(..., css = c("default", "letter"), fig_caption = FALSE)
html_letter(..., css = c("default", "letter"), fig_caption = FALSE)
... , css , fig_caption
|
Arguments passed to |
An R Markdown output format.
This is an output format based on bookdown::html_document2
(which
means you can use those Markdown features added by bookdown). The HTML
output document is split into multiple pages via a JavaScript library
paged.js. These pages contain elements commonly seen in PDF documents,
such as page numbers and running headers.
html_paged( ..., css = c("default-fonts", "default-page", "default"), theme = NULL, template = pkg_resource("html", "paged.html"), csl = NULL, front_cover = NULL, back_cover = NULL )
html_paged( ..., css = c("default-fonts", "default-page", "default"), theme = NULL, template = pkg_resource("html", "paged.html"), csl = NULL, front_cover = NULL, back_cover = NULL )
... |
Arguments passed to
|
css |
A character vector of CSS and Sass file paths. If a path
does not contain the ‘.css’, ‘.sass’, or ‘.scss’ extension,
it is assumed to be a built-in CSS file. For example, |
theme |
The Bootstrap theme. By default, Bootstrap is not used. |
template |
The path to the Pandoc template to convert Markdown to HTML. |
csl |
The path of the Citation Style Language (CSL) file used to format citations and references (see the Pandoc documentation). |
front_cover , back_cover
|
Paths or urls to image files to be used as front or back covers. Theses images are available through CSS variables (see Details). |
When a path or an url is passed to the front_cover
or back_cover
argument, several CSS variables are created. They are named --front-cover
and --back-cover
and can be used as value for the CSS property background-image
.
For example, background-image: var(--front-cover);
. When a vector of
paths or urls is used as a value for front_cover
or back_cover
,
the CSS variables are suffixed with an index: --front-cover-1
,
--front-cover-2
, etc.
An R Markdown output format.
This output format is based on Min-Zhong Lu's HTML/CSS in the Github repo https://github.com/mnjul/html-resume. See https://pagedown.rbind.io/html-resume/ for an example.
html_resume( ..., css = "resume", template = pkg_resource("html", "resume.html"), number_sections = FALSE, fig_caption = FALSE )
html_resume( ..., css = "resume", template = pkg_resource("html", "resume.html"), number_sections = FALSE, fig_caption = FALSE )
... , css , template , number_sections , fig_caption
|
See
|
An R Markdown output format.
This output format is similar to html_paged
.
jss_paged( ..., css = c("jss-fonts", "jss-page", "jss"), template = pkg_resource("html", "jss_paged.html"), csl = pkg_resource("csl", "journal-of-statistical-software.csl"), highlight = NULL, pandoc_args = NULL )
jss_paged( ..., css = c("jss-fonts", "jss-page", "jss"), template = pkg_resource("html", "jss_paged.html"), csl = pkg_resource("csl", "journal-of-statistical-software.csl"), highlight = NULL, pandoc_args = NULL )
... , css , template , csl , highlight , pandoc_args
|
Arguments passed to |
An R Markdown output format.
The output format poster_relaxed()
is based on an example in the
Github repo https://github.com/RelaxedJS/ReLaXed-examples. See
https://pagedown.rbind.io/poster-relaxed/ for an example.
The output format poster_jacobs()
mimics the style of the
“Jacobs Landscape Poster LaTeX Template Version 1.0” at
https://www.overleaf.com/gallery/tagged/poster. See
https://pagedown.rbind.io/poster-jacobs/ for an example.
poster_relaxed( ..., css = "poster-relaxed", template = pkg_resource("html", "poster-relaxed.html"), number_sections = FALSE ) poster_jacobs( ..., css = "poster-jacobs", template = pkg_resource("html", "poster-jacobs.html") )
poster_relaxed( ..., css = "poster-relaxed", template = pkg_resource("html", "poster-relaxed.html"), number_sections = FALSE ) poster_jacobs( ..., css = "poster-jacobs", template = pkg_resource("html", "poster-jacobs.html") )
... , css , template , number_sections
|
See |
An R Markdown output format.
This output format is similar to html_paged
. The only
difference is in the default stylesheets and Pandoc template. See
https://pagedown.rbind.io/thesis-paged/ for an example.
thesis_paged( ..., css = c("thesis"), template = pkg_resource("html", "thesis.html") )
thesis_paged( ..., css = c("thesis"), template = pkg_resource("html", "thesis.html") )
... , css , template
|
Arguments passed to |
An R Markdown output format.