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; MaxImageCount; Size ) More
Parameters
Parameter | Description | Example |
---|---|---|
The PDF reference returned from DynaPDF.New. | ||
MaxImageCount | Maximum number of images to be cached. | |
Size | Maximum cache size in bytes. |
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
- Version 14.3
- Added DynaPDF.SetLineAnnotPoints and DynaPDF.EnableImageCache functions.
Blog Entries
This function checks for a license.
Created 14th June 2024, last changed 9th July 2024