Class Jbig2Globals
A parsed JBIG2 globals stream: the symbol dictionaries, pattern dictionaries and code tables a PDF shares between the JBIG2 images of a document. Parsing decodes them once; the object is immutable and safe to share across threads, so every page that refers to it reuses the decoded symbols.
public sealed class Jbig2Globals
- Inheritance
-
Jbig2Globals
- Inherited Members
Examples
// A PDF's JBIG2Decode image has no file header, so name the format. Parse the JBIG2Globals stream once and share it:
// every image of the document that refers to it reuses its decoded symbols.
Jbig2Globals globals = Jbig2Globals.Parse(globalsStream);
using Raster image = Raster.Load(imageStream, Jbig2Format.Info, options: new Jbig2ReaderOptions { Globals = globals });
Properties
SegmentCount
Gets the number of segments in the globals stream.
public int SegmentCount { get; }
Property Value
Methods
Parse(ReadOnlySpan<byte>, EgamiContext?)
Parses a globals stream and decodes its dictionaries.
public static Jbig2Globals Parse(ReadOnlySpan<byte> data, EgamiContext? context = null)
Parameters
dataReadOnlySpan<byte>The globals stream's bytes, as the PDF's JBIG2Globals stream holds them after its filters.
contextEgamiContext
Returns
- Jbig2Globals
The parsed globals.
Examples
// A PDF's JBIG2Decode image has no file header, so name the format. Parse the JBIG2Globals stream once and share it:
// every image of the document that refers to it reuses its decoded symbols.
Jbig2Globals globals = Jbig2Globals.Parse(globalsStream);
using Raster image = Raster.Load(imageStream, Jbig2Format.Info, options: new Jbig2ReaderOptions { Globals = globals });
Exceptions
- CorruptDataException
The data breaks T.88's rules.
- LimitExceededException
The dictionaries break a safety limit.