MCPcopy Index your code
hub / github.com/TomRoush/PdfBox-Android

github.com/TomRoush/PdfBox-Android @v2.0.27.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.0.27.0 ↗ · + Follow
9,001 symbols 33,368 edges 812 files 6,416 documented · 71%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

PdfBox-Android

Maven Central Build Status

A port of Apache's PdfBox library to be usable on Android. Most features should be implemented by now. Feature requests can be added to the issue tracker. Stable releases can be added as a Gradle dependency from Maven Central.

The main code of this project is licensed under the Apache 2.0 License, found at http://www.apache.org/licenses/LICENSE-2.0.html

Usage

Add the following to dependency to build.gradle:

dependencies {
    implementation 'com.tom-roush:pdfbox-android:2.0.26.0'
}

Before calls to PDFBox are made it is required to initialize the library's resource loader. Add the following line before calling PDFBox methods:

PDFBoxResourceLoader.init(getApplicationContext());

An example app is located in the sample directory and includes examples of common tasks.

Optional Dependencies

PdfBox-Android can optionally make use of additional features provided by third-party libraries. These libraries are not included by default to reduce the size of the PdfBox-Android. See the dependencies section in thebuild.gradle of the Sample project for examples of including the optional dependencies.

Reading JPX Images

Android does not come with native support for handling JPX images. These images can be read using the JP2Android library. As JPX is not a common image format, this library is not included with PdfBox-Android by default. If the JP2Android library is not on the classpath of your application, JPX images will be ignored and a warning will be logged.

To include the JP2Android library, add the following to your project's Gradle dependencies section. Note that this library is available in JCenter only, so you will need to add jcenter() to your repository list.

dependencies {
    implementation 'com.gemalto.jp2:jp2-android:1.0.3'
}

Important notes

  • Currently based on PDFBox v2.0.26

  • Requires API 19 or greater for full functionality

Extension points exported contracts — how you extend this code

PDContentStream (Interface)
A content stream. @author John Hewson [7 implementers]
library/src/main/java/com/tom_roush/pdfbox/contentstream/PDContentStream.java
AnnotationFilter (Interface)
Simple interface allowing the use of an annotation filter visitor. @author [20 implementers]
library/src/main/java/com/tom_roush/pdfbox/pdmodel/interactive/annotation/AnnotationFilter.java
PDVectorFont (Interface)
A vector outline font, e.g. not Type 3. @author John Hewson [15 implementers]
library/src/main/java/com/tom_roush/pdfbox/pdmodel/font/PDVectorFont.java
COSObjectable (Interface)
This is an interface used to get/create the underlying COSObject. @author Ben Litchfield [195 implementers]
library/src/main/java/com/tom_roush/pdfbox/pdmodel/common/COSObjectable.java
Operator (Interface)
Interface for PostScript operators. [73 implementers]
library/src/main/java/com/tom_roush/pdfbox/pdmodel/common/function/type4/Operator.java

Core symbols most depended-on inside this repo

getCOSObject
called by 888
library/src/main/java/com/tom_roush/pdfbox/pdmodel/common/COSObjectable.java
setItem
called by 645
library/src/main/java/com/tom_roush/pdfbox/cos/COSDictionary.java
get
called by 623
library/src/main/java/com/tom_roush/pdfbox/cos/COSArray.java
getDictionaryObject
called by 500
library/src/main/java/com/tom_roush/pdfbox/cos/COSObject.java
add
called by 499
library/src/main/java/com/tom_roush/pdfbox/cos/COSArray.java
put
called by 450
library/src/main/java/com/tom_roush/pdfbox/pdmodel/ResourceCache.java
size
called by 368
library/src/main/java/com/tom_roush/pdfbox/cos/COSArray.java
isEmpty
called by 313
library/src/main/java/com/tom_roush/pdfbox/pdmodel/graphics/image/PDImage.java

Shape

Method 8,020
Class 909
Interface 41
Enum 31

Languages

Java100%

Modules by API surface

library/src/main/java/com/tom_roush/pdfbox/text/PDFTextStripper.java106 symbols
library/src/main/java/com/tom_roush/fontbox/cff/CFFParser.java99 symbols
library/src/main/java/com/tom_roush/pdfbox/pdmodel/PDPageContentStream.java91 symbols
library/src/main/java/com/tom_roush/fontbox/afm/FontMetrics.java81 symbols
library/src/main/java/com/tom_roush/pdfbox/pdmodel/documentinterchange/taggedpdf/PDLayoutAttributeObject.java79 symbols
library/src/main/java/com/tom_roush/fontbox/ttf/OS2WindowsMetricsTable.java72 symbols
library/src/main/java/com/tom_roush/pdfbox/pdmodel/font/PDFontDescriptor.java70 symbols
library/src/main/java/com/tom_roush/pdfbox/pdmodel/PDAbstractContentStream.java64 symbols
library/src/main/java/com/tom_roush/pdfbox/pdfparser/COSParser.java58 symbols
library/src/main/java/com/tom_roush/pdfbox/rendering/PageDrawer.java56 symbols
library/src/main/java/com/tom_roush/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateStructure.java56 symbols
library/src/main/java/com/tom_roush/pdfbox/pdmodel/graphics/state/PDGraphicsState.java56 symbols

For agents

$ claude mcp add PdfBox-Android \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact