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.PDFGraphicsStreamEngine
Copied nearly verbatim from PDFBox
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.apache.tika.extractor.EmbeddedDocumentExtractor
     
    protected final boolean
     
    protected final AtomicInteger
     
    protected static final List<String>
     
    protected static final List<String>
     
    protected static final List<String>
     
    protected static final long
     
    protected final int
     
    protected final org.apache.tika.metadata.Metadata
     
    protected final org.apache.tika.parser.ParseContext
     
    protected final PDFParserConfig
     
    protected final Map<org.apache.pdfbox.cos.COSStream,Integer>
     
    protected boolean
     
    protected final org.apache.tika.sax.XHTMLContentHandler
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    ImageGraphicsEngine(org.apache.pdfbox.pdmodel.PDPage page, int pageNumber, org.apache.tika.extractor.EmbeddedDocumentExtractor embeddedDocumentExtractor, PDFParserConfig pdfParserConfig, Map<org.apache.pdfbox.cos.COSStream,Integer> processedInlineImages, AtomicInteger imageCounter, org.apache.tika.sax.XHTMLContentHandler xhtml, org.apache.tika.metadata.Metadata parentMetadata, org.apache.tika.parser.ParseContext parseContext)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    clip(int windingRule)
     
    void
     
    protected static void
     
    void
    curveTo(float x1, float y1, float x2, float y2, float x3, float y3)
     
    void
    drawImage(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage)
     
    void
     
    protected void
    extractInlineImageMetadataOnly(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage, org.apache.tika.metadata.Metadata metadata)
     
    void
    fillAndStrokePath(int windingRule)
     
    void
    fillPath(int windingRule)
     
     
     
    protected String
    getSuffix(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage, org.apache.tika.metadata.Metadata metadata)
     
    protected void
     
    protected static boolean
    hasMasks(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage)
     
    void
    lineTo(float x, float y)
     
    void
    moveTo(float x, float y)
     
    protected void
    processImage(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage, int imageNumber)
     
    void
    run()
     
    void
    shadingFill(org.apache.pdfbox.cos.COSName shadingName)
     
    protected void
    showGlyph(org.apache.pdfbox.util.Matrix textRenderingMatrix, org.apache.pdfbox.pdmodel.font.PDFont font, int code, org.apache.pdfbox.util.Vector displacement)
     
    void
     
    protected BufferedImage
    writeToBuffer(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage, String suffix, boolean directJPEG, OutputStream out)
     

    Methods inherited from class org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine

    getPage

    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, restoreGraphicsStack, restoreGraphicsState, saveGraphicsStack, saveGraphicsState, setLineDashPattern, setTextLineMatrix, setTextMatrix, showAnnotation, showFontGlyph, showForm, showText, showTextString, showTextStrings, showTransparencyGroup, showType3Glyph, transformedPoint, transformWidth, unsupportedOperator

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MAX_IMAGE_LENGTH_BYTES

      protected static final long MAX_IMAGE_LENGTH_BYTES
      See Also:
    • JPEG

      protected static final List<String> JPEG
    • JP2

      protected static final List<String> JP2
    • JB2

      protected static final List<String> JB2
    • pageNumber

      protected final int pageNumber
    • embeddedDocumentExtractor

      protected final org.apache.tika.extractor.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 org.apache.tika.metadata.Metadata parentMetadata
    • xhtml

      protected final org.apache.tika.sax.XHTMLContentHandler xhtml
    • parseContext

      protected final org.apache.tika.parser.ParseContext parseContext
    • extractInlineImageMetadataOnly

      protected final boolean extractInlineImageMetadataOnly
    • useDirectJPEG

      protected boolean useDirectJPEG
  • Constructor Details

    • ImageGraphicsEngine

      protected ImageGraphicsEngine(org.apache.pdfbox.pdmodel.PDPage page, int pageNumber, org.apache.tika.extractor.EmbeddedDocumentExtractor embeddedDocumentExtractor, PDFParserConfig pdfParserConfig, Map<org.apache.pdfbox.cos.COSStream,Integer> processedInlineImages, AtomicInteger imageCounter, org.apache.tika.sax.XHTMLContentHandler xhtml, org.apache.tika.metadata.Metadata parentMetadata, org.apache.tika.parser.ParseContext parseContext)
  • Method Details

    • writeToBuffer

      protected BufferedImage writeToBuffer(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage, String suffix, boolean directJPEG, OutputStream out) throws IOException, org.apache.tika.exception.TikaException
      Throws:
      IOException
      org.apache.tika.exception.TikaException
    • copyUpToMaxLength

      protected static void copyUpToMaxLength(InputStream is, OutputStream os) throws IOException, org.apache.tika.exception.TikaException
      Throws:
      IOException
      org.apache.tika.exception.TikaException
    • 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:
      drawImage in class org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine
      Throws:
      IOException
    • appendRectangle

      public void appendRectangle(Point2D p0, Point2D p1, Point2D p2, Point2D p3) throws IOException
      Specified by:
      appendRectangle in class org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine
      Throws:
      IOException
    • clip

      public void clip(int windingRule) throws IOException
      Specified by:
      clip in class org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine
      Throws:
      IOException
    • moveTo

      public void moveTo(float x, float y) throws IOException
      Specified by:
      moveTo in class org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine
      Throws:
      IOException
    • lineTo

      public void lineTo(float x, float y) throws IOException
      Specified by:
      lineTo in class org.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:
      curveTo in class org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine
      Throws:
      IOException
    • getCurrentPoint

      public Point2D getCurrentPoint() throws IOException
      Specified by:
      getCurrentPoint in class org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine
      Throws:
      IOException
    • closePath

      public void closePath() throws IOException
      Specified by:
      closePath in class org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine
      Throws:
      IOException
    • endPath

      public void endPath() throws IOException
      Specified by:
      endPath in class org.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, org.apache.pdfbox.util.Vector displacement) throws IOException
      Overrides:
      showGlyph in class org.apache.pdfbox.contentstream.PDFStreamEngine
      Throws:
      IOException
    • strokePath

      public void strokePath() throws IOException
      Specified by:
      strokePath in class org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine
      Throws:
      IOException
    • fillPath

      public void fillPath(int windingRule) throws IOException
      Specified by:
      fillPath in class org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine
      Throws:
      IOException
    • fillAndStrokePath

      public void fillAndStrokePath(int windingRule) throws IOException
      Specified by:
      fillAndStrokePath in class org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine
      Throws:
      IOException
    • shadingFill

      public void shadingFill(org.apache.pdfbox.cos.COSName shadingName) throws IOException
      Specified by:
      shadingFill in class org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine
      Throws:
      IOException
    • processImage

      protected void processImage(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage, int imageNumber) throws IOException, org.apache.tika.exception.TikaException, SAXException
      Throws:
      IOException
      org.apache.tika.exception.TikaException
      SAXException
    • extractInlineImageMetadataOnly

      protected void extractInlineImageMetadataOnly(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage, org.apache.tika.metadata.Metadata metadata) throws IOException, SAXException
      Throws:
      IOException
      SAXException
    • getSuffix

      protected String getSuffix(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage, org.apache.tika.metadata.Metadata metadata) throws IOException
      Throws:
      IOException
    • handleCatchableIOE

      protected void handleCatchableIOE(IOException e) throws IOException
      Throws:
      IOException
    • getExceptions

      public List<IOException> getExceptions()