|
||||||||||
| 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 boolean |
encrypted
|
protected int |
eofPos
|
protected int |
freeXref
|
protected int |
lastXref
|
protected ArrayList |
pageInh
|
(package private) static PdfName[] |
pageInhCandidates
|
protected PRIndirectReference[] |
pageRefs
|
protected PdfDictionary[] |
pages
|
protected int |
pagesCount
|
protected boolean |
rebuilt
|
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(String filename)
Reads and parses a PDF document. |
|
| Method Summary | |
static byte[] |
ASCII85Decode(byte[] in)
|
static byte[] |
ASCIIHexDecode(byte[] in)
|
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. |
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)
|
RandomAccessFileOrArray |
getSafeFile()
Gets a new file instance of the original PDF document. |
static byte[] |
getStreamBytes(PRStream stream,
RandomAccessFileOrArray file)
|
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()
|
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
| Constructor Detail |
public PdfReader(String filename)
throws IOException
filename - the file name of the document
IOException - on error
public PdfReader(byte[] pdfIn)
throws IOException
pdfIn - the byte array with the document
IOException - on error| 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
Rectanglepublic 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
IOExceptionpublic 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
IOExceptionstatic 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
IOExceptionpublic 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
IOExceptionprotected void killXref(PdfObject obj)
public void setPageContent(int pageNum,
byte[] content)
throws IOException
IOException
public static byte[] getStreamBytes(PRStream stream,
RandomAccessFileOrArray file)
throws IOException
IOExceptionpublic boolean isTampered()
public void setTampered(boolean tampered)
public byte[] getMetadata()
throws IOException
IOException - on errorpublic int getLastXref()
public int getEofPos()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||