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

build_pdf tends to crop bottom of slide? #16

Open
mattansb opened this issue Feb 24, 2021 · 8 comments
Open

build_pdf tends to crop bottom of slide? #16

mattansb opened this issue Feb 24, 2021 · 8 comments
Labels
bug Something isn't working

Comments

@mattansb
Copy link

This seems to happen for images that are too close to the bottom of the slide.
E.g.:

https://mattansb.github.io/bayesian-evidence-iscop-2021/#33

Turns into this:

image

@jhelvy
Copy link
Owner

jhelvy commented Feb 24, 2021

Hmm, I've tried two ways to build a pdf from your slides, but both ways cut off the bottom charts:

input <- "https://mattansb.github.io/bayesian-evidence-iscop-2021/index.html"
build_pdf(input)
build_pdf(input, complex_slides = TRUE)

The first approach relies on pagedown::chrome_print(). The second uses the {chromote} package, but in the end also prints from Chrome. So I think this may just be an issue with how Chrome prints pages to pdfs.

Edit: The above code will only work with v. 0.0.5, which I just pushed. I realized I hadn't enabled some of the build functions to build directly from slides on a website, but that now should be enabled.

@mattansb
Copy link
Author

So I think this may just be an issue with how Chrome prints pages to pdfs.

I'm not sure about that - attached is a print from chrome which does have the last graph: test.pdf

@jhelvy
Copy link
Owner

jhelvy commented Feb 25, 2021

How did you print that? I just opened the slides in Chrome on my machine and printed them directly from Chrome, and I got the same crop problem. If you're able to print it without the crop there must be a solution, maybe a setting that can be tweaked.

@mattansb
Copy link
Author

I did the same - opened the slide in chrome (win10) and ctrl+p as pdf...

@jhelvy
Copy link
Owner

jhelvy commented Feb 25, 2021

Interesting...I'm on a mac, but I wouldn't expect that to be the root cause. It's particularly odd that you get a difference between using "Open Chrome -> ctrl + p" compared to pagedown::chrome_print() since those should be the same thing. I feel like there might be a different print setting in the "Open Chrome -> ctrl + p" method that is not used with pagedown::chrome_print()

@mattansb
Copy link
Author

This is what I get:

image

@jhelvy
Copy link
Owner

jhelvy commented Feb 25, 2021

Okay so it looks like it might be an issue with the margin settings.

On my machine, the default margins crop the slide:

margin_default

But if I set the margins to "minimum" and include headers and footers, it doesn't crop the charts, though is still looks like it crops a tiny amount on the bottom since the slide number is chopped a bit:

margin_minimum

I still can't find a setting on my end that looks like yours, but this is promising as I can probably change the print settings from pagedown::chrome_print().

@mattansb
Copy link
Author

Awesome (:

@jhelvy jhelvy added the bug Something isn't working label Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants