DjvuImage Constructor (Stream, LoadOptions) |
Initializes a new instance of the
DjvuImage class.
Namespace: Aspose.Imaging.FileFormats.DjvuAssembly: Aspose.Imaging (in Aspose.Imaging.dll) Version: 21.04
Syntaxpublic DjvuImage(
Stream stream,
LoadOptions loadOptions
)
Public Sub New (
stream As Stream,
loadOptions As LoadOptions
)
public:
DjvuImage(
Stream^ stream,
LoadOptions^ loadOptions
)
new :
stream : Stream *
loadOptions : LoadOptions -> DjvuImage
Parameters
- stream
- Type: System.IOStream
The stream to load from. - loadOptions
- Type: Aspose.ImagingLoadOptions
The load options.
ExceptionsException | Condition |
---|
[!:DjvuException] | Stream is empty |
ExamplesThis example shows how to load a DJVU image from a file stream to stay within the specified memory limit.
[C#]
string dir = "c:\\temp\\";
using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "sample.djvu"))
{
Aspose.Imaging.LoadOptions loadOptions = new Aspose.Imaging.LoadOptions();
loadOptions.BufferSizeHint = 1 * 1024 * 1024;
using (Aspose.Imaging.FileFormats.Djvu.DjvuImage djvuImage = new Aspose.Imaging.FileFormats.Djvu.DjvuImage(stream, loadOptions))
{
foreach (Aspose.Imaging.FileFormats.Djvu.DjvuPage djvuPage in djvuImage.Pages)
{
string fileName = string.Format("sample.{0}.png", djvuPage.PageNumber);
djvuPage.Save(dir + fileName, new Aspose.Imaging.ImageOptions.PngOptions());
}
}
}
See Also