Forrest logo
back to the weasyprint tool

weasyprint:tldr:a1bae

weasyprint: Render an HTML file to PNG, including an additional user stylesheet.
$ weasyprint ${path-to-input-html} ${path-to-output}.png --stylesheet ${path-to-stylesheet-css}
try on your machine

This command is using the WeasyPrint tool, which is a command-line utility for converting HTML documents to PDF or various image formats. The purpose of the command is to convert an input HTML file to a PNG image file with the provided stylesheet applied.

Here is a breakdown of the command:

  • weasyprint: This is the command to run the WeasyPrint tool.
  • ${path-to-input-html}: This should be replaced with the actual path to the input HTML file that you want to convert. It represents the file path of the HTML document you want to convert to a PNG image.
  • ${path-to-output}.png: This should be replaced with the desired path and filename for the output PNG image file. The .png extension indicates that the output format should be a PNG image. Make sure to specify the desired location and file name.
  • --stylesheet ${path-to-stylesheet-css}: This is an optional parameter that allows specifying a CSS stylesheet file to be applied to the HTML document during conversion. You should replace ${path-to-stylesheet-css} with the actual path to the CSS file you want to use for styling the HTML document.

To execute the command, you need to replace the placeholders with the actual file paths and run it in the terminal or command prompt. The WeasyPrint tool will then convert the input HTML file to a PNG image file with the applied stylesheet.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the weasyprint tool