All Projects → RLesur → weasydoc

RLesur / weasydoc

Licence: GPL-3.0 license
Convert R Markdown to PDF Using Weasyprint (or Prince XML)

Programming Languages

r
7636 projects
HTML
75241 projects
Dockerfile
14818 projects
lua
6591 projects
CSS
56736 projects

Projects that are alternatives of or similar to weasydoc

reportfactory
Lightweight infrastructure to handle multiple rmarkdown reports
Stars: ✭ 68 (+70%)
Mutual labels:  rmarkdown, rmarkdown-document
fabricerin
Create Easily Canvas in Shiny and RMarkdown Documents
Stars: ✭ 52 (+30%)
Mutual labels:  rmarkdown, rmarkdown-document
bubblyr
☁️ ☁️ ☁️ Beautiful Bubbles in Shiny and RMarkdown Backgrounds
Stars: ✭ 16 (-60%)
Mutual labels:  rmarkdown, rmarkdown-document
Android-XML-to-PDF-Generator
This library is for convert XML to PDF very easily using Step Builders Pattern
Stars: ✭ 140 (+250%)
Mutual labels:  pdf-generation
umdoc
A Markdown to LaTeX to PDF converter
Stars: ✭ 15 (-62.5%)
Mutual labels:  pdf-generation
casile
The CaSILE toolkit, a book publishing workflow employing SILE and other wizardry.
Stars: ✭ 36 (-10%)
Mutual labels:  pdf-generation
cefHtmlSnapshot
Command-line utility for Windows take snapshots of HTML pages and save them as images or PDF
Stars: ✭ 23 (-42.5%)
Mutual labels:  pdf-generation
pdftron-android-samples
PDFTron Android Samples
Stars: ✭ 30 (-25%)
Mutual labels:  pdf-generation
ReproducibleScience
Short course on reproducible science: what, why, how
Stars: ✭ 23 (-42.5%)
Mutual labels:  rmarkdown
elasticsearch-report-engine
An Elasticsearch plugin to return query results as either PDF,HTML or CSV.
Stars: ✭ 49 (+22.5%)
Mutual labels:  pdf-generation
fossos
seminar series on data science, reproducible science and open source by @maxheld83
Stars: ✭ 13 (-67.5%)
Mutual labels:  rmarkdown
chromic pdf
Convenient HTML to PDF/A rendering library for Elixir based on Chrome & Ghostscript
Stars: ✭ 196 (+390%)
Mutual labels:  pdf-generation
javascript
Basic Primitives Diagrams for JavaScript - data visualization components library that implements organizational chart and multi-parent dependency diagrams, contains implementations of JavaScript Controls and PDF rendering plugins.
Stars: ✭ 46 (+15%)
Mutual labels:  pdf-generation
xaringan slides
📺 Links to HTML5 presentations made using the R package {xaringan}.
Stars: ✭ 20 (-50%)
Mutual labels:  rmarkdown
rcpp-api
Source for the Unofficial Rcpp API Documentation
Stars: ✭ 42 (+5%)
Mutual labels:  rmarkdown
armcompanion
Companion materials for the rstudio::conf 2019 Advanced R Markdown workshop
Stars: ✭ 15 (-62.5%)
Mutual labels:  rmarkdown
laravel-browsershot
Browsershot wrapper for Laravel 5
Stars: ✭ 108 (+170%)
Mutual labels:  pdf-generation
uiucthemes
RMarkdown Templates for UIUC Theme-Oriented Documents
Stars: ✭ 45 (+12.5%)
Mutual labels:  rmarkdown
docraptor-ruby
A native Ruby client for the DocRaptor HTML to PDF generation API
Stars: ✭ 20 (-50%)
Mutual labels:  pdf-generation
linguisticsdown
Easy Linguistics Document Writing with R Markdown
Stars: ✭ 24 (-40%)
Mutual labels:  rmarkdown

weasydoc

lifecycle Travis build status Coverage status CRAN status

Work In Progress. Do Not Use in Production Yet!

The goal of weasydoc is to convert R Markdown to PDF using WeasyPrint or Prince with CSS for Paged Media.

Motivation

The usual way to convert R Markdown documents to PDF relies on LaTeX.
In order to customize the rendered document, you have to pass the painful LaTeX learning curve.

Since pandoc version 2 supports PDF generation through HTML+CSS, formatting PDF document can now be achieved through CSS. For those who already know HTML and CSS, learning CSS for Paged Media is quite easy.

What is CSS for Paged Media?

In industry, printed document are commonly designed with publishing softwares like Microsoft Publisher, Adobe InDesign® or Scribus.

CSS for Paged Media can mainly be understood as an alternative for these publishing softwares: it allows conversion from HTML to PDF using CSS rules.

The CSS for Paged Media Standard

The CSS for Paged Media standard is a subset of the W3C CSS specifications:

CSS for Paged Media Converters

Some important features of CSS for Paged Media are not implemented by the top browsers in use. So, you cannot rely on browsers (or headless browsers) to generate a PDF file from HTML using CSS for Paged Media: you have to install a converter that implements the CSS for Paged Media standard.
The great print-css.rocks website by Andreas Jung (@zopyx) offers a comprehensive list of converters using CSS for Paged Media.

Note: a very promising project of the Paged Media initiative named Paged.js proposes a polyfill for Paged Media. I think this could be a game changer.

Installation

If you do not want to modify your system, you can use the rlesur/weasydoc docker image or even easier the MyBinder environment (see below).

weasydoc installation

The weasydoc package is still in development. You can install the development version from GitHub with:

devtools::install_github('RLesur/weasydoc')

System requirements

Pandoc version

You need pandoc version 2.1.3 or above (but version 2.2.1 or above is recommended).
If you use the RStudio preview release, you do not need to upgrade pandoc. Otherwise, see the installation instruction for pandoc.

HTML to PDF converter

You need to install a HTML to PDF converter that supports CSS for Paged Media.

For now, weasydoc supports WeasyPrint and Prince:

Ensure that the location of WeasyPrint and/or Prince is in the PATH environment variable.

Docker image

Do not use this image in production.

If you are not familiar with the docker images of the Rocker project, please read this great tutorial of rOpenSci Labs: https://ropenscilabs.github.io/r-docker-tutorial/

Since the use of weasydoc involves tier-softwares installation (pandoc, WeasyPrint/Prince), a docker image built on top of rocker/verse:3.5.0 is provided: rlesur/weasydoc.

You can launch a container using:

docker run --rm -dp 8787:8787 rlesur/weasydoc

Be aware that using this image, you agree with the terms of the Prince end user license: https://www.princexml.com/license/

MyBinder environment

The quickest way to test weasydoc is to click on the following badge:

Binder

Using this environment, you agree with the terms of the Prince end user license: https://www.princexml.com/license/

Usage

Here is a simple example:

file.copy(system.file("rmarkdown/templates/hpdf_document/skeleton/skeleton.Rmd", 
                      package = "weasydoc"), 
          "myfile.Rmd")
rmarkdown::render("myfile.Rmd", weasydoc::hpdf_document())

This package also supports bookdown output format. You can use weasydoc::hpdf_book() to generate a PDF using bookdown.

How can I learn CSS for Paged Media?

There are a lot of great ressources on the web to learn CSS for Paged Media:

O'Reilly Media tutorials on Youtube:

I also recommend this article Streamlining CSS Print Design with Sass by Sanders Kleinfeld (@sandersk) and the Paged Media initiative blog www.pagedmedia.org.

Contribution

This package is still in active development. Some breaking changes may appear. Feel free to send a PR.

Credits

The name weasydoc is a tribute to the WeasyPrint project: I like open source and really appreciate the effort of the community to develop an open source software using CSS for Paged Media.

Thanks Christophe Dervieux (@cderv) for making me discover MyBinder!

The most important source of inspiration comes from the rmarkdown and bookdown packages created by Yihui Xie (@yihui). Many thanks!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].