|
||||||||||
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
Make copies of PDF documents. Documents can be edited after reading and before writing them out.
Nested Class Summary | |
(package private) class |
PdfCopy.IndirectReferences
This class holds information about indirect references, since they are renumbered by iText. |
protected class |
PdfCopy.RefKey
A key to allow us to hash indirect references |
Nested classes inherited from class com.lowagie.text.pdf.PdfWriter |
PdfWriter.PdfBody, PdfWriter.PdfTrailer |
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 | |
(package private) PdfIndirectReference |
add(PdfImage pdfImage)
Writes a PdfImage to the outputstream. |
PdfIndirectReference |
add(PdfOutline outline)
|
(package private) PdfIndirectReference |
add(PdfPage page,
PdfContents contents)
Adds some PdfContents to this Writer. |
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. |
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)
|
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, 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
- outputstreamMethod 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)
public 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
PdfIndirectReference add(PdfImage pdfImage) throws PdfException
PdfWriter
PdfImage
to the outputstream.
add
in class PdfWriter
pdfImage
- the image to be added
PdfIndirectReference
to the encapsulated image
PdfException
- when a document isn't open yet, or has been closedpublic 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 addPdfIndirectReference add(PdfPage page, PdfContents contents) throws PdfException
PdfWriter
PdfContents
to this Writer.
The document has to be open before you can begin to add content to the body of the document.
add
in class PdfWriter
page
- the PdfPage
to addcontents
- the PdfContents
of the page
PdfIndirectReference
PdfException
- on error
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |