L_LTFIL_API L_INT L_ExtractAttachment(pszSrcFileName, pSrcBuffer, uSrcBufferSize, pFileOptions, pFileInfo, uFlags, pszDstFileName, ppDstBuffer, puDstBufferSize)
Extracts an attachment from the owner file.
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.
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.
Size of pSrcBuffer in bytes, if the value of the parameter passed is not NULL; otherwise, ignore.
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.
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.
Reserved for future use. Use 0.
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.
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.
Size of the memory buffer in _ppDstBuffer_, if the value of the parameter passed was not NULL.
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. |
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.
Win32, x64, Linux.
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document