Comments (3)
Are you using a pagedown format for R Markdown ? Or are you just using chrome_print()
directly on the HTML file ?
If I open you document in a browser, and run Chrome print on it, it won't apply. Not an issue with pagedown - just your document does not work to print in browser like you expect, even without the package.
I believe rules like @top-left
or @bottom-right-corner
still requires Paged.js and not just a print to PDF using Chrome (which chome_print()
does). margin
and size
are more native so works.
For context, this is the whole point of Paged.js (https://pagedjs.org/about/)
Paged.js follows the Paged Media standards published by the W3C (ie the Paged Media Module, and the Generated Content for Paged Media Module). In effect Paged.js acts as a polyfill for the CSS modules to print content using features that are not yet natively supported by browsers.
pagedown is allowing to use Paged.js in HTML output document so that they can be printed paginated. If I put your CSS in a custom.css
h1 {
color:blue;
}
h2 {
color:red;
}
@page {
size: 8.5in 11in;
margin: 10%;
@top-left{
content: "Please Write something";
border: solid green;
}
}
p {
color: green;
}
and they, add it to a pagedown::html_paged
format then it works as expected
---
title: test
output:
pagedown::html_paged:
css: ["custom.css", "default-fonts", "default-page", "default"]
---
# My First Heading
## My Second Heading
My first paragraph.
This will print accordingly, but could require some tweaking regarding margin elements size. Docs for paged.js margin processing: https://pagedjs.org/documentation/7-generated-content-in-margin-boxes/. More doc at https://pagedjs.org/documentation/
So overall, you may need to use paged.js
more directly. Either using this R package or another way.
Hope it helps.
If I misunderstood your question, please do share more details
from pagedown.
This is great, thank you. I am using Quarto (the "next generation of R Markdown") to produce reports. Although most R Markdown files can be rendered through Quarto without modification, from what I understand, the pagedown output format is not possible in Quarto files ( yet ;) ). Let me know if I am incorrect.
In short, I will look for a way to integrate the paged.js script more directly into Quarto documents.
Thank you for the great help.
from pagedown.
You can still use pagedjs-cli
tool to print any HTML document using Paged.js
https://pagedjs.org/documentation/2-getting-started-with-paged.js/#command-line-version
So you can
- Render with Quarto to HTML
- Print a paginated version using Paged.js CLI tool.
But yes there is no specific paged.js integration with Quarto HTML yet. So maybe some stuff won't be correctly formated or printed. You should try.
from pagedown.
Related Issues (20)
- ETA of Pagedown for Quarto? HOT 1
- aside chunk behaviour/positioning HOT 1
- The tippy package is not working when using `html_paged` output HOT 2
- Paged.js specifications not supported in inline CSS chunks HOT 1
- Upkeep for pagedown
- `usethis::use_tidy_coc()`
- Editing div.date to allow for hyperlinked image
- chrome_print PDF without figure shows WebGL is not supported by your browser
- TOC with more than a page stops the render. HOT 7
- GT table formatting HOT 3
- Problème de mise en page pour mon CV après version 1.2.5042 HOT 15
- sidebar content for multiple pages - resume css
- How to specify CHROME arg "--user-agent" in extra_args in order to mimic a non-headless browser? HOT 3
- `chrome_print()` hangs when printing html with maths produced by Quarto HOT 6
- Last rows of long tables are hidden HOT 1
- Adjusting sidebar text and margins
- chrome_print and shiny
- Long chunk render issue : Warning: A runtime exception has occured while executing JavaScript HOT 2
- chrome_print() landscape = T not resizing HTML Widget on print?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pagedown.