Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

DynaPDF.EnableImageCache

Creates an image cache that is used when rendering PDF pages.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 14.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.EnableImageCache"; PDF )   More

Parameters

Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. $pdf

Result

Returns OK or error.

Description

Creates an image cache that is used when rendering PDF pages.
The maximum number of images and the maximum cache size can be set independently of each other.
Caching can speed up rendering dramatically but caching can also slow down rendering if too many images are in the cache. Therefore, the maximum number of images must be restricted. The value should be between 256 and 1024 but not much higher.
The optimal cache size depends on the number of pages and whether the app is 32 or 64 bit. The cache size can be large, e.g. up to 1 GB on 32 bit or 2 GB on 64 bit systems, if a document contains only a few pages. Images are cached only if the system contains enough memory.
The size of the image cache should be around 30% of the entire cache size for rendered images. If the full cache size is 1 GB, for example, then around 300 MB should be used for the image cache. Keep all caches dynamic depending on the currently available memory.
The cache size is automatically reduced if the system has not sufficient memory.
The cache is always cleared when the PDF file in memory was closed or when FreePDF() was called. In order to disable or delete the cache set MaxImageCount or Size to zero.

Examples

Cache up to 512 images with maximum of 1 GB in total:

Set Variable [ $r ; Value: MBS("DynaPDF.EnableImageCache"; $pdf; 512; 1024 * 1024 * 1024 /* 1 GB */ ) ]

See also

Release notes

Blog Entries

This function checks for a license.

Created 14th June 2024, last changed 14th June 2024


DynaPDF.EnableEncryption - DynaPDF.EndLayer