Top Description Inners Fields Constructors Methods
org.apache.pdfbox.preflight.content

public abstract Class PreflightStreamEngine

extends PDFStreamEngine
Class Inheritance
Known Direct Subclasses
org.apache.pdfbox.preflight.font.util.PreflightType3Stream, org.apache.pdfbox.preflight.content.PreflightContentStream
Imports
java.awt.color.ColorSpace, java.io.IOException, java.util.List, org.apache.pdfbox.cos.COSBase, .COSDictionary, .COSName, .COSString, .COSArray, org.apache.pdfbox.pdmodel.PDPage, org.apache.pdfbox.pdmodel.graphics.color.PDCIEBasedColorSpace, .PDColorSpace, .PDICCBased, .PDSeparation, .PDDeviceGray, org.apache.pdfbox.preflight.PreflightConfiguration, .PreflightContext, .ValidationResult.ValidationError, org.apache.pdfbox.preflight.exception.ValidationException, org.apache.pdfbox.preflight.graphic.ColorSpaceHelper, .ColorSpaceHelperFactory, .ColorSpaceHelperFactory.ColorSpaceRestriction, .ColorSpaces, .ICCProfileWrapper, org.apache.pdfbox.preflight.utils.FilterHelper, .RenderingIntents, org.apache.pdfbox.contentstream.operator.DrawObject, .Operator, .OperatorName, org.apache.pdfbox.contentstream.PDFStreamEngine, org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColorN, .SetStrokingColorN, .SetNonStrokingDeviceCMYKColor, .SetNonStrokingColor, .SetNonStrokingColorSpace, .SetNonStrokingDeviceGrayColor, .SetNonStrokingDeviceRGBColor, .SetStrokingDeviceCMYKColor, .SetStrokingColor, .SetStrokingColorSpace, .SetStrokingDeviceGrayColor, .SetStrokingDeviceRGBColor, org.apache.pdfbox.contentstream.operator.text.BeginText, .EndText, .MoveText, .MoveTextSetLeading, .NextLine, .SetCharSpacing, .SetFontAndSize, .SetTextHorizontalScaling, .SetTextLeading, .SetTextRenderingMode, .SetTextRise, .SetWordSpacing, org.apache.pdfbox.contentstream.operator.state.Concatenate, .Restore, .Save, .SetLineCapStyle, .SetLineDashPattern, .SetLineJoinStyle, .SetLineWidth, .SetMatrix, .SetGraphicsStateParameters, org.apache.pdfbox.pdmodel.graphics.state.RenderingMode

This class inherits from org.apache.pdfbox.util.PDFStreamEngine to allow the validation of specific rules in ContentStream.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
protected PreflightContext
protected PDPage

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
checkColorOperators(String
the color operator
operation
)

This method validates if the ColorOperator can be used with the color space defined in OutputIntent dictionaries.

protected void
checkSetColorSpaceOperators(Operator operator, List<COSBase> arguments)

This method validates if the ColorSpace used as operand is consistent with the color space defined in OutputIntent dictionaries.

private PDColorSpace
getColorSpace(String operation)

private ColorSpaceHelper
private boolean
protected void
registerError(String
exception details
msg
,
String
the error code.
errorCode
)

Add a validation error into the PreflightContext

public void
registerError(String msg, String errorCode, Throwable cause)

protected void
registerError(String msg, String errorCode, boolean warning)

public void
registerError(String msg, String errorCode, boolean warning, Throwable cause)

private COSBase
pack-priv void
validateDefaultColorSpace(Operator
an operator.
operator
)

In some cases, the colorspace isn't checked because defaults (/DeviceGray) is used.

protected void
validateInlineImageColorSpace(Operator
the InlinedImage object (BI to EI)
operator
)

This method validates if the ColorSpace used by the InlinedImage is consistent with the color space defined in OutputIntent dictionaries.

protected void
validateInlineImageFilter(Operator
the InlinedImage object (BI to EI)
operator
)

Throw a ContentStreamException if the LZW filter is used in a InlinedImage.

protected void
validateNumberOfGraphicStates(Operator operator)

Valid the number of graphic states if the operator is the Save Graphic state operator ("q")

protected void
validateRenderingIntent(Operator
the "ri" operator
operator
,
List<COSBase>
the "ri" operands
arguments
)

Check operands of the "ri" operator.

private boolean
private boolean
Inherited from org.apache.pdfbox.contentstream.PDFStreamEngine:
addOperatorapplyTextAdjustmentbeginMarkedContentSequencebeginTextdecreaseLevelendMarkedContentSequenceendTextgetAppearancegetCurrentPagegetGraphicsStackSizegetGraphicsStategetInitialMatrixgetLevelgetResourcesgetTextLineMatrixgetTextMatrixincreaseLevelisShouldProcessColorOperatorsoperatorExceptionprocessAnnotationprocessChildStreamprocessOperatorprocessOperatorprocessPageprocessSoftMaskprocessTilingPatternprocessTilingPatternprocessTransparencyGroupprocessType3StreamrestoreGraphicsStackrestoreGraphicsStatesaveGraphicsStacksaveGraphicsStatesetLineDashPatternsetTextLineMatrixsetTextMatrixshowAnnotationshowFontGlyphshowFormshowGlyphshowTextshowTextStringshowTextStringsshowTransparencyGroupshowType3GlyphtransformedPointtransformWidthunsupportedOperator

Field Detail

contextback to summary
protected PreflightContext context
processedPageback to summary
protected PDPage processedPage

Constructor Detail

PreflightStreamEngineback to summary
public PreflightStreamEngine(PreflightContext context, PDPage page)

Method Detail

checkColorOperatorsback to summary
protected void checkColorOperators(String operation) throws ContentStreamException

This method validates if the ColorOperator can be used with the color space defined in OutputIntent dictionaries.

Parameters
operation:String

the color operator

checkSetColorSpaceOperatorsback to summary
protected void checkSetColorSpaceOperators(Operator operator, List<COSBase> arguments) throws IOException

This method validates if the ColorSpace used as operand is consistent with the color space defined in OutputIntent dictionaries.

getColorSpaceback to summary
private PDColorSpace getColorSpace(String operation)
getColorSpaceHelperback to summary
private ColorSpaceHelper getColorSpaceHelper(PDColorSpace pdCS)
isDeviceIndependentback to summary
private boolean isDeviceIndependent(PDColorSpace cs, PreflightStreamEngine.ColorSpaceType expectedIccType)
registerErrorback to summary
protected void registerError(String msg, String errorCode)

Add a validation error into the PreflightContext

Parameters
msg:String

exception details

errorCode:String

the error code.

registerErrorback to summary
public void registerError(String msg, String errorCode, Throwable cause)
registerErrorback to summary
protected void registerError(String msg, String errorCode, boolean warning)
registerErrorback to summary
public void registerError(String msg, String errorCode, boolean warning, Throwable cause)
toLongNameback to summary
private COSBase toLongName(COSBase cs)
validateDefaultColorSpaceback to summary
pack-priv void validateDefaultColorSpace(Operator operator) throws ContentStreamException

In some cases, the colorspace isn't checked because defaults (/DeviceGray) is used. Thus we need to check all text output, stroke and fill for /DeviceGray.

Parameters
operator:Operator

an operator.

validateInlineImageColorSpaceback to summary
protected void validateInlineImageColorSpace(Operator operator) throws IOException

This method validates if the ColorSpace used by the InlinedImage is consistent with the color space defined in OutputIntent dictionaries.

Parameters
operator:Operator

the InlinedImage object (BI to EI)

validateInlineImageFilterback to summary
protected void validateInlineImageFilter(Operator operator)

Throw a ContentStreamException if the LZW filter is used in a InlinedImage.

Parameters
operator:Operator

the InlinedImage object (BI to EI)

validateNumberOfGraphicStatesback to summary
protected void validateNumberOfGraphicStates(Operator operator)

Valid the number of graphic states if the operator is the Save Graphic state operator ("q")

validateRenderingIntentback to summary
protected void validateRenderingIntent(Operator operator, List<COSBase> arguments) throws ContentStreamException

Check operands of the "ri" operator. Operands must exist in the RenderingIntent list. (org.apache.pdfbox.preflight.utils.RenderingIntents)

Parameters
operator:Operator

the "ri" operator

arguments:List<COSBase>

the "ri" operands

Exceptions
ContentStreamException:
ERROR_GRAPHIC_UNEXPECTED_VALUE_FOR_KEY if the operand is invalid
validColorSpaceback to summary
private boolean validColorSpace(PDColorSpace colorSpace, PreflightStreamEngine.ColorSpaceType expectedIccType) throws ContentStreamException
validColorSpaceDestOutputProfileback to summary
private boolean validColorSpaceDestOutputProfile(PreflightStreamEngine.ColorSpaceType expectedType) throws ContentStreamException
org.apache.pdfbox.preflight.content back to summary

private final Enum PreflightStreamEngine.ColorSpaceType

extends Enum<PreflightStreamEngine.ColorSpaceType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final PreflightStreamEngine.ColorSpaceType
public static final PreflightStreamEngine.ColorSpaceType
public static final PreflightStreamEngine.ColorSpaceType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static PreflightStreamEngine.ColorSpaceType
public static PreflightStreamEngine.ColorSpaceType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ALLback to summary
public static final PreflightStreamEngine.ColorSpaceType ALL
CMYKback to summary
public static final PreflightStreamEngine.ColorSpaceType CMYK
RGBback to summary
public static final PreflightStreamEngine.ColorSpaceType RGB

Constructor Detail

ColorSpaceTypeback to summary
private ColorSpaceType()

Method Detail

valueOfback to summary
public static PreflightStreamEngine.ColorSpaceType valueOf(String name)
valuesback to summary
public static PreflightStreamEngine.ColorSpaceType[] values()