public class PdfModule extends ModuleBase
Modifier and Type | Field and Description |
---|---|
protected boolean |
_actionsExist |
protected ObjectStream |
_cachedObjectStream
Cached object stream.
|
protected int |
_cachedStreamIndex
Object number of cached object stream.
|
protected Map<Integer,PdfObject> |
_cid0FontsMap |
protected Map<Integer,PdfObject> |
_cid2FontsMap |
protected NameTreeNode |
_destNames |
protected PdfDictionary |
_destsDict |
protected List<Property> |
_docCatalogList |
protected PdfDictionary |
_docCatDict |
protected PdfIndirectObj |
_docCatDictRef |
protected PdfDictionary |
_docInfoDict |
protected PdfIndirectObj |
_docInfoDictRef |
protected List<Property> |
_docInfoList |
protected PageTreeNode |
_docTreeRoot |
protected NameTreeNode |
_embeddedFiles |
protected PdfDictionary |
_encryptDict |
protected PdfIndirectObj |
_encryptDictRef |
protected boolean |
_encrypted |
protected List<Property> |
_encryptList |
protected long |
_eof |
protected List<Property> |
_extStreamsList |
protected List<Property> |
_filtersList |
protected Property |
_idProperty |
protected List<Property> |
_imagesList |
protected Logger |
_logger
Logger for this class.
|
protected Property |
_metadata |
protected Map<Integer,PdfObject> |
_mmFontsMap |
protected int |
_nFonts
Number of fonts reported so far.
|
protected int |
_numFreeObjects |
protected int |
_numObjects |
protected int |
_numTrailers |
protected int |
_objCount |
protected Map |
_objects |
protected PdfDictionary |
_outlineDict |
protected PdfDictionary |
_pageLabelDict |
protected PageLabelNode |
_pageLabelRoot |
protected PdfIndirectObj |
_pagesDictRef |
protected Map<Integer,Integer> |
_pageSeqMap |
protected List<Property> |
_pagesList |
protected Parser |
_parser |
protected boolean |
_pdfACompliant |
protected long |
_prevxref |
protected List<PdfProfile> |
_profile
List of profile checkers
|
protected RandomAccessFile |
_raf |
protected boolean |
_recursionWarned |
protected boolean |
_showAnnotations |
protected boolean |
_showFonts |
protected boolean |
_showOutlines |
protected boolean |
_showPages |
protected boolean |
_skippedAnnotationsReported |
protected boolean |
_skippedFontsReported |
protected boolean |
_skippedOutlinesReported |
protected boolean |
_skippedPagesReported |
protected long |
_startxref |
protected PdfDictionary |
_trailerDict |
protected Map<Integer,PdfObject> |
_trueTypeFontsMap |
protected Map<Integer,PdfObject> |
_type0FontsMap |
protected Map<Integer,PdfObject> |
_type1FontsMap |
protected Map<Integer,PdfObject> |
_type3FontsMap |
protected String |
_version |
protected PdfDictionary |
_viewPrefDict |
protected Set<Integer> |
_visitedOutlineNodes
Map of visited nodes when walking through an outline.
|
protected Property |
_xmpProp |
protected long[] |
_xref |
protected int[][] |
_xref2 |
protected boolean |
_xrefIsStream |
protected int |
DEFAULT_MAX_FONTS
PRIVATE INSTANCE FIELDS.
|
static int |
F_CID0
Font type selectors.
|
static int |
F_CID2
Font type selectors.
|
static int |
F_MM1
Font type selectors.
|
static int |
F_TT
Font type selectors.
|
static int |
F_TYPE0
Font type selectors.
|
static int |
F_TYPE1
Font type selectors.
|
static int |
F_TYPE3
Font type selectors.
|
protected int |
maxFonts
maximum number of fonts to report full information on.
|
protected static String |
outlinesRecursiveString |
_app, _bigEndian, _checksumFinished, _countStream, _coverage, _crc32, _date, _defaultParams, _features, _format, _init, _isRandomAccess, _je, _md5, _mimeType, _name, _nByte, _note, _param, _release, _repInfoNote, _rights, _sha1, _signature, _specification, _validityNote, _vendor, _verbosity, _wellFormedNote
MAXIMUM_VERBOSITY, MINIMUM_VERBOSITY
Constructor and Description |
---|
PdfModule()
Creates an instance of the module and initializes identifying
information.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addDateProperty(PdfDictionary dict,
List<Property> propList,
String key,
String propName)
Add a date property, based on a dictionary entry
with a string value, to a specified List.
|
protected void |
addDestination(PdfObject itemObj,
String propName,
List<Property> propList,
RepInfo info) |
protected void |
addFontsProperty(List<Property> metadataList)
Add the various font lists as a fonts property.
|
protected String |
addFontToMap(PdfDictionary font)
Add the font to the appropriate map, and return its subtype.
|
protected void |
addPagesProperty(List<Property> metadataList,
RepInfo info) |
protected void |
addStringProperty(PdfDictionary dict,
List<Property> propList,
String key,
String propName)
Add a string property, based on a dictionary entry
with a string value, to a specified List.
|
protected Property |
buildAnnotProperty(PdfDictionary annot,
RepInfo info) |
protected Property |
buildBitmaskProperty(int val,
String name,
String[] valueNames,
String defaultStr) |
protected Property |
buildCIDInfoProperty(PdfDictionary dict) |
protected Property |
buildCMapDictProperty(PdfStream encoding) |
protected Property |
buildEncodingDictProperty(PdfDictionary encodingDict) |
protected Property |
buildFontDescriptorProperty(PdfDictionary encodingDict) |
protected Property |
buildFontProperty(String name,
Map map,
int fontType) |
protected Property |
buildMeasureProperty(PdfDictionary meas) |
protected Property |
buildOutlineItemProperty(PdfDictionary dict,
RepInfo info) |
protected Property |
buildOutlinesProperty(PdfDictionary dict,
RepInfo info) |
protected Property |
buildPageLabelProperty(PageObject page,
int pageIndex,
int[] nomNumRef) |
protected Property |
buildPageProperty(PageObject page,
int idx,
RepInfo info) |
protected Property |
buildUserPermProperty(int flags,
String[] flagStrs) |
protected Property |
buildViewPrefProperty(PdfDictionary prefDict) |
protected boolean |
doOutlineStuff(RepInfo info) |
protected String |
extractFilters(Filter[] filters,
PdfStream stream)
Finds the filters in a stream or array object which is the value
of a stream's Filter key, and put them in _filtersList
if a duplicate isn't there already.
|
protected void |
findExternalStreams(RepInfo info) |
protected boolean |
findFilters(RepInfo info)
Locates the filters in the content stream dictionaries
and generate a list of unique pipelines.
|
protected void |
findFonts(RepInfo info) |
protected void |
findImages(RepInfo info) |
protected boolean |
findLastTrailer(RepInfo info)
Locate the last trailer of the file
|
boolean |
getActionsExist()
Return true if Actions have been detected in the file.
|
PdfDictionary |
getCatalogDict()
Returns the catalog dictionary object.
|
PdfDictionary |
getDocInfo()
Returns the document information dictionary.
|
PageTreeNode |
getDocumentTree()
Returns the document tree root.
|
NameTreeNode |
getEmbeddedFiles()
Returns a NameTreeNode for the EmbeddedFiles entry of the
Names dictionary.
|
PdfDictionary |
getEncryptionDict()
Returns the encryption dictionary.
|
RandomAccessFile |
getFile()
Return the RandomAccessFile being read.
|
Map<Integer,PdfObject> |
getFontMap(int selector)
Get a font map.
|
List<Map<Integer,PdfObject>> |
getFontMaps()
Return a List of all the font maps.
|
protected PdfObject |
getObject(int objIndex,
int recGuard)
Returns an object of a given number.
|
PdfDictionary |
getOutlineDict()
Returns the outlines dictionary object.
|
PdfDictionary |
getTrailerDict()
Returns the trailer dictionary object.
|
PdfDictionary |
getViewPrefDict()
Returns the viewer preferences dictionary object.
|
protected void |
initParse()
Initialize the module.
|
protected boolean |
isFontSubset(String baseStr) |
protected Property |
makeRectProperty(PdfArray arrObj,
String name) |
boolean |
mayBePDFACompliant()
Returns true if the module hasn't detected any violations
of PDF/A compliance.
|
protected int |
nameToNiso(String name,
String[] nameArray,
int[] valArray) |
protected List<Property> |
oneFontPropList(PdfDictionary dict,
int fontType) |
void |
param(String param)
Per-action initialization.
|
void |
parse(RandomAccessFile raf,
RepInfo info)
Parses a file and stores descriptive information.
|
protected boolean |
parseHeader(RepInfo info) |
protected boolean |
parseTrailer(RepInfo info,
boolean prevOnly) |
protected boolean |
readDocCatalogDict(RepInfo info) |
protected boolean |
readDocInfoDict(RepInfo info) |
protected boolean |
readDocumentTree(RepInfo info) |
protected boolean |
readEncryptDict(RepInfo info) |
protected boolean |
readPageLabelTree(RepInfo info) |
protected boolean |
readXMPData(RepInfo info) |
protected boolean |
readXRefInfo(RepInfo info) |
protected boolean |
readXRefStreams(RepInfo info) |
protected boolean |
readXRefTables(RepInfo info) |
void |
resetParams()
Reset parameter settings.
|
protected int |
resolveIndirectDest(PdfSimpleObject key) |
PdfObject |
resolveIndirectObject(PdfObject obj)
If the argument is an indirect object reference,
returns the object it resolves to, otherwise returns
the object itself.
|
protected static String |
toHex(String s)
PRIVATE CLASS METHODS.
|
protected static String |
toHex(Vector<Integer> v) |
addIntegerProperty, addIntegerProperty, applyDefaultParams, calcRAChecksum, checkSignatures, checkSignatures, getApp, getBase, getBufferedDataStream, getCoverage, getCRC32, getDate, getDefaultParams, getFeatures, getFormat, getMimeType, getName, getNByte, getNote, getRelease, getRepInfoNote, getRights, getSignature, getSpecification, getValidityNote, getVendor, getWellFormedNote, hasFeature, init, initFeatures, isBigEndian, isRandomAccess, parse, readByteBuf, readDouble, readDouble, readDouble, readFloat, readFloat, readSignedByte, readSignedByte, readSignedByte, readSignedInt, readSignedInt, readSignedInt, readSignedLong, readSignedRational, readSignedRational, readSignedShort, readSignedShort, readSignedShort, readUnsignedByte, readUnsignedByte, readUnsignedByte, readUnsignedInt, readUnsignedInt, readUnsignedInt, readUnsignedRational, readUnsignedRational, readUnsignedRational, readUnsignedShort, readUnsignedShort, readUnsignedShort, setApp, setBase, setChecksums, setCRC32, setDefaultParams, setMD5, setNByte, setSHA1, setValidityNote, setVerbosity, show, skipBytes, skipBytes, vectorToPropArray
protected Logger _logger
public static final int F_TYPE0
public static final int F_TYPE1
public static final int F_TT
public static final int F_TYPE3
public static final int F_MM1
public static final int F_CID0
public static final int F_CID2
protected int DEFAULT_MAX_FONTS
protected RandomAccessFile _raf
protected Parser _parser
protected String _version
protected Property _metadata
protected Property _xmpProp
protected long _eof
protected long _startxref
protected long _prevxref
protected int _numFreeObjects
protected Property _idProperty
protected int _objCount
protected int _numObjects
protected int _numTrailers
protected Map _objects
protected long[] _xref
protected int[][] _xref2
protected boolean _xrefIsStream
protected boolean _encrypted
protected PdfIndirectObj _docCatDictRef
protected PdfIndirectObj _encryptDictRef
protected PdfIndirectObj _docInfoDictRef
protected PdfIndirectObj _pagesDictRef
protected PdfDictionary _docCatDict
protected PdfDictionary _docInfoDict
protected PageTreeNode _docTreeRoot
protected PdfDictionary _pageLabelDict
protected PageLabelNode _pageLabelRoot
protected NameTreeNode _embeddedFiles
protected NameTreeNode _destNames
protected PdfDictionary _encryptDict
protected PdfDictionary _trailerDict
protected PdfDictionary _viewPrefDict
protected PdfDictionary _outlineDict
protected PdfDictionary _destsDict
protected boolean _showFonts
protected boolean _showOutlines
protected boolean _showAnnotations
protected boolean _showPages
protected boolean _actionsExist
protected boolean _pdfACompliant
protected boolean _recursionWarned
protected boolean _skippedFontsReported
protected boolean _skippedOutlinesReported
protected boolean _skippedAnnotationsReported
protected boolean _skippedPagesReported
protected List<PdfProfile> _profile
protected ObjectStream _cachedObjectStream
protected int _cachedStreamIndex
protected Set<Integer> _visitedOutlineNodes
protected int maxFonts
protected int _nFonts
protected static final String outlinesRecursiveString
public PdfModule()
public void resetParams() throws Exception
resetParams
in interface Module
resetParams
in class ModuleBase
Exception
public void param(String param)
param
in interface Module
param
in class ModuleBase
param
- The module parameter; under command-line Jhove, the -p parameter.
If the parameter contains the indicated characters, then the
specified information is omitted; otherwise, it is included.
(This is the reverse of the behavior prior to beta 3.)
These characters may be provided as separate parameters,
or all in a single parameter.
public final void parse(RandomAccessFile raf, RepInfo info) throws IOException
parse
in interface Module
parse
in class ModuleBase
raf
- A PDF fileinfo
- A clean RepInfo object, which will be modified to hold
the descriptive informationIOException
public boolean mayBePDFACompliant()
AProfile
profiler makes the final determination.public PageTreeNode getDocumentTree()
public PdfDictionary getDocInfo()
public PdfDictionary getEncryptionDict()
public boolean getActionsExist()
protected final void initParse()
initParse
in class ModuleBase
protected boolean parseHeader(RepInfo info) throws IOException
IOException
protected boolean findLastTrailer(RepInfo info) throws IOException
IOException
protected boolean parseTrailer(RepInfo info, boolean prevOnly) throws IOException
IOException
protected boolean readXRefInfo(RepInfo info) throws IOException
IOException
protected boolean readXRefStreams(RepInfo info) throws IOException
IOException
protected boolean readXRefTables(RepInfo info) throws IOException
IOException
protected boolean readDocCatalogDict(RepInfo info) throws IOException
IOException
protected boolean readEncryptDict(RepInfo info) throws IOException
IOException
protected boolean readDocInfoDict(RepInfo info) throws IOException
IOException
protected boolean readDocumentTree(RepInfo info) throws IOException
IOException
protected boolean readPageLabelTree(RepInfo info)
protected boolean readXMPData(RepInfo info)
protected void findExternalStreams(RepInfo info) throws IOException
IOException
protected boolean findFilters(RepInfo info) throws IOException
false
if the filter structure is
defective.IOException
protected String extractFilters(Filter[] filters, PdfStream stream)
protected void findImages(RepInfo info) throws IOException
IOException
protected void findFonts(RepInfo info) throws IOException
IOException
protected String addFontToMap(PdfDictionary font)
public PdfObject resolveIndirectObject(PdfObject obj) throws PdfException, IOException
PdfException
IOException
protected PdfObject getObject(int objIndex, int recGuard) throws PdfException, IOException
objIndex
- The object number to look uprecGuard
- The maximum permitted number of recursion levels;
no particular value is required, but 30 or more
should avoid false exceptions.PdfException
IOException
public RandomAccessFile getFile()
public PdfDictionary getCatalogDict()
public PdfDictionary getTrailerDict()
public PdfDictionary getViewPrefDict()
public PdfDictionary getOutlineDict()
public Map<Integer,PdfObject> getFontMap(int selector)
public List<Map<Integer,PdfObject>> getFontMaps()
public NameTreeNode getEmbeddedFiles()
protected void addFontsProperty(List<Property> metadataList)
protected Property buildPageProperty(PageObject page, int idx, RepInfo info) throws PdfException
PdfException
protected Property buildPageLabelProperty(PageObject page, int pageIndex, int[] nomNumRef) throws PdfException
PdfException
protected Property buildMeasureProperty(PdfDictionary meas)
protected Property buildAnnotProperty(PdfDictionary annot, RepInfo info) throws PdfException
PdfException
protected void addDestination(PdfObject itemObj, String propName, List<Property> propList, RepInfo info)
protected List<Property> oneFontPropList(PdfDictionary dict, int fontType)
protected Property buildCIDInfoProperty(PdfDictionary dict)
protected Property buildEncodingDictProperty(PdfDictionary encodingDict)
protected Property buildFontDescriptorProperty(PdfDictionary encodingDict)
protected Property buildViewPrefProperty(PdfDictionary prefDict)
protected boolean isFontSubset(String baseStr)
protected Property buildOutlinesProperty(PdfDictionary dict, RepInfo info) throws PdfException
PdfException
protected Property buildOutlineItemProperty(PdfDictionary dict, RepInfo info) throws PdfException
PdfException
protected boolean doOutlineStuff(RepInfo info)
protected int resolveIndirectDest(PdfSimpleObject key) throws PdfException
PdfException
protected void addStringProperty(PdfDictionary dict, List<Property> propList, String key, String propName)
protected void addDateProperty(PdfDictionary dict, List<Property> propList, String key, String propName) throws PdfException
PdfException
protected Property buildBitmaskProperty(int val, String name, String[] valueNames, String defaultStr)
Copyright © 2008–2017 The Open Preservation Foundation. All rights reserved.