Method CanLoad
CanLoad(string)
Determines whether image can be loaded from the specified file path.
public static bool CanLoad(string filePath)
Parameters
filePath
stringThe file path.
Returns
- bool
true
if image can be loaded from the specified file; otherwise,false
.
Examples
Checks whether loading of a drawing is possible
var fileName = @"C:\path\drawing.dwg";
if (Aspose.CAD.Image.CanLoad(fileName))
{
using (Aspose.CAD.Image drawing = Aspose.CAD.Image.Load(fileName))
{
// process the drawing
}
}
CanLoad(string, LoadOptions)
Determines whether an image can be loaded from the specified file path and optionally using the specified open options
public static bool CanLoad(string filePath, LoadOptions loadOptions)
Parameters
filePath
stringThe file path.
loadOptions
LoadOptionsThe load options.
Returns
- bool
true
if an image can be loaded from the specified file; otherwise,false
.
Examples
Checks whether loading of a drawing is possible with specified encoding
var fileName = @"C:\path\drawing.dwg";
if (Aspose.CAD.Image.CanLoad(fileName, new LoadOptions
{
SpecifiedEncoding = CodePages.Japanese
}))
{
using (Aspose.CAD.Image drawing = Aspose.CAD.Image.Load(fileName))
{
// process the drawing
}
}
CanLoad(Stream)
Determines whether image can be loaded from the specified stream.
public static bool CanLoad(Stream stream)
Parameters
stream
StreamThe stream to load from.
Returns
- bool
true
if image can be loaded from the specified stream; otherwise,false
.
Examples
Checks whether loading of a drawing is possible from the stream specified
using (var f = File.OpenRead("file.dxf"))
{
var currentPosition = f.Position;
if (Image.CanLoad(f))
{
Assert.AreEqual(currentPosition, f.Position);
// process the drawing...
}
}
CanLoad(Stream, LoadOptions)
Determines whether image can be loaded from the specified stream and optionally using the specified loadOptions
.
public static bool CanLoad(Stream stream, LoadOptions loadOptions)
Parameters
stream
StreamThe stream to load from.
loadOptions
LoadOptionsThe load options.
Returns
- bool
true
if image can be loaded from the specified stream; otherwise,false
.
Examples
Checks whether loading of a drawing is possible from the stream specified with a corresponding encoding
using (var f = File.OpenRead("file.dwg", new LoadOptions
{
SpecifiedEncoding = CodePages.Japanese
}))
{
var currentPosition = f.Position;
if (Image.CanLoad(f))
{
Assert.AreEqual(currentPosition, f.Position);
// process the drawing...
}
}