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

legible print/PDF output for notebooks #44

Open
jrus opened this issue Mar 13, 2021 · 7 comments
Open

legible print/PDF output for notebooks #44

jrus opened this issue Mar 13, 2021 · 7 comments

Comments

@jrus
Copy link

jrus commented Mar 13, 2021

Problem description: Long notebooks are sometimes nice to read on paper instead of on screen. This can be especially helpful when trying to proofread a long document, red felt pen in hand. Unfortunately, printing a document whose content is stuck into iframes does not work properly in shipping browsers.

Preferred ideal solution: it would be great if Observable could export to a nicely typeset PDF with appropriate line length, margins, maybe page numbers, image cells not cut off between pages, etc.

Workaround: Embed notebook cells on an external web page not in an iframe (for example http://visionscarto.net/obs/), and print from there. Browser print formatting is still pretty mediocre and image cells end up arbitrarily chopped in half and split between pages, so this is not really suitable for archival or public presentation, but it nominally works, in a pinch (e.g. for proofreading as the author, or reading a notebook on the beach).

Original discussion at talk/3971

@mootari
Copy link
Member

mootari commented Mar 15, 2021

Can you share a few problematic notebook URLs to test against?

@CobusT
Copy link
Collaborator

CobusT commented Mar 16, 2021

I would love a good test case. I think there are some low hanging fruit that can be fixed for better printing, but I am sure there will still be problem scenarios!

@dkirkby
Copy link

dkirkby commented Jun 21, 2022

Another use case is preparing notes for a live demo or tutorial that you can cut & paste from.

@tophtucker
Copy link
Contributor

@mootari has a great homegrown solution here: https://observablehq.com/@mootari/printable

@grant
Copy link

grant commented Nov 1, 2022

Are there more details to the issue with printing?


We can pretty easily remove the nav header with CSS when printing with some CSS:

@media print {
  ...
}

Screen Shot 2022-10-31 at 17 33 21

It looks fairly well right now.

@mootari
Copy link
Member

mootari commented Nov 1, 2022

@grant From the description:

nicely typeset PDF with appropriate line length, margins, maybe page numbers, image cells not cut off between pages, etc.

The example you shared is not suitable to test all these requirements, and even there you can see that lines wrap too early. We're also not aiming for "fairly". ;)

Furthermore UI elements (aside from the notebook header) need to be hidden.

@borango
Copy link

borango commented Aug 13, 2023

@mootari has a great homegrown solution here: https://observablehq.com/@mootari/printable

Works for me in some cases. It also respects "css page-break" rules, which don't work in a browser print from the notebook directly.

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants