Forrest logo
back to the weasyprint tool

weasyprint:tldr:47091

weasyprint: Specify a base URL for relative URLs in the input HTML file.
$ weasyprint ${path-to-input-html} ${path-to-output}.png --base-url ${url_or_filename}
try on your machine

The given command is using the WeasyPrint tool to convert an HTML file (${path-to-input-html}) into a PNG image (${path-to-output}.png). Here's a breakdown of the command:

  • weasyprint: This is the command to invoke the WeasyPrint tool.
  • ${path-to-input-html}: This is the placeholder for the path to the input HTML file you want to convert.
  • ${path-to-output}.png: This is the placeholder for the desired output file path and name. The file will be saved as a PNG image.
  • --base-url ${url_or_filename}: This part specifies the base URL or filename for resolving relative links, stylesheets, and images within the HTML file. You need to replace ${url_or_filename} with an actual URL (e.g., http://example.com) or a file path (e.g., /path/to/file.html).

In summary, this command takes an HTML file as input, processes it using WeasyPrint, and generates a PNG image as output. The --base-url flag is used to specify the base URL or filename for proper resolution of relative file references in the HTML.

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