Giter Site home page Giter Site logo

Comments (3)

gulien avatar gulien commented on September 26, 2024

Hey @gg-gaborginter,

I was playing with viewportWidth and viewportHeight, and I was not able to make them work.
For instance, increasing the value of viewportWidth did not make the website CSS "adapt", but instead it kept the same width (e.g., website sticked to the left of the screenshot) while capturing more "background". viewportHeight was working OK, meaning I was able to take screenshots of a portion of the site.

Also, keep in mind that screenshots are not a first class citizen in Gotenberg, but merely a tool to make a sort of "preview" of the PDF conversion result.

from gotenberg.

gg-gaborginter avatar gg-gaborginter commented on September 26, 2024

Hi @gulien,

We are at the moment using a self-built, similar setup for both purposes: PDF and screenshot generation. With screenshots, as the window size can't be influenced anyhow else on the Chromium API, we set the viewport sizes instead and restricted the width of the page body through CSS.

I made some tests with the HTML viewport meta tag, by fixing the width and height explicitly, but without the viewport setting on the Chromium page instance, the screenshot was made of the whole window size (lots of white space all around the desired content).

I understand that the screenshot feature is not a first-class citizen. It would be nice, though, to have the option to control some of the settings that Chromium offers. I'm willing to contribute, so I created a pull request, as well: #787

from gotenberg.

stale avatar stale commented on September 26, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from gotenberg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.