L_ExtractAttachment

include "l_bitmap.h"

L_LTFIL_API L_INT L_ExtractAttachment(pszSrcFileName, pSrcBuffer, uSrcBufferSize, pFileOptions, pFileInfo, uFlags, pszDstFileName, ppDstBuffer, puDstBufferSize)

Extracts an attachment from the owner file.

Parameters

L_TCHAR *pszSrcFileName

Owner file name.

If this value is not NULL, then it must point to the name of the file on disk to parse for the attachment.

If this value is NULL, then the owner file data must be set in pSrcBuffer.

Either pszSrcFileName or pSrcBuffer must not be NULL, but not both.

L_UCHAR *pSrcBuffer

Pointer to the memory buffer containing the data of the owner file.

If this value is not NULL, then it must contain the data of the owner file to parse for the attachment. The size of the data must be set in uSrcBufferSize.

If this value is NULL, then pszSrcFileName must point to the name of the file on disk to parse for the attachment.

Either pszSrcFileName or pSrcBuffer must not be NULL, but not both.

L_SIZE_T uSrcBufferSize

Size of pSrcBuffer in bytes, if the value of the parameter passed is not NULL; otherwise, ignore.

pLOADFILEOPTION pFileOptions

Pointer to optional extended load options. This value cannot be NULL. The value of pLOADFILEOPTION->nAttachment must be set to the 1-based attachment number to extract.

pFILEINFO pFileInfo

Pointer to a FILEINFO structure. This structure may contain file information used in loading an image, or it may be updated with information about the file being loaded.

This value can be NULL.

Refer to L_LoadFile for more information.

L_UINT uFlags

Reserved for future use. Use 0.

L_TCHAR * pszDstFileName

Destination file name.

If this value is not NULL, then it must contain the name of the file on disk that will be created or overwritten with the attachment file data, if found.

If this value is NULL, then the attachment file data will be set in ppDstBuffer.

Either pszDstFileName or ppDstBuffer must not be NULL, but not both.

L_UCHAR **ppDstBuffer

Pointer to the variable that will contain the attachment file data, if found.

If this value is not NULL, then it will contain the attachment file data and the size in bytes will be set in puDstBufferSize. The application code must call L_FreeBuffer on the pointer when it is no longer needed.

If this value is NULL, then the attachment file data is saved to the name of the file set in pszDstFileName.

L_SIZE_T *puDstBufferSize

Size of the memory buffer in _ppDstBuffer_, if the value of the parameter passed was not NULL.

Returns

Value Meaning
SUCCESS The function was successful.
ERROR_ATTACHMENT_NOT_FOUND The attachment number specified in pFileOptions->nAttachment was not found in the file.
ERROR_PDF_INVALID_PASSWORD The owner file is encrypted. Pass the correct password using L_SetPDFOptions and try again.
ERROR_FEATURE_NOT_SUPPORTED The file is a format that does not support attachments (such as PNG or BMP), or LEADTOOLS does not support reading attachments of this type of format.
< 1 An error occurred. Refer to Return Codes.

Comments

Use L_FILEINFO.nAttachmentCount to quickly determine the number of attachments found in a file.

Use L_ReadFileAttachments to obtain the number and properties of all attachments found in a file.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help