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

Add additional pdf formatting options #87

Merged
merged 1 commit into from
Sep 12, 2022

Conversation

eddiechapman
Copy link
Contributor

@eddiechapman eddiechapman commented Aug 11, 2022

Implements new PDF options as requested in #26:

  • --format
  • --print-background
  • --scale
  • --width
  • --height

New option arguments are validated with Click and passed to Playwright.

Documentation is updated with Cog.


📚 Documentation preview 📚: https://shot-scraper--87.org.readthedocs.build/en/87/

@click.option("--height", help="PDF height including units, e.g. 10cm")
@click.option(
"--scale",
type=click.FloatRange(min=0.1, max=2.0),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is neat, thanks for figuring out the range here

@simonw simonw merged commit fbb3790 into simonw:main Sep 12, 2022
@simonw
Copy link
Owner

simonw commented Sep 12, 2022

I tested this like so:

shot-scraper pdf https://github.com/ --media-screen --landscape --width 10cm --height 10cm --scale 0.3 --print-background

github-com.1.pdf

simonw added a commit that referenced this pull request Sep 12, 2022
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

Successfully merging this pull request may close these issues.

2 participants