extractAndEmbedBase64Images(filePath, [propertyFilter])
This function extracts images encoded in base64 from HTML properties of a document. It then converts these images to a more storage-efficient format by saving them as embedded files within the document. The revised HTML will reference these images using a Content ID (CID) mechanism, similar to how images are referenced in email attachments.
Parameters
filePathstringrequiredThe absolute path to the document where images will be extracted and embedded.
propertyFilterstringoptionalSpecifies which properties to scan for base64 images. Use "*" (default) to scan all properties, or provide a specific property name.
The function recursively searches through objects and arrays to find matching properties. Supports wildcards.
Returns
A number indicating the total count of base64 image references that were successfully extracted and updated to CID format in the document.
Example
let result = docly.extractAndEmbedBase64Images(filePath);
return result;