Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/aprilahijriyan/pyhtmlconv

pyhtmlconv: html converter (image / pdf)
https://github.com/aprilahijriyan/pyhtmlconv

converter html image pdf python screenshot wkhtmltopdf

Last synced: 9 days ago
JSON representation

pyhtmlconv: html converter (image / pdf)

Awesome Lists containing this project

README

        

pyhtmlconv: html converter (image / pdf)
----------------------------------------

python html converter (image / pdf)

Installation
------------

Anda perlu menginstall `wkhtmltopdf `_, sebelum menginstall modul ini.

.. code-block:: bash

pip install pyhtmlconv

Example
-------

.. code-block:: python

import pyhtmlconv as html
url = "https://google.com"
image = html.convert_to_image(url, "jpeg")
with open("test_image.jpeg", "wb") as fp:
fp.write(image)

pdf = html.convert_to_pdf(url)
with open("test_file.pdf") as fp:
fp.write(pdf)

Anda juga dapat mengkonversikan data (image atau pdf) ke bentuk `data uri `_ dengan cara menambahkan nilai ``True`` pada parameter ``datauri`` di fungsi ``convert_to_image`` atau ``convert_to_pdf``.