Convert template html to pdf
Project description
HTML TO PDF
Convert template html to pdf
Detailed documentation is in the "docs" directory.
Quick start
-
Install the module:
pip install htmltopdfy -
EXAMPLE
Import module
from htmltopdfy.job import htmlToPdfLet suppose we have a model like this:
class User(): name = models.CharField(max_length=200) age = models.CharField(max_length=20) cni = models.FileField(null=True,blank=True)Let's create user
user = User(name="dddd",age="23") user.save()We supposed we have a template named cni.html already designed on which we want to display name and age
cni_file = htmlToPdf ( media_root_url=settings.MEDIA_ROOT, file_name="cni", template_src = "cni.html", context_dict = {"name":"dddd","age":"20ans"} ) user.cni.save("cni.pdf",cni_file)After you can print variable cni in console to see result or send url file on your response view:
print(user.cni)or
return Response({"cni":user.cni.url})
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
htmltopdfy-1.0.1.tar.gz
(2.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file htmltopdfy-1.0.1.tar.gz.
File metadata
- Download URL: htmltopdfy-1.0.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ece4658aa91e0dd4113baa0cd3ab6dba9dcec4dc05cfd2e7ae940178b3be9173
|
|
| MD5 |
85272c994d77467e27ed16d3c9a77a39
|
|
| BLAKE2b-256 |
664cf956404bc969f4a8ac08025500610a45fb36f5e82b5fbf796f7ba3634797
|
File details
Details for the file htmltopdfy-1.0.1-py3-none-any.whl.
File metadata
- Download URL: htmltopdfy-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef08cdc0c31aa3db4a0d062fbc772426eaf2346e63f4002c6666b6d222e60477
|
|
| MD5 |
16a22656bd5553316d742be771946b97
|
|
| BLAKE2b-256 |
d18612efa86a4c016a9c3136fcf86dd829463673ec15e29d07a9c9bedf77f53b
|