fromFile static method
- String? filepath,
- PixelFormat pixelFormat
Creates an Image from the specified file.
param filepath A string that contains the name of the file from which to create the Image. param pixelFormat The pixel format into which to convert the input image. return The newly created document image. throws DocumentException An error has occurred during Document Library execution.
Implementation
static DocumentImage fromFile(String? filepath, PixelFormat pixelFormat) {
DocumentImage documentImage = DocumentImage();
Pointer<Char>? pFilepath = filepath?.toNativeUtf8().cast<Char>();
try {
var err = documentSDK.id3DocumentImage_FromFile(documentImage.handle, pFilepath ?? nullptr, pixelFormat.value);
if (err != DocumentError.success.value) {
documentImage.dispose();
throw DocumentException(err);
}
return documentImage;
} finally {
if (pFilepath != null) {
calloc.free(pFilepath);
}
}
}