Image.GetFileFormat
Contents
[
Hide
]GetFileFormat(string)
Gets the file format.
public static FileFormat GetFileFormat(string filePath)
Parameter | Type | Description |
---|---|---|
filePath | String | The file path. |
Return Value
The determined file format.
Remarks
The file format determined does not mean that the specified image may be loaded. Use one of the CanLoad method overloads to determine whether file may be loaded.
Examples
Determines whether file is a DWG drawing
var fileFormat = Image.GetFileFormat("file.dwg");
if (fileFormat >= FileFormat.CadR010 && fileFormat <= FileFormat.CadR2010)
{
Console.WriteLine("This is a DWG drawing");
}
See Also
- enum FileFormat
- class Image
- namespace Aspose.CAD
- assembly Aspose.CAD
GetFileFormat(Stream)
Gets the file format.
public static FileFormat GetFileFormat(Stream stream)
Parameter | Type | Description |
---|---|---|
stream | Stream | The stream. |
Return Value
The determined file format.
Remarks
The file format determined does not mean that the specified image may be loaded. Use one of the CanLoad method overloads to determine whether stream may be loaded.
Examples
Determines whether a stream contains a DXF drawing
using (var f = File.OpenRead("file.dxf"))
{
var fileFormat = Image.GetFileFormat(f);
if (fileFormat >= FileFormat.DXFCadR010 && fileFormat <= FileFormat.DXFCadR2010)
{
Console.WriteLine("This is a DXF drawing");
}
}
See Also
- enum FileFormat
- class Image
- namespace Aspose.CAD
- assembly Aspose.CAD