Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore print.css #605

Open
josevalim opened this issue Oct 18, 2021 · 3 comments
Open

Explore print.css #605

josevalim opened this issue Oct 18, 2021 · 3 comments
Labels
area:frontend Related to UI/UX feature New feature or request

Comments

@josevalim
Copy link
Contributor

Today we cannot print Livebooks. We should explore making them printable via a print media query.

@josevalim josevalim added feature New feature or request area:frontend Related to UI/UX labels Oct 18, 2021
@josevalim
Copy link
Contributor Author

josevalim commented Oct 18, 2021

Depending on how much work we want to put into it, there is:

@juhalehtonen
Copy link
Contributor

juhalehtonen commented Sep 26, 2022

I had a very cursory look at this, reporting below for anyone who's interested in tackling this 🙂

It seems that the biggest bulk of work will be in handling the styling of iframes (such as the output of VegaLite), due to how they are positioned in a container element (see js-view-iframes) and then absolutely positioned to an expected location and size. I did not look into how much work there is to place the iframes statically when printing, or otherwise adjusted to act correctly. Whoever will look into this, see

createIframe() {
for more details on how and why this is done.

The above assumes that we'd not be using some fancier tooling for generating as-seen-in-the-browser documents for printing, as brought up by José above :). If an additional tool of some sort is used, the work with iframes can probably be sidestepped (at the cost of not having browser-native print support).

The "basic functionality" of print styling (as reported by the linked issue) in a way that enables printing the text-based (or any non-absolutely-positioned) contents in full should be achievable with a few lines of CSS in @media print { .. }, or whatever the respective effort is with Tailwind.

The main points of interest in getting the basic printing to behave correctly are 1) hiding the navigation/floating elements with a simple display: none, 2) changing the overflow-y in the main container to initial or other non-auto value, and 3) possibly changing from display: flex in the parent container to block or other value to avoid unexpected cut-offs of text when printed. Point number 2 is the main offender which currently prevents more than one "page" of content being printed.

@josevalim
Copy link
Contributor Author

Thank you @juhalehtonen! There is also a related issue in #1159, where for complex printing we would rely on Pandoc and then get support on all of its outputs. In that case, we would have print.css only for the basic, in browser use cases, as you mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:frontend Related to UI/UX feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants