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

full_page: true doesn't render full page #278

Open
remy727 opened this issue Jan 7, 2025 · 3 comments
Open

full_page: true doesn't render full page #278

remy727 opened this issue Jan 7, 2025 · 3 comments

Comments

@remy727
Copy link

remy727 commented Jan 7, 2025

Hello!

Thank you for the great gem!

I want to convert HTML that overflows width and height to PDF but it only generates PDF with the showing viewport only.

My Grover configuration:

Grover.configure do |config|
  config.options = {
    print_background: true,
    full_page: true,
    viewport: {
      width: 2527,
      height: 1287,
    }
  }
end
@abrom
Copy link
Contributor

abrom commented Jan 13, 2025

hey @remy727 I think there is a bit of a mixup here. The full_page option is only applicable for taking screenshots (as an image). See https://pptr.dev/api/puppeteer.screenshotoptions

The PDF options available are https://pptr.dev/api/puppeteer.pdfoptions

It's also not clear from your example of what you're wanting to happen? You want it to have both a fixed width/height for the viewport, but also capture overflowing content? How would that work? If the content was overflowing vertically, sure.. add another page. But if it overflows horizontally where would the content be expected to be rendered? PDFs don't allow for content to be rendered in two separate axes.

@remy727
Copy link
Author

remy727 commented Jan 14, 2025

Hi @abrom,

Thank you for your reply.

The full_page option is only applicable for taking screenshots (as an image).

Aha, got it. I tried without it but the same result.

It's also not clear from your example of what you're wanting to happen?

So my HTML content is overflowing and shows vertical and horizontal scrollbars on my browser. With the above config, Grover doesn't generate a PDF with the full content. It just includes the content I can see without scrolling. Hope this makes sense.

@abrom
Copy link
Contributor

abrom commented Jan 14, 2025

It sounds like you need to take a look at the styling of your page. If you've got something artificially clamping the height/width of the viewport, you can't expect the browser to then expand it?? You've told it to do otherwise! 😉

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

No branches or pull requests

2 participants