|
|||||||||||
| 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 | |
static class |
PdfCopy.PageStamp
|
static class |
PdfCopy.StampContent
|
| Nested classes inherited from class com.lowagie.text.pdf.PdfWriter |
PdfWriter.PdfBody |
| Field Summary |
| Fields inherited from class com.lowagie.text.DocWriter |
EQUALS, FORWARD, GT, LT, NEWLINE, QUOTE, SPACE, TAB |
| Constructor Summary | |
PdfCopy(Document document,
OutputStream os)
Constructor |
|
| Method Summary | |
PdfIndirectReference |
add(PdfOutline outline)
|
void |
addAnnotation(PdfAnnotation annot)
Use this methods to add 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. |
PdfCopy.PageStamp |
createPageStamp(PdfImportedPage iPage)
Create a page stamp. |
void |
freeReader(PdfReader reader)
Use this method to writes the reader to the document and free the memory used by it. |
PdfImportedPage |
getImportedPage(PdfReader reader,
int pageNumber)
Grabs a page from the input document |
boolean |
isRotateContents()
Getter for property rotateContents. |
void |
setRotateContents(boolean rotateContents)
Setter for property rotateContents. |
| Methods inherited from class com.lowagie.text.DocWriter |
add, flush, getISOBytes, isCloseStream, isPaused, newPage, pause, resetFooter, resetHeader, resetPageCount, resume, setCloseStream, setFooter, setHeader, setMarginMirroring, setMargins, setPageCount, setPageSize |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PdfCopy(Document document,
OutputStream os)
throws DocumentException
document - os - outputstream| Method Detail |
public boolean isRotateContents()
public void setRotateContents(boolean rotateContents)
rotateContents - New value of property rotateContents.
public PdfImportedPage getImportedPage(PdfReader reader,
int pageNumber)
getImportedPage in class PdfWriterreader - the reader of the documentpageNumber - which page to get
public void addPage(PdfImportedPage iPage)
throws IOException,
BadPdfFormatException
iPage - an imported page
IOException, - BadPdfFormatException
IOException
BadPdfFormatException
public void copyAcroForm(PdfReader reader)
throws IOException,
BadPdfFormatException
reader - The reader of the input file that is being copied
IOException, - BadPdfFormatException
IOException
BadPdfFormatExceptionpublic 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 reference table is composed and everything is written to the outputstream embedded in a Trailer.
close in interface DocListenerclose in class PdfWriterDocWriter.close()public PdfIndirectReference add(PdfOutline outline)
public void addAnnotation(PdfAnnotation annot)
PdfAnnotationsPdfAnnotation or a PdfFormField
to the document. Only the top parent of a PdfFormField
needs to be added.
addAnnotation in interface PdfAnnotationsaddAnnotation in class PdfWriterPdfAnnotations.addAnnotation(com.lowagie.text.pdf.PdfAnnotation)
public void freeReader(PdfReader reader)
throws IOException
PdfWriter
freeReader in class PdfWriterreader - the PdfReader to free
IOException - on errorpublic PdfCopy.PageStamp createPageStamp(PdfImportedPage iPage)
The general usage to stamp something in a page is:
PdfImportedPage page = copy.getImportedPage(reader, 1);
PdfCopy.PageStamp ps = copy.createPageStamp(page);
ps.addAnnotation(PdfAnnotation.createText(copy, new Rectangle(50, 180, 70, 200), "Hello", "No Thanks", true, "Comment"));
PdfContentByte under = ps.getUnderContent();
under.addImage(img);
PdfContentByte over = ps.getOverContent();
over.beginText();
over.setFontAndSize(bf, 18);
over.setTextMatrix(30, 30);
over.showText("total page " + totalPage);
over.endText();
ps.alterContents();
copy.addPage(page);
iPage - an imported page
PageStamp
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||