Click or drag to resize

Jb2EncoderSave Method (Stream, AtalaImage, ProgressEventHandler)

Compresses a single AtalaImage as a JBIG2 encoded file.

Namespace:  Atalasoft.Imaging.Codec.Jbig2
Assembly:  Atalasoft.dotImage.Jbig2 (in Atalasoft.dotImage.Jbig2.dll) Version: 11.4.0.9.0.377 (.NET 4.5.2, x86)
Syntax
public override long Save(
	Stream stream,
	AtalaImage image,
	ProgressEventHandler progress
)

Parameters

stream
Type: System.IOStream
The input stream.
image
Type: Atalasoft.ImagingAtalaImage
AtalaImage to be written as JBIG2, PDF or embedded stream to PDF.
progress
Type: Atalasoft.ImagingProgressEventHandler
A progress Delegate. Pass in null (Nothing in VB, 0 in C++) to ignore progress events.

Return Value

Type: Int64
Returns the number of bytes encoded.
Exceptions
ExceptionCondition
ImageWriteException Thrown if there is an error when compressing the image data.
IncompatiblePixelFormatException Thrown if the source image is not 1-bit.
ArgumentException Thrown if Lossy compression is not used with symbols.
Remarks
To append to an existing image, set Append to true.
Examples
Save single C# (C#)
using Atalasoft.Imaging; 
using Atalasoft.Imaging.Codec.Jbig2; 
... 

// example of encoding a single image 
FileStream fs = new FileStream(targetFileName, FileMode.Create); 
AtalaImage image = new AtalaImage(sourceFilename); 
Jb2Encoder jb2e = new Jb2Encoder(); 
jb2e.ExportFormat = Jb2ExportFormat.Jb2; 
jb2e.Save(fs, image, null);
Save single C++ (CPP)
using namespace Atalasoft::Imaging; 
using namespace Atalasoft::Imaging::Codec::Jbig2; 
...

// example of encoding a single page image 
FileStream* fs = new FileStream(targetFilename, FileMode::Create); 
AtalaImage* image = new AtalaImage(sourcefilename); 
Jb2Encoder* jb2e = new Jb2Encoder(); 
jb2e->ExportFormat = Jb2ExportFormat::Jb2; 
jb2e->Save(fs, image, null);
Save Single VB (Visual Basic)
Imports Atalasoft.Imaging
Imports Atalasoft.Imaging.Codec.Jbig2 
...

' example of encoding a Single image 
Dim fs As FileStream = New FileStream(targetFileName, FileMode.Create)
Dim image As AtalaImage = New AtalaImage(sourceFilename)
Dim jb2e As Jb2Encoder = New Jb2Encoder() 
jb2e.ExportFormat = Jb2ExportFormat.Jb2
jb2e.Save(fs, image, null)
See Also