|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.lowagie.text.pdf.PdfReader
Reads a PDF document and prepares it to import pages to our document. This class is thread safe; this means that a single instance can serve as many output documents as needed and can even be static.
Field Summary | |
protected PRAcroForm |
acroForm
|
protected PdfDictionary |
catalog
|
protected PdfEncryption |
decrypt
|
protected boolean |
encrypted
|
protected int |
eofPos
|
protected int |
freeXref
|
protected int |
lastXref
|
protected int |
objGen
|
protected int |
objNum
|
protected ArrayList |
pageInh
|
(package private) static PdfName[] |
pageInhCandidates
|
protected PRIndirectReference[] |
pageRefs
|
protected PdfDictionary[] |
pages
|
protected int |
pagesCount
|
protected byte[] |
password
|
protected char |
pdfVersion
|
protected boolean |
rebuilt
|
protected boolean |
sharedStreams
|
protected ArrayList |
strings
|
protected boolean |
tampered
|
protected PRTokeniser |
tokens
|
protected PdfDictionary |
trailer
|
protected int[] |
xref
|
protected PdfObject[] |
xrefObj
|
Constructor Summary | |
PdfReader(byte[] pdfIn)
Reads and parses a PDF document. |
|
PdfReader(byte[] pdfIn,
byte[] ownerPassword)
|
|
PdfReader(String filename)
Reads and parses a PDF document. |
|
PdfReader(String filename,
byte[] ownerPassword)
|
|
PdfReader(URL url)
Reads and parses a PDF document. |
|
PdfReader(URL url,
byte[] ownerPassword)
|
Method Summary | |
static byte[] |
ASCII85Decode(byte[] in)
|
static byte[] |
ASCIIHexDecode(byte[] in)
|
void |
eliminateSharedStreams()
Eliminates shared streams if they exist. |
static byte[] |
FlateDecode(byte[] in)
|
static byte[] |
FlateDecode(byte[] in,
boolean strict)
|
PRAcroForm |
getAcroForm()
Returns the document's acroform, if it has one. |
PdfDictionary |
getCatalog()
Returns the document's catalog. |
Rectangle |
getCropBox(int index)
Gets the crop box without taking rotation into account. |
(package private) PdfEncryption |
getDecrypt()
|
int |
getEofPos()
|
HashMap |
getInfo()
Returns the content of the document information dictionary as a HashMap
of String . |
int |
getLastXref()
|
byte[] |
getMetadata()
Gets the XML metadata. |
static Rectangle |
getNormalizedRectangle(PdfArray box)
|
int |
getNumberOfPages()
Gets the number of pages in the document. |
byte[] |
getPageContent(int pageNum,
RandomAccessFileOrArray file)
|
PdfDictionary |
getPageN(int pageNum)
|
PRIndirectReference |
getPageOrigRef(int pageNum)
|
int |
getPageRotation(int index)
Gets the page rotation. |
Rectangle |
getPageSize(int index)
Gets the page size without taking rotation into account. |
Rectangle |
getPageSizeWithRotation(int index)
Gets the page size, taking rotation into account. |
static PdfObject |
getPdfObject(PdfObject obj)
|
protected PdfReaderInstance |
getPdfReaderInstance(PdfWriter writer)
|
char |
getPdfVersion()
|
RandomAccessFileOrArray |
getSafeFile()
Gets a new file instance of the original PDF document. |
static byte[] |
getStreamBytes(PRStream stream,
RandomAccessFileOrArray file)
|
boolean |
isEncrypted()
|
boolean |
isRebuilt()
Checks if the document had errors and was rebuilt. |
boolean |
isTampered()
|
protected void |
iteratePages(PdfDictionary page)
|
(package private) static PdfObject |
killIndirect(PdfObject obj)
|
protected void |
killXref(PdfObject obj)
|
static byte[] |
LZWDecode(byte[] in)
|
protected void |
popPageAttributes()
|
protected void |
pushPageAttributes(PdfDictionary nodePages)
|
protected PdfArray |
readArray()
|
private void |
readDecryptedDocObj()
|
protected PdfDictionary |
readDictionary()
|
protected void |
readDocObj()
|
protected void |
readPages()
|
protected void |
readPdf()
|
protected PdfObject |
readPRObject()
|
protected void |
readXref()
|
protected void |
readXrefSection()
|
protected void |
rebuildXref()
|
void |
setPageContent(int pageNum,
byte[] content)
|
void |
setTampered(boolean tampered)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static final PdfName[] pageInhCandidates
protected PRTokeniser tokens
protected int[] xref
protected PdfObject[] xrefObj
protected PdfDictionary trailer
protected PdfDictionary[] pages
protected PdfDictionary catalog
protected PRIndirectReference[] pageRefs
protected PRAcroForm acroForm
protected ArrayList pageInh
protected int pagesCount
protected boolean encrypted
protected boolean rebuilt
protected int freeXref
protected boolean tampered
protected int lastXref
protected int eofPos
protected char pdfVersion
protected PdfEncryption decrypt
protected byte[] password
protected int objNum
protected int objGen
protected ArrayList strings
protected boolean sharedStreams
Constructor Detail |
public PdfReader(String filename) throws IOException
filename
- the file name of the document
IOException
- on errorpublic PdfReader(String filename, byte[] ownerPassword) throws IOException
public PdfReader(byte[] pdfIn) throws IOException
pdfIn
- the byte array with the document
IOException
- on errorpublic PdfReader(byte[] pdfIn, byte[] ownerPassword) throws IOException
public PdfReader(URL url) throws IOException
url
- the URL of the document
IOException
- on errorpublic PdfReader(URL url, byte[] ownerPassword) throws IOException
Method Detail |
public RandomAccessFileOrArray getSafeFile()
protected 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 getPageSize(int index)
index
- the page number. The first page is 1
public Rectangle getCropBox(int index)
index
- the page number. The first page is 1
public HashMap getInfo()
HashMap
of String
.
public static Rectangle getNormalizedRectangle(PdfArray box)
protected void readPdf() throws IOException
IOException
private void readDecryptedDocObj() throws IOException
IOException
public static PdfObject getPdfObject(PdfObject obj)
protected void pushPageAttributes(PdfDictionary nodePages)
protected void popPageAttributes()
protected void iteratePages(PdfDictionary page) throws IOException
IOException
protected void readPages() throws IOException
IOException
protected void readDocObj() throws IOException
IOException
static PdfObject killIndirect(PdfObject obj)
protected void readXref() throws IOException
IOException
protected void readXrefSection() 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)
public static byte[] FlateDecode(byte[] in, boolean strict)
public static byte[] ASCIIHexDecode(byte[] in)
public static byte[] ASCII85Decode(byte[] in)
public static byte[] LZWDecode(byte[] in)
public boolean isRebuilt()
public PdfDictionary getPageN(int pageNum)
public PRIndirectReference getPageOrigRef(int pageNum)
public byte[] getPageContent(int pageNum, RandomAccessFileOrArray file) throws IOException
IOException
protected void killXref(PdfObject obj)
public void setPageContent(int pageNum, byte[] content) throws IOException
IOException
public static byte[] getStreamBytes(PRStream stream, RandomAccessFileOrArray file) throws IOException
IOException
public void eliminateSharedStreams()
public boolean isTampered()
public void setTampered(boolean tampered)
public byte[] getMetadata() throws IOException
IOException
- on errorpublic int getLastXref()
public int getEofPos()
public char getPdfVersion()
public boolean isEncrypted()
PdfEncryption getDecrypt()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |