public class PdfReader extends Object implements PdfViewerPreferences
Modifier and Type | Field and Description |
---|---|
protected PRAcroForm |
acroForm |
protected boolean |
acroFormParsed |
protected PdfDictionary |
catalog |
protected Certificate |
certificate |
protected Key |
certificateKey |
protected String |
certificateKeyProvider |
protected boolean |
consolidateNamedDestinations |
protected static Counter |
COUNTER |
static boolean |
debugmode |
protected PdfEncryption |
decrypt |
protected boolean |
encrypted |
protected long |
eofPos |
protected ExternalDecryptionProcess |
externalDecryptionProcess |
protected int |
freeXref |
protected long |
lastXref |
protected boolean |
newXrefType |
protected HashMap<Integer,IntHashtable> |
objStmMark |
protected LongHashtable |
objStmToOffset |
protected com.itextpdf.text.pdf.PdfReader.PageRefs |
pageRefs |
protected byte[] |
password |
protected char |
pdfVersion |
protected long |
pValue |
protected boolean |
rebuilt |
protected boolean |
remoteToLocalNamedDestinations |
protected int |
rValue |
protected boolean |
sharedStreams |
protected ArrayList<PdfString> |
strings |
protected boolean |
tampered |
protected PRTokeniser |
tokens |
protected PdfDictionary |
trailer |
static boolean |
unethicalreading
The iText developers are not responsible if you decide to change the value of this static parameter.
|
protected long[] |
xref |
protected ArrayList<PdfObject> |
xrefObj |
Constructor and Description |
---|
PdfReader(byte[] pdfIn)
Reads and parses a PDF document.
|
PdfReader(byte[] pdfIn, byte[] ownerPassword)
Reads and parses a PDF document.
|
PdfReader(byte[] pdfIn, Certificate certificate, ExternalDecryptionProcess externalDecryptionProcess)
Reads and parses a PDF document.
|
PdfReader(InputStream is)
Reads and parses a PDF document.
|
PdfReader(InputStream is, byte[] ownerPassword)
Reads and parses a PDF document.
|
PdfReader(InputStream inputStream, Certificate certificate, ExternalDecryptionProcess externalDecryptionProcess)
Reads and parses a PDF document.
|
PdfReader(PdfReader reader)
Creates an independent duplicate.
|
PdfReader(RandomAccessFileOrArray raf, byte[] ownerPassword)
Reads and parses a pdf document.
|
PdfReader(RandomAccessFileOrArray raf, byte[] ownerPassword, boolean partial)
Reads and parses a pdf document.
|
PdfReader(ReaderProperties properties, InputStream is)
Reads and parses a PDF document.
|
PdfReader(ReaderProperties properties, RandomAccessFileOrArray raf)
Reads and parses a PDF document.
|
PdfReader(ReaderProperties properties, String filename)
Reads and parses a PDF document.
|
PdfReader(String filename)
Reads and parses a PDF document.
|
PdfReader(String filename, byte[] ownerPassword)
Reads and parses a PDF document.
|
PdfReader(String filename, byte[] ownerPassword, boolean partial)
Reads and parses a PDF document.
|
PdfReader(String filename, Certificate certificate, ExternalDecryptionProcess externalDecryptionProcess)
Reads and parses a PDF document.
|
PdfReader(String filename, Certificate certificate, Key certificateKey, String certificateKeyProvider)
Reads and parses a PDF document.
|
PdfReader(URL url)
Reads and parses a PDF document.
|
PdfReader(URL url, byte[] ownerPassword)
Reads and parses a PDF document.
|
Modifier and Type | Method and Description |
---|---|
PRIndirectReference |
addPdfObject(PdfObject obj) |
void |
addViewerPreference(PdfName key, PdfObject value)
Adds a viewer preference
|
static byte[] |
ASCII85Decode(byte[] in)
Decodes a stream that has the ASCII85Decode filter.
|
static byte[] |
ASCIIHexDecode(byte[] in)
Decodes a stream that has the ASCIIHexDecode filter.
|
void |
close()
Closes the reader, and any underlying stream or data source used to create the reader
|
byte[] |
computeUserPassword()
Computes user password if standard encryption handler is used with Standard40, Standard128 or AES128 encryption algorithm.
|
void |
consolidateNamedDestinations()
Replaces all the local named links with the actual destinations.
|
int |
createFakeFontSubsets()
Finds all the fonts not subset but embedded and marks them as subset.
|
static byte[] |
decodeBytes(byte[] b, PdfDictionary streamDictionary)
Decode a byte[] applying the filters specified in the provided dictionary using default filter handlers.
|
static byte[] |
decodeBytes(byte[] b, PdfDictionary streamDictionary, Map<PdfName,FilterHandlers.FilterHandler> filterHandlers)
Decode a byte[] applying the filters specified in the provided dictionary using the provided filter handlers.
|
static byte[] |
decodePredictor(byte[] in, PdfObject dicPar) |
double |
dumpPerc() |
protected static PdfDictionary |
duplicatePdfDictionary(PdfDictionary original, PdfDictionary copy, PdfReader newReader) |
protected static PdfObject |
duplicatePdfObject(PdfObject original, PdfReader newReader) |
void |
eliminateSharedStreams()
Eliminates shared streams if they exist.
|
static byte[] |
FlateDecode(byte[] in)
Decodes a stream that has the FlateDecode filter.
|
static byte[] |
FlateDecode(byte[] in, boolean strict)
A helper to FlateDecode.
|
AcroFields |
getAcroFields()
Gets a read-only version of AcroFields .
|
PRAcroForm |
getAcroForm()
Returns the document's acroform, if it has one.
|
Rectangle |
getBoxSize(int index, String boxName)
Gets the box size.
|
PdfDictionary |
getCatalog()
Returns the document's catalog.
|
int |
getCertificationLevel()
Gets the certification level for this document.
|
protected Counter |
getCounter() |
Rectangle |
getCropBox(int index)
Gets the crop box without taking rotation into account.
|
int |
getCryptoMode() |
long |
getEofPos()
Gets the byte address of the %%EOF marker.
|
long |
getFileLength()
Getter for property fileLength.
|
HashMap<String,String> |
getInfo()
Returns the content of the document information dictionary as a HashMap of String .
|
String |
getJavaScript()
Gets the global document JavaScript.
|
String |
getJavaScript(RandomAccessFileOrArray file)
Gets the global document JavaScript.
|
long |
getLastXref()
Gets the byte address of the last xref table.
|
ArrayList<PdfAnnotation.PdfImportedLink> |
getLinks(int page)
Retrieves links for a certain page.
|
byte[] |
getMetadata()
Gets the XML metadata.
|
HashMap<Object,PdfObject> |
getNamedDestination()
Gets all the named destinations as an HashMap .
|
HashMap<Object,PdfObject> |
getNamedDestination(boolean keepNames)
Gets all the named destinations as an HashMap .
|
HashMap<String,PdfObject> |
getNamedDestinationFromNames()
Gets the named destinations from the /Dests key in the catalog as an HashMap .
|
HashMap<Object,PdfObject> |
getNamedDestinationFromNames(boolean keepNames)
Gets the named destinations from the /Dests key in the catalog as an HashMap .
|
HashMap<String,PdfObject> |
getNamedDestinationFromStrings()
Gets the named destinations from the /Names key in the catalog as an HashMap .
|
static Rectangle |
getNormalizedRectangle(PdfArray box)
Normalizes a Rectangle so that llx and lly are smaller than urx and ury.
|
int |
getNumberOfPages()
Gets the number of pages in the document.
|
byte[] |
getPageContent(int pageNum)
Gets the contents of the page.
|
byte[] |
getPageContent(int pageNum, RandomAccessFileOrArray file)
Gets the contents of the page.
|
static byte[] |
getPageContent(PdfDictionary page)
Gets the content from the page dictionary.
|
PdfDictionary |
getPageN(int pageNum)
Gets the dictionary that represents a page.
|
PdfDictionary |
getPageNRelease(int pageNum) |
PRIndirectReference |
getPageOrigRef(int pageNum)
Gets the page reference to this page.
|
PdfDictionary |
getPageResources(int pageNum)
Retrieve the given page's resource dictionary
|
PdfDictionary |
getPageResources(PdfDictionary pageDict)
Retrieve the given page's resource dictionary
|
int |
getPageRotation(int index)
Gets the page rotation.
|
Rectangle |
getPageSize(int index)
Gets the page size without taking rotation into account.
|
Rectangle |
getPageSize(PdfDictionary page)
Gets the page from a page dictionary
|
Rectangle |
getPageSizeWithRotation(int index)
Gets the page size, taking rotation into account.
|
Rectangle |
getPageSizeWithRotation(PdfDictionary page)
Gets the rotated page from a page dictionary.
|
PdfObject |
getPdfObject(int idx) |
static PdfObject |
getPdfObject(PdfObject obj)
Reads a PdfObject resolving an indirect reference if needed.
|
static PdfObject |
getPdfObject(PdfObject obj, PdfObject parent) |
PdfObject |
getPdfObjectRelease(int idx) |
static PdfObject |
getPdfObjectRelease(PdfObject obj) |
static PdfObject |
getPdfObjectRelease(PdfObject obj, PdfObject parent)
Reads a PdfObject resolving an indirect reference if needed.
|
protected com.itextpdf.text.pdf.PdfReaderInstance |
getPdfReaderInstance(PdfWriter writer) |
char |
getPdfVersion()
Gets the PDF version.
|
long |
getPermissions()
Gets the encryption permissions.
|
RandomAccessFileOrArray |
getSafeFile()
Gets a new file instance of the original PDF document.
|
int |
getSimpleViewerPreferences()
Returns a bitset representing the PageMode and PageLayout viewer preferences.
|
static byte[] |
getStreamBytes(PRStream stream)
Get the content from a stream applying the required filters.
|
static byte[] |
getStreamBytes(PRStream stream, RandomAccessFileOrArray file)
Get the content from a stream applying the required filters.
|
static byte[] |
getStreamBytesRaw(PRStream stream)
Get the content from a stream as it is without applying any filter.
|
static byte[] |
getStreamBytesRaw(PRStream stream, RandomAccessFileOrArray file)
Get the content from a stream as it is without applying any filter.
|
PdfDictionary |
getTrailer()
Gets the trailer dictionary
|
int |
getXrefSize()
Gets the number of xref objects.
|
boolean |
hasUsageRights()
Checks if this PDF has usage rights enabled.
|
boolean |
is128Key()
Returns true if the PDF has a 128 bit key encryption.
|
boolean |
isAppendable()
Getter for property appendable.
|
boolean |
isEncrypted()
Returns true if the PDF is encrypted.
|
boolean |
isHybridXref()
Getter for property hybridXref.
|
boolean |
isMetadataEncrypted() |
boolean |
isNewXrefType()
Getter for property newXrefType.
|
boolean |
isOpenedWithFullPermissions()
Checks if the document was opened with the owner password so that the end application can decide what level of access restrictions to apply.
|
boolean |
isRebuilt()
Checks if the document had errors and was rebuilt.
|
boolean |
isTagged()
Checks if the PDF is a tagged PDF.
|
boolean |
isTampered()
Checks if the document was changed.
|
static PdfObject |
killIndirect(PdfObject obj)
Eliminates the reference to the object freeing the memory used by it and clearing the xref entry.
|
protected void |
killXref(PdfObject obj) |
static byte[] |
LZWDecode(byte[] in)
Decodes a stream that has the LZWDecode filter.
|
void |
makeRemoteNamedDestinationsLocal()
Replaces remote named links with local destinations that have the same name.
|
protected PdfArray |
readArray() |
protected PdfDictionary |
readDictionary() |
protected void |
readDocObj() |
protected void |
readDocObjPartial() |
protected void |
readObjStm(PRStream stream, IntHashtable map) |
protected PdfObject |
readOneObjStm(PRStream stream, int idx) |
protected void |
readPages() |
protected void |
readPdf()
Parses the entire PDF
|
protected void |
readPdfPartial()
Partially parses the pdf
|
protected PdfObject |
readPRObject() |
protected PdfObject |
readSingleObject(int k) |
protected void |
readXref() |
protected PdfDictionary |
readXrefSection() |
protected boolean |
readXRefStream(long ptr) |
protected void |
rebuildXref() |
void |
releaseLastXrefPartial() |
static void |
releaseLastXrefPartial(PdfObject obj) |
void |
releasePage(int pageNum) |
void |
removeAnnotations()
Removes all the annotations and fields from the document.
|
void |
removeFields()
Removes all the fields from the document.
|
protected void |
removeUnusedNode(PdfObject obj, boolean[] hits) |
int |
removeUnusedObjects()
Removes all the unreachable objects.
|
void |
removeUsageRights()
Removes any usage rights that this PDF may have.
|
void |
resetLastXrefPartial() |
void |
resetReleasePage() |
void |
selectPages(List<Integer> pagesToKeep)
Selects the pages to keep in the document.
|
protected void |
selectPages(List<Integer> pagesToKeep, boolean removeUnused)
Selects the pages to keep in the document.
|
void |
selectPages(String ranges)
Selects the pages to keep in the document.
|
void |
setAppendable(boolean appendable)
Setter for property appendable.
|
void |
setPageContent(int pageNum, byte[] content)
Sets the contents of the page.
|
void |
setPageContent(int pageNum, byte[] content, int compressionLevel)
Sets the contents of the page.
|
void |
setPageContent(int pageNum, byte[] content, int compressionLevel, boolean killOldXRefRecursively)
Sets the contents of the page.
|
void |
setTampered(boolean tampered)
Sets the tampered state.
|
void |
setViewerPreferences(int preferences)
Sets the viewer preferences as the sum of several constants.
|
void |
setViewerPreferences(PdfViewerPreferencesImp vp) |
int |
shuffleSubsetNames()
Finds all the font subsets and changes the prefixes to some random values.
|
public static boolean unethicalreading
public static boolean debugmode
protected PRTokeniser tokens
protected long[] xref
protected HashMap<Integer,IntHashtable> objStmMark
protected LongHashtable objStmToOffset
protected boolean newXrefType
protected PdfDictionary trailer
protected PdfDictionary catalog
protected com.itextpdf.text.pdf.PdfReader.PageRefs pageRefs
protected PRAcroForm acroForm
protected boolean acroFormParsed
protected boolean encrypted
protected boolean rebuilt
protected int freeXref
protected boolean tampered
protected long lastXref
protected long eofPos
protected char pdfVersion
protected PdfEncryption decrypt
protected byte[] password
protected Key certificateKey
protected Certificate certificate
protected String certificateKeyProvider
protected ExternalDecryptionProcess externalDecryptionProcess
protected boolean sharedStreams
protected boolean consolidateNamedDestinations
protected boolean remoteToLocalNamedDestinations
protected int rValue
protected long pValue
protected static Counter COUNTER
public PdfReader(String filename) throws IOException
filename
- the file name of the document
IOException
- on error
public PdfReader(ReaderProperties properties, String filename) throws IOException
properties
- the properties which will be used to create the reader
filename
- the file name of the document
IOException
- on error
public PdfReader(String filename, byte[] ownerPassword) throws IOException
filename
- the file name of the document
ownerPassword
- the password to read the document
IOException
- on error
public PdfReader(String filename, byte[] ownerPassword, boolean partial) throws IOException
filename
- the file name of the document
ownerPassword
- the password to read the document
partial
- indicates if the reader needs to read the document only partially
IOException
- on error
public PdfReader(byte[] pdfIn) throws IOException
pdfIn
- the byte array with the document
IOException
- on error
public PdfReader(byte[] pdfIn, byte[] ownerPassword) throws IOException
pdfIn
- the byte array with the document
ownerPassword
- the password to read the document
IOException
- on error
public PdfReader(String filename, Certificate certificate, Key certificateKey, String certificateKeyProvider) throws IOException
filename
- the file name of the document
certificate
- the certificate to read the document
certificateKey
- the private key of the certificate
certificateKeyProvider
- the security provider for certificateKey
IOException
- on error
public PdfReader(String filename, Certificate certificate, ExternalDecryptionProcess externalDecryptionProcess) throws IOException
filename
- the file name of the document
certificate
-
externalDecryptionProcess
-
IOException
- on error
public PdfReader(byte[] pdfIn, Certificate certificate, ExternalDecryptionProcess externalDecryptionProcess) throws IOException
pdfIn
- the document as a byte array
certificate
-
externalDecryptionProcess
-
IOException
- on error
public PdfReader(InputStream inputStream, Certificate certificate, ExternalDecryptionProcess externalDecryptionProcess) throws IOException
inputStream
- the PDF file
certificate
-
externalDecryptionProcess
-
IOException
- on error
public PdfReader(URL url) throws IOException
url
- the URL of the document
IOException
- on error
public PdfReader(URL url, byte[] ownerPassword) throws IOException
url
- the URL of the document
ownerPassword
- the password to read the document
IOException
- on error
public PdfReader(InputStream is, byte[] ownerPassword) throws IOException
is
- the InputStream
containing the document. The stream is read to the end but is not closed
ownerPassword
- the password to read the document
IOException
- on error
public PdfReader(InputStream is) throws IOException
is
- the InputStream
containing the document. The stream is read to the end but is not closed
IOException
- on error
public PdfReader(ReaderProperties properties, InputStream is) throws IOException
properties
- the properties which will be used to create the reader
is
- the InputStream
containing the document. The stream is read to the end but is not closed
IOException
- on error
public PdfReader(ReaderProperties properties, RandomAccessFileOrArray raf) throws IOException
properties
- the properties which will be used to create the reader
raf
- the document location
IOException
- on error
public PdfReader(RandomAccessFileOrArray raf, byte[] ownerPassword) throws IOException
raf
- the document location
ownerPassword
- the password or null
for no password
IOException
- on error
public PdfReader(RandomAccessFileOrArray raf, byte[] ownerPassword, boolean partial) throws IOException
raf
- the document location
ownerPassword
- the password or null
for no password
partial
- indicates if the reader needs to read the document only partially. See PdfReader(RandomAccessFileOrArray, byte[])
IOException
- on error
public PdfReader(PdfReader reader)
reader
- the PdfReader
to duplicate
protected Counter getCounter()
public RandomAccessFileOrArray getSafeFile()
protected com.itextpdf.text.pdf.PdfReaderInstance getPdfReaderInstance(PdfWriter writer)
public int getNumberOfPages()
public PdfDictionary getCatalog()
public PRAcroForm getAcroForm()
public int getPageRotation(int index)
index
- the page number. The first page is 1
public Rectangle getPageSizeWithRotation(int index)
Rectangle
with the value of the /MediaBox and the /Rotate key.
index
- the page number. The first page is 1
Rectangle
public Rectangle getPageSizeWithRotation(PdfDictionary page)
page
- the page dictionary
public Rectangle getPageSize(int index)
index
- the page number. The first page is 1
public Rectangle getPageSize(PdfDictionary page)
page
- the page dictionary
public Rectangle getCropBox(int index)
index
- the page number. The first page is 1
public Rectangle getBoxSize(int index, String boxName)
index
- the page number. The first page is 1
boxName
- the box name
public HashMap<String,String> getInfo()
HashMap
of String
.
public static Rectangle getNormalizedRectangle(PdfArray box)
Rectangle
so that llx and lly are smaller than urx and ury.
box
- the original rectangle
Rectangle
public boolean isTagged()
protected void readPdf() throws IOException
IOException
protected void readPdfPartial() throws IOException
IOException
public static PdfObject getPdfObjectRelease(PdfObject obj)
obj
-
public static PdfObject getPdfObject(PdfObject obj)
PdfObject
resolving an indirect reference if needed.
obj
- the PdfObject
to read
PdfObject
public static PdfObject getPdfObjectRelease(PdfObject obj, PdfObject parent)
PdfObject
resolving an indirect reference if needed. If the reader was opened in partial mode the object will be released to save memory.
obj
- the PdfObject
to read
parent
-
public static PdfObject getPdfObject(PdfObject obj, PdfObject parent)
obj
-
parent
-
public PdfObject getPdfObjectRelease(int idx)
idx
-
public PdfObject getPdfObject(int idx)
idx
-
public void resetLastXrefPartial()
public void releaseLastXrefPartial()
public static void releaseLastXrefPartial(PdfObject obj)
obj
-
public PRIndirectReference addPdfObject(PdfObject obj)
obj
-
protected void readPages() throws IOException
IOException
protected void readDocObjPartial() throws IOException
IOException
protected PdfObject readSingleObject(int k) throws IOException
IOException
protected PdfObject readOneObjStm(PRStream stream, int idx) throws IOException
IOException
public double dumpPerc()
protected void readDocObj() throws IOException
IOException
protected void readObjStm(PRStream stream, IntHashtable map) throws IOException
IOException
public static PdfObject killIndirect(PdfObject obj)
obj
- the object. If it's an indirect reference it will be eliminated
protected void readXref() throws IOException
IOException
protected PdfDictionary readXrefSection() throws IOException
IOException
protected boolean readXRefStream(long ptr) throws IOException
IOException
protected void rebuildXref() throws IOException
IOException
protected PdfDictionary readDictionary() throws IOException
IOException
protected PdfArray readArray() throws IOException
IOException
protected PdfObject readPRObject() throws IOException
IOException
public static byte[] FlateDecode(byte[] in)
in
- the input data
public static byte[] decodePredictor(byte[] in, PdfObject dicPar)
in
-
dicPar
-
public static byte[] FlateDecode(byte[] in, boolean strict)
in
- the input data
strict
- true
to read a correct stream. false
to try to read a corrupted stream
public static byte[] ASCIIHexDecode(byte[] in)
in
- the input data
public static byte[] ASCII85Decode(byte[] in)
in
- the input data
public static byte[] LZWDecode(byte[] in)
in
- the input data
public boolean isRebuilt()
public PdfDictionary getPageN(int pageNum)
pageNum
- the page number. 1 is the first
public PdfDictionary getPageNRelease(int pageNum)
pageNum
-
public void releasePage(int pageNum)
pageNum
-
public void resetReleasePage()
public PRIndirectReference getPageOrigRef(int pageNum)
pageNum
- the page number. 1 is the first
public byte[] getPageContent(int pageNum, RandomAccessFileOrArray file) throws IOException
pageNum
- the page number. 1 is the first
file
- the location of the PDF document
IOException
- on error
public static byte[] getPageContent(PdfDictionary page) throws IOException
page
- the page dictionary
IOException
- on error
public PdfDictionary getPageResources(int pageNum)
pageNum
- 1-based page number from which to retrieve the resource dictionary
public PdfDictionary getPageResources(PdfDictionary pageDict)
pageDict
- the given page
public byte[] getPageContent(int pageNum) throws IOException
pageNum
- the page number. 1 is the first
IOException
- on error
protected void killXref(PdfObject obj)
public void setPageContent(int pageNum, byte[] content)
content
- the new page content
pageNum
- the page number. 1 is the first
public void setPageContent(int pageNum, byte[] content, int compressionLevel)
content
- the new page content
pageNum
- the page number. 1 is the first
compressionLevel
- the compressionLevel
public void setPageContent(int pageNum, byte[] content, int compressionLevel, boolean killOldXRefRecursively)
content
- the new page content
pageNum
- the page number. 1 is the first
compressionLevel
- the compressionLevel
killOldXRefRecursively
- if true, old contents will be deeply removed from the pdf (i.e. if it was an array, all its entries will also be removed). Use careful when a content stream may be reused. If false, old contents will not be removed and will stay in the document if not manually deleted.
public static byte[] decodeBytes(byte[] b, PdfDictionary streamDictionary) throws IOException
b
- the bytes to decode
streamDictionary
- the dictionary that contains filter information
IOException
- if there are any problems decoding the bytes
public static byte[] decodeBytes(byte[] b, PdfDictionary streamDictionary, Map<PdfName,FilterHandlers.FilterHandler> filterHandlers) throws IOException
b
- the bytes to decode
streamDictionary
- the dictionary that contains filter information
filterHandlers
- the map used to look up a handler for each type of filter
IOException
- if there are any problems decoding the bytes
public static byte[] getStreamBytes(PRStream stream, RandomAccessFileOrArray file) throws IOException
stream
- the stream
file
- the location where the stream is
IOException
- on error
public static byte[] getStreamBytes(PRStream stream) throws IOException
stream
- the stream
IOException
- on error
public static byte[] getStreamBytesRaw(PRStream stream, RandomAccessFileOrArray file) throws IOException
stream
- the stream
file
- the location where the stream is
IOException
- on error
public static byte[] getStreamBytesRaw(PRStream stream) throws IOException
stream
- the stream
IOException
- on error
public void eliminateSharedStreams()
public boolean isTampered()
true
if the document was changed, false
otherwise
public void setTampered(boolean tampered)
tampered
- the tampered state
public byte[] getMetadata() throws IOException
IOException
- on error
public long getLastXref()
public int getXrefSize()
public long getEofPos()
public char getPdfVersion()
public boolean isEncrypted()
true
if the PDF is encrypted.
true
if the PDF is encrypted
public long getPermissions()
PdfWriter.setEncryption()
.
public boolean is128Key()
true
if the PDF has a 128 bit key encryption.
true
if the PDF has a 128 bit key encryption
public PdfDictionary getTrailer()
public int shuffleSubsetNames()
public int createFakeFontSubsets()
public HashMap<Object,PdfObject> getNamedDestination()
HashMap
. The key is the name and the value is the destinations array.
public HashMap<Object,PdfObject> getNamedDestination(boolean keepNames)
HashMap
. The key is the name and the value is the destinations array.
keepNames
- true if you want the keys to be real PdfNames instead of Strings
public HashMap<String,PdfObject> getNamedDestinationFromNames()
HashMap
. The key is the name and the value is the destinations array.
public HashMap<Object,PdfObject> getNamedDestinationFromNames(boolean keepNames)
HashMap
. The key is the name and the value is the destinations array.
keepNames
- true if you want the keys to be real PdfNames instead of Strings
public HashMap<String,PdfObject> getNamedDestinationFromStrings()
HashMap
. The key is the name and the value is the destinations array.
public void removeFields()
public void removeAnnotations()
public ArrayList<PdfAnnotation.PdfImportedLink> getLinks(int page)
page
- the page to inspect
public void makeRemoteNamedDestinationsLocal()
public void consolidateNamedDestinations()
protected static PdfDictionary duplicatePdfDictionary(PdfDictionary original, PdfDictionary copy, PdfReader newReader)
protected static PdfObject duplicatePdfObject(PdfObject original, PdfReader newReader)
public void close()
protected void removeUnusedNode(PdfObject obj, boolean[] hits)
public int removeUnusedObjects()
public AcroFields getAcroFields()
AcroFields
.
AcroFields
public String getJavaScript(RandomAccessFileOrArray file) throws IOException
file
- the document file
IOException
- on error
public String getJavaScript() throws IOException
IOException
- on error
public void selectPages(String ranges)
ranges
- the comma separated ranges as described in SequenceList
public void selectPages(List<Integer> pagesToKeep)
List
of Integer
. The page ordering can be changed but no page repetitions are allowed. Note that it may be very slow in partial mode.
pagesToKeep
- the pages to keep in the document
protected void selectPages(List<Integer> pagesToKeep, boolean removeUnused)
List
of Integer
. The page ordering can be changed but no page repetitions are allowed. Note that it may be very slow in partial mode.
pagesToKeep
- the pages to keep in the document
removeUnused
- indicate if to remove unsed objects. @see removeUnusedObjects
public void setViewerPreferences(int preferences)
setViewerPreferences
in interface PdfViewerPreferences
preferences
- the viewer preferences
PdfViewerPreferences.setViewerPreferences(int)
public void addViewerPreference(PdfName key, PdfObject value)
addViewerPreference
in interface PdfViewerPreferences
key
- a key for a viewer preference
value
- a value for the viewer preference
PdfViewerPreferences.addViewerPreference(com.itextpdf.text.pdf.PdfName, com.itextpdf.text.pdf.PdfObject)
public void setViewerPreferences(PdfViewerPreferencesImp vp)
public int getSimpleViewerPreferences()
public boolean isAppendable()
public void setAppendable(boolean appendable)
appendable
- New value of property appendable.
public boolean isNewXrefType()
public long getFileLength()
public boolean isHybridXref()
public boolean hasUsageRights()
true
if usage rights are present; false
otherwise
public void removeUsageRights()
public int getCertificationLevel()
PdfSignatureAppearance.NOT_CERTIFIED
, PdfSignatureAppearance.CERTIFIED_NO_CHANGES_ALLOWED
, PdfSignatureAppearance.CERTIFIED_FORM_FILLING
and PdfSignatureAppearance.CERTIFIED_FORM_FILLING_AND_ANNOTATIONS
.
No signature validation is made, use the methods available for that in AcroFields
.
public final boolean isOpenedWithFullPermissions()
true
.
true
if the document was opened with the owner password or if it's not encrypted, false
if the document was opened with the user password
public int getCryptoMode()
public boolean isMetadataEncrypted()
public byte[] computeUserPassword()
Copyright © 1998–2019. All rights reserved.