1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-03 23:48:07 +03:00

Update cache argument in docs

This commit is contained in:
Alejandro Avilés 2024-06-27 15:47:28 +02:00
parent b6b1543a09
commit 5441f326dd

View File

@ -516,7 +516,7 @@ Image Cache and Optimization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WeasyPrint provides many options to deal with images: ``optimize_images``,
``jpeg_quality``, ``dpi`` and ``image_cache``.
``jpeg_quality``, ``dpi`` and ``cache``.
``optimize_images`` can enable size optimization for images. When enabled, the
generated PDF will include smaller images with no quality penalty, but the
@ -540,7 +540,7 @@ generated PDF.
HTML('https://weasyprint.org/').write_pdf(
'weasyprint.pdf', optimize_images=True, jpeg_quality=60, dpi=150)
``image_cache`` gives the possibility to use a cache for images, avoiding to
``cache`` gives the possibility to use a cache for images, avoiding to
download, parse and optimize them each time they are used.
By default, the cache is used document by document, but you can share it
@ -552,12 +552,12 @@ time when you render a lot of documents that use the same images.
cache = {}
for i in range(10):
HTML(f'https://weasyprint.org/').write_pdf(
f'example-{i}.pdf', image_cache=cache)
f'example-{i}.pdf', cache=cache)
Its also possible to cache images on disk instead of keeping them in memory.
The ``--cache-folder`` CLI option can be used to define the folder used to
store temporary images. You can also provide this folder path as a string for
``image_cache``.
``cache``.
Logging