Commit 08540ed7 authored by Romain Lesur's avatar Romain Lesur

add paginate button experiment

# tests-pagedjs
This repository contains my personal tests with `paged.js`.
The goal of these tests is to use `paged.js` with the [`rmarkdown`]( and [`bookdown`]( `R` package.
function addStyle() {
var link = document.createElement("link");
link.rel = "stylesheet";
link.href = "viewer.css";
link.type = "text/css";
function addPagedjs() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "";
function showPages() {
document.querySelector("#paginate").style.display = "none";
function addPaginateButton() {
var button = document.createElement("button");
button.innerHTML = "Paginate";
button.setAttribute('class', 'btn btn-primary');
button.setAttribute('id', 'paginate'); = "fixed"; = 0; = 0;
var el = document.body.appendChild(button);
el.addEventListener('click', showPages);
title: "A simple paginate button for html_document"
author: "Romain Lesur"
date: "30 septembre 2018"
css: styles.css
theme: journal
after_body: after_body.html
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
## Overview
In order to render math with `mathjax` or htmlwidgets, `paged.js` has to be called after the DOM is built.
This html_document implements a paginate button that renders the document (see the upper right corner).
Before clicking on the button, the user can modify the `DT::datatable` widget.
Some tests have been made with `leaflet` and `plotly`: canvas are not rendered by `paged.js`.
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r cars}
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
## Some math
$$\frac{n!}{k!(n-k)!} = \binom{n}{k}$$
## A datatable widget
## Other widgets
Canvas elements are not rendered by paged.js.
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
size: A4;
margin-left: 15mm;
margin-right: 15mm;
margin-bottom: 15mm;
margin-top: 15mm;
.pagedjs_margin-top-left, .pagedjs_margin-top-right { height: 6px; margin-top: 10mm; }
.pagedjs_margin-top { align-items: top; }
@media screen {
body {
background-color: whitesmoke !important;
.pagedjs_page {
background-color: white !important;
box-shadow: 0 0 0 2px #888 !important;
margin: 0 auto !important;
margin-top: 10mm !important;
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment