org.apache.fop.render.pdf.pdfbox

## Class PDFBoxAdapter

- java.lang.Object
- - org.apache.fop.render.pdf.pdfbox.PDFBoxAdapter

-     public class PDFBoxAdapter
      extends java.lang.Object

  This class provides an adapter for transferring content from a PDFBox PDDocument to FOP's PDFDocument. It is used to parse PDF using PDFBox and write content using FOP's PDF library.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Map<java.lang.Object,java.lang.Object>` | `clonedVersion`
    `protected int` | `currentMCID`
    `protected static java.util.Set<java.lang.String>` | `FILTER_FILTER`
    `protected static org.apache.commons.logging.Log` | `log` logging instance
    `protected java.util.Map<java.lang.Object,java.lang.Object>` | `objectCache`
    `protected org.apache.fop.pdf.PDFDocument` | `pdfDoc`
    `protected UniqueName` | `uniqueName`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PDFBoxAdapter(org.apache.fop.pdf.PDFPage targetPage, java.util.Map<java.lang.Object,java.lang.Object> objectCachePerFile, java.util.Map<java.lang.Integer,org.apache.fop.pdf.PDFArray> pageNumbers)` Creates a new PDFBoxAdapter.
    `PDFBoxAdapter(org.apache.fop.pdf.PDFPage targetPage, java.util.Map<java.lang.Object,java.lang.Object> objectCachePerFile, java.util.Map<java.lang.Integer,org.apache.fop.pdf.PDFArray> pageNumbers, java.util.Map<java.lang.Object,java.lang.Object> objectCache)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `cacheClonedObject(java.lang.Object base, java.lang.Object cloned)`
    `protected java.lang.Object` | `cloneForNewDocument(java.lang.Object base)`
    `protected java.lang.Object` | `cloneForNewDocument(java.lang.Object base, java.lang.Object keyBase, java.util.Collection exclude)`
    `java.lang.Object` | `createStreamFromPDFBoxPage(org.apache.pdfbox.pdmodel.PDDocument sourceDoc, org.apache.pdfbox.pdmodel.PDPage page, java.lang.String key, java.awt.geom.AffineTransform atdoc, org.apache.fop.fonts.FontInfo fontinfo, java.awt.Rectangle pos)` Creates a stream (from FOP's PDF library) from a PDF page parsed with PDFBox.
    `protected java.lang.Object` | `getCachedClone(java.lang.Object base)`
    `int` | `getCurrentMCID()`
    `org.apache.fop.pdf.PDFPage` | `getTargetPage()`
    `void` | `setCurrentMCID(int currentMCID)`
    `protected void` | `transferDict(org.apache.pdfbox.cos.COSDictionary orgDict, org.apache.fop.pdf.PDFStream targetDict, java.util.Set filter)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### log

          protected static final org.apache.commons.logging.Log log

      logging instance

    - #### FILTER_FILTER

          protected static final java.util.Set<java.lang.String> FILTER_FILTER

    - #### pdfDoc

          protected final org.apache.fop.pdf.PDFDocument pdfDoc

    - #### clonedVersion

          protected final java.util.Map<java.lang.Object,java.lang.Object> clonedVersion

    - #### objectCache

          protected final java.util.Map<java.lang.Object,java.lang.Object> objectCache

    - #### currentMCID

          protected int currentMCID

    - #### uniqueName

          protected UniqueName uniqueName

  - ### Constructor Detail

    - #### PDFBoxAdapter

          public PDFBoxAdapter(org.apache.fop.pdf.PDFPage targetPage,
                               java.util.Map<java.lang.Object,java.lang.Object> objectCachePerFile,
                               java.util.Map<java.lang.Integer,org.apache.fop.pdf.PDFArray> pageNumbers)

      Creates a new PDFBoxAdapter.
      Parameters:
        `targetPage` - The target FOP PDF page object
        `objectCachePerFile` - the object cache for reusing objects shared by multiple pages.
        `pageNumbers` - references to page object numbers

    - #### PDFBoxAdapter

          public PDFBoxAdapter(org.apache.fop.pdf.PDFPage targetPage,
                               java.util.Map<java.lang.Object,java.lang.Object> objectCachePerFile,
                               java.util.Map<java.lang.Integer,org.apache.fop.pdf.PDFArray> pageNumbers,
                               java.util.Map<java.lang.Object,java.lang.Object> objectCache)

  - ### Method Detail

    - #### getTargetPage

          public org.apache.fop.pdf.PDFPage getTargetPage()

    - #### getCurrentMCID

          public int getCurrentMCID()

    - #### setCurrentMCID

          public void setCurrentMCID(int currentMCID)

    - #### getCachedClone

          protected java.lang.Object getCachedClone(java.lang.Object base)
                                             throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### cloneForNewDocument

          protected java.lang.Object cloneForNewDocument(java.lang.Object base)
                                                  throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### cloneForNewDocument

          protected java.lang.Object cloneForNewDocument(java.lang.Object base,
                                                         java.lang.Object keyBase,
                                                         java.util.Collection exclude)
                                                  throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### cacheClonedObject

          protected void cacheClonedObject(java.lang.Object base,
                                           java.lang.Object cloned)
                                    throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### transferDict

          protected void transferDict(org.apache.pdfbox.cos.COSDictionary orgDict,
                                      org.apache.fop.pdf.PDFStream targetDict,
                                      java.util.Set filter)
                               throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### createStreamFromPDFBoxPage

          public java.lang.Object createStreamFromPDFBoxPage(org.apache.pdfbox.pdmodel.PDDocument sourceDoc,
                                                             org.apache.pdfbox.pdmodel.PDPage page,
                                                             java.lang.String key,
                                                             java.awt.geom.AffineTransform atdoc,
                                                             org.apache.fop.fonts.FontInfo fontinfo,
                                                             java.awt.Rectangle pos)
                                                      throws java.io.IOException

      Creates a stream (from FOP's PDF library) from a PDF page parsed with PDFBox.
      Parameters:
        `sourceDoc` - the source PDF the given page to be copied belongs to
        `page` - the page to transform into a stream
        `key` - value to use as key for the stream
        `atdoc` - adjustment for stream
        `fontinfo` - fonts
        `pos` - rectangle
      Returns:
        the stream
      Throws:
        `java.io.IOException` - if an I/O error occurs

Copyright 2007-2022 The Apache Software Foundation. All Rights Reserved.