|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lowagie.text.DocWriter
com.lowagie.text.pdf.PdfWriter
com.lowagie.text.pdf.PdfCopy
public class PdfCopy
Make copies of PDF documents. Documents can be edited after reading and before writing them out.
Nested Class Summary | |
---|---|
protected static class |
PdfCopy.RefKey
A key to allow us to hash indirect references |
Nested classes/interfaces inherited from class com.lowagie.text.pdf.PdfWriter |
---|
PdfWriter.PdfBody |
Field Summary | |
---|---|
protected PdfIndirectReference |
acroForm
|
protected int |
currentObjectNum
|
protected HashMap |
indirectMap
|
protected HashMap |
indirects
|
protected List |
newBookmarks
|
protected ArrayList |
pageNumbersToRefs
|
protected PdfReader |
reader
|
protected PdfIndirectReference |
topPageParent
|
Fields inherited from class com.lowagie.text.DocWriter |
---|
closeStream, document, EQUALS, FORWARD, GT, LT, NEWLINE, open, os, pageSize, pause, QUOTE, SPACE, TAB |
Constructor Summary | |
---|---|
PdfCopy(Document document,
OutputStream os)
Constructor |
Method Summary | |
---|---|
PdfIndirectReference |
add(PdfOutline outline)
|
void |
addAnnotation(PdfAnnotation annot)
Adds a PdfAnnotation or a PdfFormField
to the document. |
void |
addPage(PdfImportedPage iPage)
Add an imported page to our output |
void |
close()
Signals that the Document was closed and that no other
Elements will be added. |
void |
copyAcroForm(PdfReader reader)
Copy the acroform for an input document. |
protected PdfArray |
copyArray(PdfArray in)
Translate a PRArray to a PdfArray. |
protected PdfDictionary |
copyDictionary(PdfDictionary in)
Translate a PRDictionary to a PdfDictionary. |
protected PdfIndirectReference |
copyIndirect(PRIndirectReference in)
Translate a PRIndirectReference to a PdfIndirectReference In addition, translates the object numbers, and copies the referenced object to the output file. |
protected PdfObject |
copyObject(PdfObject in)
Translate a PR-object to a Pdf-object |
protected PdfStream |
copyStream(PRStream in)
Translate a PRStream to a PdfStream. |
void |
freeReader(PdfReader reader)
Writes the reader to the document and frees the memory used by it. |
protected PdfDictionary |
getCatalog(PdfIndirectReference rootObj)
|
PdfImportedPage |
getImportedPage(PdfReader reader,
int pageNumber)
Grabs a page from the input document |
PdfIndirectReference |
getPageReference(int page)
Gets a reference to a page existing or not. |
void |
open()
Signals that the Document has been opened and that
Elements can be added. |
protected int |
setFromIPage(PdfImportedPage iPage)
convenience method. |
protected void |
setFromReader(PdfReader reader)
convenience method. |
void |
setOutlines(List outlines)
Sets the bookmarks. |
Methods inherited from class com.lowagie.text.DocWriter |
---|
add, add, addTabs, clearTextWrap, flush, getISOBytes, hasMarkupAttributes, isCloseStream, newPage, pause, removeWatermark, resetFooter, resetHeader, resetPageCount, resume, setCloseStream, setFooter, setHeader, setMarginMirroring, setMargins, setPageCount, setPageSize, write, write, writeEnd, writeEnd, writeMarkupAttributes, writeStart |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected HashMap indirects
protected HashMap indirectMap
protected int currentObjectNum
protected PdfReader reader
protected PdfIndirectReference acroForm
protected PdfIndirectReference topPageParent
protected ArrayList pageNumbersToRefs
protected List newBookmarks
Constructor Detail |
---|
public PdfCopy(Document document, OutputStream os) throws DocumentException
document
- os
- outputstream
DocumentException
Method Detail |
---|
public void open()
PdfWriter
Document
has been opened and that
Elements
can be added.
When this method is called, the PDF-document header is written to the outputstream.
open
in interface DocListener
open
in class PdfWriter
public PdfImportedPage getImportedPage(PdfReader reader, int pageNumber)
getImportedPage
in class PdfWriter
reader
- the reader of the documentpageNumber
- which page to get
protected PdfIndirectReference copyIndirect(PRIndirectReference in) throws IOException, BadPdfFormatException
IOException
BadPdfFormatException
protected PdfDictionary copyDictionary(PdfDictionary in) throws IOException, BadPdfFormatException
IOException
BadPdfFormatException
protected PdfStream copyStream(PRStream in) throws IOException, BadPdfFormatException
IOException
BadPdfFormatException
protected PdfArray copyArray(PdfArray in) throws IOException, BadPdfFormatException
IOException
BadPdfFormatException
protected PdfObject copyObject(PdfObject in) throws IOException, BadPdfFormatException
IOException
BadPdfFormatException
protected int setFromIPage(PdfImportedPage iPage)
protected void setFromReader(PdfReader reader)
public void addPage(PdfImportedPage iPage) throws IOException, BadPdfFormatException
iPage
- an imported page
IOException,
- BadPdfFormatException
IOException
BadPdfFormatException
public PdfIndirectReference getPageReference(int page)
PdfWriter
getPageReference
in class PdfWriter
page
- the page number. The first page is 1
public void copyAcroForm(PdfReader reader) throws IOException, BadPdfFormatException
reader
- The reader of the input file that is being copied
IOException,
- BadPdfFormatException
IOException
BadPdfFormatException
protected PdfDictionary getCatalog(PdfIndirectReference rootObj)
getCatalog
in class PdfWriter
public void setOutlines(List outlines)
SimpleBookmark#
.
outlines
- the bookmarks or null
to remove anypublic void close()
Document
was closed and that no other
Elements
will be added.
The pages-tree is built and written to the outputstream. A Catalog is constructed, as well as an Info-object, the referencetable is composed and everything is written to the outputstream embedded in a Trailer.
close
in interface DocListener
close
in class PdfWriter
public PdfIndirectReference add(PdfOutline outline)
public void addAnnotation(PdfAnnotation annot)
PdfWriter
PdfAnnotation
or a PdfFormField
to the document. Only the top parent of a PdfFormField
needs to be added.
addAnnotation
in class PdfWriter
annot
- the PdfAnnotation
or the PdfFormField
to addpublic void freeReader(PdfReader reader) throws IOException
PdfWriter
freeReader
in class PdfWriter
reader
- the PdfReader
to free
IOException
- on error
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |