:tocdepth: 3 :py:mod:`gws.lib.htmlx` ======================= .. py:module:: gws.lib.htmlx **Source code:** :source:`gws.lib.htmlx` Package Contents ---------------- .. py:function:: escape(s: str, quote=True) -> str Escapes a string for use in HTML. .. py:function:: render_to_pdf(html: str, out_path: str, page_size: gws.UomSize = None, page_margin: gws.UomExtent = None) -> str Renders an HTML string to a PDF file. :param html: The HTML content to be converted into a PDF. :param out_path: The output file path for the generated PDF. :param page_size: The size of the page in user-defined units. Defaults to None. :param page_margin: The margins of the page in user-defined units. Defaults to None. :returns: The output file path of the generated PDF. .. py:function:: render_to_png(html: str, out_path: str, page_size: gws.UomSize = None, page_margin: list[int] = None) -> str Renders an HTML string to a PNG image. :param html: The HTML content to be converted into an image. :param out_path: The output file path for the generated PNG. :param page_size: The size of the image in user-defined units. Defaults to None. :param page_margin: The margins of the image in pixels (top, right, bottom, left). Defaults to None. :returns: The output file path of the generated PNG.