simonw / shot-scraper

A command-line utility for taking automated screenshots of websites
https://shot-scraper.datasette.io
Apache License 2.0
1.62k stars 70 forks source link

YAML configuration for PDF shots #27

Open simonw opened 2 years ago

simonw commented 2 years ago

I added PDF support here:

But there's currently no way to script PDFs in the YAML syntax with shot-scraper multi. This would be really useful, especially as the PDF generation grows even more options:

simonw commented 2 years ago

This could work:

- output: example.pdf
  pdf: true
  url: http://www.example.com/
simonw commented 2 years ago

Since PDF will accept a different set of options from regular screenshots I think this will be the point at which I add much more robust validation of the YAML mini-language, probably using https://pydantic-docs.helpmanual.io/

parkr commented 6 months ago

Hi Simon, I was setup a new repository using your excellent template and was confused when adding shots with a PDF output file failed to render valid PDFs. Would it be worthwhile to mention the formats that are allowed on your detailed documentation page to prevent future confusion about multi-shots? PNG worked great but PDF failed completely.

Additionally, if there is a workaround for Actions multi-shots that you'd recommend for those wishing to generate PDFs, please do let me know. I was thinking of writing a wrapper for myself around shot-scraper pdf that reads a custom YAML file and executes shot-scraper pdf in a subshell.

Thanks for making this great tool!