![]() |
||
Home Products Purchase Downloads Demos Forums Blogs Ticket Wiki API Corporate |
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.aspose.pdf.kit.Stamp
Represents a class for stamp content, the content is an image or a text. The content can be layed at the bottom as background,or at the top as watermark and logo of pages.
Constructor Summary | |
Stamp()
Creates a Stamp object. |
Method Summary | |
void |
bindImage(java.io.InputStream imageStream)
Binds an image stream as stamp content. |
void |
bindImage(java.lang.String imageFile)
Binds an image file as stamp content. |
void |
bindLogo(FormattedText text)
Binds a FormattedText as stamp content. |
void |
bindLogo(java.lang.String text)
Binds a text as stamp content. |
void |
bindPdf(java.io.InputStream pdfStream,
int pageNumber)
Binds one page of PDF stream as stamp content. |
void |
bindPdf(java.lang.String pdfFile,
int pageNumber)
Binds one page of PDF file as stamp content. |
void |
isBackground(boolean isBackground)
Sets a bool value that indicates the content is stamped as background. |
void |
setImageSize(float width,
float height)
Resizes the image which is bound as stamp content. |
void |
setOpacity(float opacity)
Sets a float value to indicate the stamp object opacity. |
void |
setOrigin(float originX,
float originY)
Sets the lower-left coordinates of a rectangle which contains stamp content layed on the pages. |
void |
setPages(int[] pages)
Sets the page number to indicate on which pages the stamp content are added. |
void |
setRotation(float rotation)
Sets the rotation of stamp content(from 0 to 360). |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Stamp()
Method Detail |
public void setOpacity(float opacity)
opacity
- public void bindPdf(java.lang.String pdfFile, int pageNumber) throws java.io.FileNotFoundException
[SampleCode] String path = "./examples/resources/"; String inFile = path + "text.pdf"; String outFile = path + "stamp2.pdf"; PdfFileStamp fileStamp = new PdfFileStamp(inFile, outFile); Stamp pdfFileStamp = new Stamp(); pdfFileStamp.bindPdf(path + "Online.pdf", 1); pdfFileStamp.isBackground(true); pdfFileStamp.setOpacity(0.5f); fileStamp.addStamp(pdfFileStamp); fileStamp.close();
pdfFile
- input PDf filepageNumber
- the page number of PDF file which used as stamp content
java.io.FileNotFoundException
public void bindPdf(java.io.InputStream pdfStream, int pageNumber)
pdfStream
- input PDf streampageNumber
- the page number of PDF file which used as stamp contentpublic void bindLogo(FormattedText text)
[SampleCode] String path = "./examples/resources/"; String inFile = path + "text.pdf"; String outFile = path + "stamp2.pdf"; PdfFileStamp fileStamp = new PdfFileStamp(inFile, outFile); Stamp logoStamp = new Stamp(); logoStamp.bindLogo(new FormattedText("Hello World!", new Color(180, 0, 0), FontStyle.TimesRoman, EncodingType.Winansi, false, 30)); logoStamp.setRotation(45); fileStamp.addStamp(logoStamp); fileStamp.close();
text
- input FormattedText object.public void bindLogo(java.lang.String text) throws java.io.IOException, PdfKitException
text
- input string.
java.io.IOException
PdfKitException
public void bindImage(java.lang.String imageFile) throws java.io.FileNotFoundException
[SampleCode] String path = "./examples/resources/"; String inFile = path + "text.pdf"; String outFile = path + "stamp2.pdf"; PdfFileStamp fileStamp = new PdfFileStamp(inFile, outFile); Stamp watermarkStamp = new Stamp(); watermarkStamp.bindImage(path + "imgLogoPDFKit.gif"); logoStamp.setOrigin(100, 50); logoStamp.setRotation(15); fileStamp.addStamp(watermarkStamp); fileStamp.close();
imageFile
- Input image file.
java.io.FileNotFoundException
public void bindImage(java.io.InputStream imageStream)
imageStream
- Input image stream.public void setPages(int[] pages)
pages
- page number collectionpublic void isBackground(boolean isBackground)
isBackground
- The isBackgroud to set.public void setOrigin(float originX, float originY)
originX
- The x coordinate to set.originY
- The y coordinate to set.public void setRotation(float rotation)
rotation
- The rotation to set.public void setImageSize(float width, float height)
width
- New width of image.height
- New height of image.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |