public final class InlineImageUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
InlineImageUtils.InlineImageParseException
Simple class in case users need to differentiate an exception from processing
inline images vs other exceptions
|
Modifier and Type | Field and Description |
---|---|
private static Map<PdfName,PdfName> |
inlineImageColorSpaceAbbreviationMap
Map between value abbreviations allowed in dictionary of inline images for COLORSPACE
|
private static Map<PdfName,PdfName> |
inlineImageEntryAbbreviationMap
Map between key abbreviations allowed in dictionary of inline images and their
equivalent image dictionary keys
|
private static Map<PdfName,PdfName> |
inlineImageFilterAbbreviationMap
Map between value abbreviations allowed in dictionary of inline images for FILTER
|
Modifier | Constructor and Description |
---|---|
private |
InlineImageUtils() |
Modifier and Type | Method and Description |
---|---|
private static int |
computeBytesPerRow(PdfDictionary imageDictionary,
PdfDictionary colorSpaceDic)
Computes the number of unfiltered bytes that each row of the image will contain.
|
private static PdfObject |
getAlternateValue(PdfName key,
PdfObject value)
Transforms value abbreviations into their corresponding real value
|
private static int |
getComponentsPerPixel(PdfName colorSpaceName,
PdfDictionary colorSpaceDic) |
static PdfImageObject |
parseInlineImage(PdfContentParser ps,
PdfDictionary colorSpaceDic)
Parses an inline image from the provided content parser.
|
private static PdfDictionary |
parseInlineImageDictionary(PdfContentParser ps)
Parses the next inline image dictionary from the parser.
|
private static byte[] |
parseInlineImageSamples(PdfDictionary imageDictionary,
PdfDictionary colorSpaceDic,
PdfContentParser ps)
Parses the samples of the image from the underlying content parser, accounting for filters
The parser must be positioned immediately after the ID operator that ends the inline image's dictionary.
|
private static byte[] |
parseUnfilteredSamples(PdfDictionary imageDictionary,
PdfDictionary colorSpaceDic,
PdfContentParser ps)
Parses the samples of the image from the underlying content parser, ignoring all filters.
|
private static final Map<PdfName,PdfName> inlineImageEntryAbbreviationMap
private static final Map<PdfName,PdfName> inlineImageColorSpaceAbbreviationMap
private static final Map<PdfName,PdfName> inlineImageFilterAbbreviationMap
private InlineImageUtils()
public static PdfImageObject parseInlineImage(PdfContentParser ps, PdfDictionary colorSpaceDic) throws IOException
ps
- the content parser to use for reading the image.colorSpaceDic
- a color space dictionaryIOException
- if anything goes wring with the parsingInlineImageUtils.InlineImageParseException
- if parsing of the inline image failed due to issues specific to inline image processingprivate static PdfDictionary parseInlineImageDictionary(PdfContentParser ps) throws IOException
ps
- the parser to extract the embedded image information fromIOException
- if the parse failsprivate static PdfObject getAlternateValue(PdfName key, PdfObject value)
key
- the key that the value is forvalue
- the value that might be an abbreviationprivate static int getComponentsPerPixel(PdfName colorSpaceName, PdfDictionary colorSpaceDic)
colorSpaceName
- the name of the color space. If null, a bi-tonal (black and white) color space is assumed.private static int computeBytesPerRow(PdfDictionary imageDictionary, PdfDictionary colorSpaceDic)
imageDictionary
- the dictionary of the inline imageprivate static byte[] parseUnfilteredSamples(PdfDictionary imageDictionary, PdfDictionary colorSpaceDic, PdfContentParser ps) throws IOException
imageDictionary
- the dictionary of the inline imageps
- the content parserIOException
- if anything bad happens during parsingprivate static byte[] parseInlineImageSamples(PdfDictionary imageDictionary, PdfDictionary colorSpaceDic, PdfContentParser ps) throws IOException
imageDictionary
- the dictionary of the inline imageps
- the content parserIOException
- if anything bad happens during parsingWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses