Package com.itextpdf.text
Class Jpeg
- java.lang.Object
-
- com.itextpdf.text.Rectangle
-
- com.itextpdf.text.Image
-
- com.itextpdf.text.Jpeg
-
- All Implemented Interfaces:
Indentable
,Spaceable
,Element
,IAccessibleElement
,IAlternateDescription
public class Jpeg extends Image
AnJpeg
is the representation of a graphic element (JPEG) that has to be inserted into the document
-
-
Field Summary
Fields Modifier and Type Field Description private byte[][]
icc
static byte[]
JFIF_ID
sequence that is used in all Jpeg filesstatic int
M_APP0
Marker valuestatic int
M_APP2
Marker valuestatic int
M_APPD
Marker value for Photoshop IRBstatic int
M_APPE
Marker valuestatic int
NOPARAM_MARKER
This is a type of marker.static int[]
NOPARAM_MARKERS
Jpeg markers without additional parameters.static int
NOT_A_MARKER
This is a type of marker.static byte[]
PS_8BIM_RESO
sequence preceding Photoshop resolution datastatic int
UNSUPPORTED_MARKER
This is a type of marker.static int[]
UNSUPPORTED_MARKERS
Unsupported Jpeg markers.static int
VALID_MARKER
This is a type of marker.static int[]
VALID_MARKERS
Acceptable Jpeg markers.-
Fields inherited from class com.itextpdf.text.Image
absoluteX, absoluteY, accessibleAttributes, alignment, alt, annotation, AX, AY, bpc, BX, BY, colorspace, colortransform, compressionLevel, CX, CY, DEFAULT, deflated, dpiX, dpiY, DX, DY, imageMask, indentationLeft, indentationRight, interpolation, invert, layer, LEFT, mask, MIDDLE, mySerialId, ORIGINAL_BMP, ORIGINAL_GIF, ORIGINAL_JBIG2, ORIGINAL_JPEG, ORIGINAL_JPEG2000, ORIGINAL_NONE, ORIGINAL_PNG, ORIGINAL_PS, ORIGINAL_TIFF, ORIGINAL_WMF, originalData, originalType, paddingTop, plainHeight, plainWidth, profile, rawData, RIGHT, role, rotationRadians, scaledHeight, scaledWidth, scaleToFitHeight, scaleToFitLineWhenOverflow, serialId, spacingAfter, spacingBefore, template, TEXTWRAP, transparency, type, UNDERLYING, url
-
Fields inherited from class com.itextpdf.text.Rectangle
backgroundColor, border, borderColor, borderColorBottom, borderColorLeft, borderColorRight, borderColorTop, borderWidth, borderWidthBottom, borderWidthLeft, borderWidthRight, borderWidthTop, BOTTOM, BOX, llx, lly, NO_BORDER, rotation, TOP, UNDEFINED, urx, ury, useVariableBorders
-
Fields inherited from interface com.itextpdf.text.Element
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, BODY, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CHAPTER, CHUNK, CREATIONDATE, CREATOR, DIV, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LANGUAGE, LIST, LISTITEM, MARKED, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, SECTION, SUBJECT, TITLE, WRITABLE_DIRECT, YMARK
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static int
getShort(java.io.InputStream is)
Reads a short from theInputStream
.private static int
marker(int marker)
Returns a type of marker.private void
processParameters()
This method checks if the image is a valid JPEG and processes some parameters.-
Methods inherited from class com.itextpdf.text.Image
getAbsoluteX, getAbsoluteY, getAccessibleAttribute, getAccessibleAttributes, getAdditional, getAlignment, getAlt, getAnnotation, getBpc, getColorspace, getColorTransform, getCompressionLevel, getDirectReference, getDpiX, getDpiY, getICCProfile, getId, getImageMask, getImageRotation, getIndentationLeft, getIndentationRight, getInitialRotation, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getLayer, getMySerialId, getOriginalData, getOriginalType, getPaddingTop, getPlainHeight, getPlainWidth, getRawData, getRole, getScaledHeight, getScaledWidth, getSerialId, getSpacingAfter, getSpacingBefore, getTemplateData, getTransparency, getUrl, getWidthPercentage, getXYRatio, hasAbsoluteX, hasAbsoluteY, hasICCProfile, isDeflated, isImgRaw, isImgTemplate, isInline, isInterpolation, isInverted, isJpeg, isMask, isMaskCandidate, isNestable, isScaleToFitHeight, isScaleToFitLineWhenOverflow, isSmask, makeMask, matrix, matrix, scaleAbsolute, scaleAbsolute, scaleAbsoluteHeight, scaleAbsoluteWidth, scalePercent, scalePercent, scaleToFit, scaleToFit, setAbsolutePosition, setAccessibleAttribute, setAdditional, setAlignment, setAlt, setAnnotation, setColorTransform, setCompressionLevel, setDeflated, setDirectReference, setDpi, setId, setImageMask, setIndentationLeft, setIndentationRight, setInitialRotation, setInterpolation, setInverted, setLayer, setOriginalData, setOriginalType, setPaddingTop, setRole, setRotation, setRotationDegrees, setScaleToFitHeight, setScaleToFitLineWhenOverflow, setSmask, setSpacingAfter, setSpacingBefore, setTemplateData, setTransparency, setUrl, setWidthPercentage, setXYRatio, simplifyColorspace, tagICC, type
-
Methods inherited from class com.itextpdf.text.Rectangle
cloneNonPositionParameters, disableBorderSide, enableBorderSide, equals, getBackgroundColor, getBorder, getBorderColor, getBorderColorBottom, getBorderColorLeft, getBorderColorRight, getBorderColorTop, getBorderWidth, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getBottom, getBottom, getChunks, getGrayFill, getHeight, getLeft, getLeft, getRight, getRight, getRotation, getTop, getTop, getWidth, hasBorder, hasBorders, isContent, isUseVariableBorders, normalize, process, rectangle, rotate, setBackgroundColor, setBorder, setBorderColor, setBorderColorBottom, setBorderColorLeft, setBorderColorRight, setBorderColorTop, setBorderWidth, setBorderWidthBottom, setBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, setBottom, setGrayFill, setLeft, setRight, setRotation, setTop, setUseVariableBorders, softCloneNonPositionParameters, toString
-
-
-
-
Field Detail
-
NOT_A_MARKER
public static final int NOT_A_MARKER
This is a type of marker.- See Also:
- Constant Field Values
-
VALID_MARKER
public static final int VALID_MARKER
This is a type of marker.- See Also:
- Constant Field Values
-
VALID_MARKERS
public static final int[] VALID_MARKERS
Acceptable Jpeg markers.
-
UNSUPPORTED_MARKER
public static final int UNSUPPORTED_MARKER
This is a type of marker.- See Also:
- Constant Field Values
-
UNSUPPORTED_MARKERS
public static final int[] UNSUPPORTED_MARKERS
Unsupported Jpeg markers.
-
NOPARAM_MARKER
public static final int NOPARAM_MARKER
This is a type of marker.- See Also:
- Constant Field Values
-
NOPARAM_MARKERS
public static final int[] NOPARAM_MARKERS
Jpeg markers without additional parameters.
-
M_APP0
public static final int M_APP0
Marker value- See Also:
- Constant Field Values
-
M_APP2
public static final int M_APP2
Marker value- See Also:
- Constant Field Values
-
M_APPE
public static final int M_APPE
Marker value- See Also:
- Constant Field Values
-
M_APPD
public static final int M_APPD
Marker value for Photoshop IRB- See Also:
- Constant Field Values
-
JFIF_ID
public static final byte[] JFIF_ID
sequence that is used in all Jpeg files
-
PS_8BIM_RESO
public static final byte[] PS_8BIM_RESO
sequence preceding Photoshop resolution data
-
icc
private byte[][] icc
-
-
Constructor Detail
-
Jpeg
Jpeg(Image image)
-
Jpeg
public Jpeg(java.net.URL url) throws BadElementException, java.io.IOException
Constructs aJpeg
-object, using an url.- Parameters:
url
- theURL
where the image can be found- Throws:
BadElementException
java.io.IOException
-
Jpeg
public Jpeg(byte[] img) throws BadElementException, java.io.IOException
Constructs aJpeg
-object from memory.- Parameters:
img
- the memory image- Throws:
BadElementException
java.io.IOException
-
Jpeg
public Jpeg(byte[] img, float width, float height) throws BadElementException, java.io.IOException
Constructs aJpeg
-object from memory.- Parameters:
img
- the memory image.width
- the width you want the image to haveheight
- the height you want the image to have- Throws:
BadElementException
java.io.IOException
-
-
Method Detail
-
getShort
private static final int getShort(java.io.InputStream is) throws java.io.IOException
Reads a short from theInputStream
.- Parameters:
is
- theInputStream
- Returns:
- an int
- Throws:
java.io.IOException
-
marker
private static final int marker(int marker)
Returns a type of marker.- Parameters:
marker
- an int- Returns:
- a type: VALID_MARKER, UNSUPPORTED_MARKER or NOPARAM_MARKER
-
processParameters
private void processParameters() throws BadElementException, java.io.IOException
This method checks if the image is a valid JPEG and processes some parameters.- Throws:
BadElementException
java.io.IOException
-
-