Package org.apache.tika.parser.pdf.image
Class ImageGraphicsEngine
- java.lang.Object
-
- org.apache.pdfbox.contentstream.PDFStreamEngine
-
- org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine
-
- org.apache.tika.parser.pdf.image.ImageGraphicsEngine
-
public class ImageGraphicsEngine extends org.apache.pdfbox.contentstream.PDFGraphicsStreamEngineCopied nearly verbatim from PDFBox
-
-
Field Summary
Fields Modifier and Type Field Description protected EmbeddedDocumentExtractorembeddedDocumentExtractorprotected booleanextractInlineImageMetadataOnlyprotected AtomicIntegerimageCounterprotected static List<String>JB2protected static List<String>JP2protected static List<String>JPEGprotected static longMAX_IMAGE_LENGTH_BYTESprotected intpageNumberprotected MetadataparentMetadataprotected ParseContextparseContextprotected PDFParserConfigpdfParserConfigprotected Map<org.apache.pdfbox.cos.COSStream,Integer>processedInlineImagesprotected booleanuseDirectJPEGprotected XHTMLContentHandlerxhtml
-
Constructor Summary
Constructors Modifier Constructor Description protectedImageGraphicsEngine(org.apache.pdfbox.pdmodel.PDPage page, int pageNumber, EmbeddedDocumentExtractor embeddedDocumentExtractor, PDFParserConfig pdfParserConfig, Map<org.apache.pdfbox.cos.COSStream,Integer> processedInlineImages, AtomicInteger imageCounter, XHTMLContentHandler xhtml, Metadata parentMetadata, ParseContext parseContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendRectangle(Point2D p0, Point2D p1, Point2D p2, Point2D p3)voidclip(int windingRule)voidclosePath()protected static voidcopyUpToMaxLength(InputStream is, OutputStream os)voidcurveTo(float x1, float y1, float x2, float y2, float x3, float y3)voiddrawImage(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage)voidendPath()protected voidextractInlineImageMetadataOnly(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage, Metadata metadata)voidfillAndStrokePath(int windingRule)voidfillPath(int windingRule)Point2DgetCurrentPoint()List<IOException>getExceptions()protected StringgetSuffix(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage, Metadata metadata)protected voidhandleCatchableIOE(IOException e)protected static booleanhasMasks(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage)voidlineTo(float x, float y)voidmoveTo(float x, float y)protected voidprocessImage(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage, int imageNumber)voidrun()voidshadingFill(org.apache.pdfbox.cos.COSName shadingName)protected voidshowGlyph(org.apache.pdfbox.util.Matrix textRenderingMatrix, org.apache.pdfbox.pdmodel.font.PDFont font, int code, String unicode, org.apache.pdfbox.util.Vector displacement)voidstrokePath()protected BufferedImagewriteToBuffer(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage, String suffix, boolean directJPEG, OutputStream out)-
Methods inherited from class org.apache.pdfbox.contentstream.PDFStreamEngine
addOperator, applyTextAdjustment, beginMarkedContentSequence, beginText, decreaseLevel, endMarkedContentSequence, endText, getAppearance, getCurrentPage, getGraphicsStackSize, getGraphicsState, getInitialMatrix, getLevel, getResources, getTextLineMatrix, getTextMatrix, increaseLevel, operatorException, processAnnotation, processChildStream, processOperator, processOperator, processPage, processSoftMask, processTilingPattern, processTilingPattern, processTransparencyGroup, processType3Stream, registerOperatorProcessor, restoreGraphicsStack, restoreGraphicsState, saveGraphicsStack, saveGraphicsState, setLineDashPattern, setTextLineMatrix, setTextMatrix, showAnnotation, showFontGlyph, showFontGlyph, showForm, showGlyph, showText, showTextString, showTextStrings, showTransparencyGroup, showType3Glyph, showType3Glyph, transformedPoint, transformWidth, unsupportedOperator
-
-
-
-
Field Detail
-
MAX_IMAGE_LENGTH_BYTES
protected static final long MAX_IMAGE_LENGTH_BYTES
- See Also:
- Constant Field Values
-
pageNumber
protected final int pageNumber
-
embeddedDocumentExtractor
protected final EmbeddedDocumentExtractor embeddedDocumentExtractor
-
pdfParserConfig
protected final PDFParserConfig pdfParserConfig
-
processedInlineImages
protected final Map<org.apache.pdfbox.cos.COSStream,Integer> processedInlineImages
-
imageCounter
protected final AtomicInteger imageCounter
-
parentMetadata
protected final Metadata parentMetadata
-
xhtml
protected final XHTMLContentHandler xhtml
-
parseContext
protected final ParseContext parseContext
-
extractInlineImageMetadataOnly
protected final boolean extractInlineImageMetadataOnly
-
useDirectJPEG
protected boolean useDirectJPEG
-
-
Constructor Detail
-
ImageGraphicsEngine
protected ImageGraphicsEngine(org.apache.pdfbox.pdmodel.PDPage page, int pageNumber, EmbeddedDocumentExtractor embeddedDocumentExtractor, PDFParserConfig pdfParserConfig, Map<org.apache.pdfbox.cos.COSStream,Integer> processedInlineImages, AtomicInteger imageCounter, XHTMLContentHandler xhtml, Metadata parentMetadata, ParseContext parseContext)
-
-
Method Detail
-
writeToBuffer
protected BufferedImage writeToBuffer(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage, String suffix, boolean directJPEG, OutputStream out) throws IOException, TikaException
- Throws:
IOExceptionTikaException
-
copyUpToMaxLength
protected static void copyUpToMaxLength(InputStream is, OutputStream os) throws IOException, TikaException
- Throws:
IOExceptionTikaException
-
hasMasks
protected static boolean hasMasks(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage) throws IOException- Throws:
IOException
-
run
public void run() throws IOException- Throws:
IOException
-
drawImage
public void drawImage(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage) throws IOException- Specified by:
drawImagein classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
appendRectangle
public void appendRectangle(Point2D p0, Point2D p1, Point2D p2, Point2D p3) throws IOException
- Specified by:
appendRectanglein classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
clip
public void clip(int windingRule) throws IOException- Specified by:
clipin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
moveTo
public void moveTo(float x, float y) throws IOException- Specified by:
moveToin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
lineTo
public void lineTo(float x, float y) throws IOException- Specified by:
lineToin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
curveTo
public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) throws IOException- Specified by:
curveToin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
getCurrentPoint
public Point2D getCurrentPoint() throws IOException
- Specified by:
getCurrentPointin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
closePath
public void closePath() throws IOException- Specified by:
closePathin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
endPath
public void endPath() throws IOException- Specified by:
endPathin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
showGlyph
protected void showGlyph(org.apache.pdfbox.util.Matrix textRenderingMatrix, org.apache.pdfbox.pdmodel.font.PDFont font, int code, String unicode, org.apache.pdfbox.util.Vector displacement) throws IOException- Overrides:
showGlyphin classorg.apache.pdfbox.contentstream.PDFStreamEngine- Throws:
IOException
-
strokePath
public void strokePath() throws IOException- Specified by:
strokePathin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
fillPath
public void fillPath(int windingRule) throws IOException- Specified by:
fillPathin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
fillAndStrokePath
public void fillAndStrokePath(int windingRule) throws IOException- Specified by:
fillAndStrokePathin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
shadingFill
public void shadingFill(org.apache.pdfbox.cos.COSName shadingName) throws IOException- Specified by:
shadingFillin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
processImage
protected void processImage(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage, int imageNumber) throws IOException, TikaException, SAXException- Throws:
IOExceptionTikaExceptionSAXException
-
extractInlineImageMetadataOnly
protected void extractInlineImageMetadataOnly(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage, Metadata metadata) throws IOException, SAXException- Throws:
IOExceptionSAXException
-
getSuffix
protected String getSuffix(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage, Metadata metadata) throws IOException
- Throws:
IOException
-
handleCatchableIOE
protected void handleCatchableIOE(IOException e) throws IOException
- Throws:
IOException
-
getExceptions
public List<IOException> getExceptions()
-
-