public final class Stamp extends Object
Class represeting stamp.
Constructor and Description |
---|
Stamp()
Constructor for Stamp object.
|
Modifier and Type | Method and Description |
---|---|
void |
bindImage(InputStream image)
Sets image which will be used as stamp.
|
void |
bindImage(String imageFile)
Sets image as a stamp.
|
void |
bindLogo(FormattedText formattedText)
Sets text as stamp.
|
void |
bindPdf(InputStream pdfStream,
int pageNumber)
Sets PDF file and number of page which will be used as stamp.
|
void |
bindPdf(String pdfFile,
int pageNumber)
Sets PDF file and number of page which will be used as stamp.
|
void |
bindTextState(TextState textState)
Sets text state of stamp text.
|
void |
close()
Closes this instance
|
int |
getBlendingSpace()
Gets a BlendingColorSpace value that defines a color space that is used to perform
transparency and blending operations on the page.
|
float |
getOpacity()
Gets opacity of the stamp.
|
int |
getPageNumber()
Gets page number.
|
int[] |
getPages()
Gets array with numbers of pages which will be affected by stamp.
|
int |
getQuality()
Gets quality of image stamp in percent.
|
float |
getRotation()
Gets rotation of the stamp in degrees.
|
int |
getStampId()
Gets identifier of stamp.
|
boolean |
isBackground()
Gets background status.
|
void |
setBackground(boolean value)
Sets background status.
|
void |
setBlendingSpace(int value)
Sets a BlendingColorSpace value that defines a color space that is used to perform
transparency and blending operations on the page.
|
void |
setImageSize(float width,
float height)
Sets size of image stamp.
|
void |
setOpacity(float value)
Sets opacity of the stamp.
|
void |
setOrigin(float originX,
float originY)
Sets position on page where stamp will be placed.
|
void |
setPageNumber(int value)
Sets page number.
|
void |
setPages(int[] value)
Sets array with numbers of pages which will be affected by stamp.
|
void |
setQuality(int value)
Sets quality of image stamp in percent.
|
void |
setRotation(float value)
Gets or sets rotation of the stamp in degrees.
|
void |
setStampId(int value)
Sets identifier of stamp.
|
public int getStampId()
Gets identifier of stamp.
public void setStampId(int value)
Sets identifier of stamp.
value
- int valuepublic int getQuality()
Gets quality of image stamp in percent. Valiued values 0..100%.
public void setQuality(int value)
Sets quality of image stamp in percent. Valiued values 0..100%.
value
- int valuepublic float getOpacity()
Gets opacity of the stamp.
public void setOpacity(float value)
Sets opacity of the stamp.
value
- float valuepublic int getPageNumber()
Gets page number.
public void setPageNumber(int value)
Sets page number.
value
- int valuepublic int[] getPages()
Gets array with numbers of pages which will be affected by stamp.
public void setPages(int[] value)
Sets array with numbers of pages which will be affected by stamp. If Pages = null all pages of the document are affected.
value
- int array
PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf"); Stamp stamp = new com.aspose.pdf.facades.Stamp(); stamp.bindLogo(new FormattedText(text)); //put stamp only on 1st, 4th and 6th page. stamp.setPages(new int[] { 1, 4, 6 }); fileStamp.addStamp(stamp); fileStamp.close();
public void bindTextState(TextState textState)
Sets text state of stamp text.
textState
- TextState object which specifies text properties.public float getRotation()
Gets rotation of the stamp in degrees.
public void setRotation(float value)
Gets or sets rotation of the stamp in degrees.
value
- float value
PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf"); Stamp stamp = new Stamp(); stamp.bindLogo(new FormattedText("STAMP")); stamp.setRotation(90); fileStamp.addStamp(stamp); fileStamp.close();
public boolean isBackground()
Gets background status. If true stamp will be placed as background of the spamped page. By default is set to false.
public void setBackground(boolean value)
Sets background status. If true stamp will be placed as background of the spamped page. By default is set to false.
value
- boolean valuepublic int getBlendingSpace()
Gets a BlendingColorSpace value that defines a color space that is used to perform transparency and blending operations on the page.
BlendingColorSpace
public void setBlendingSpace(int value)
Sets a BlendingColorSpace value that defines a color space that is used to perform transparency and blending operations on the page.
value
- int valueBlendingColorSpace
public void bindPdf(String pdfFile, int pageNumber)
Sets PDF file and number of page which will be used as stamp.
PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf"); Stamp stamp = new Stamp(); //First page will be used as stamp. stamp.bindPdf("stamp.pdf", 1); stamp.isBackground (true); fileStamp.addStamp(stamp); fileStamp.close();
pdfFile
- Path to PDF file.pageNumber
- Number of page in PDF filepublic void bindPdf(InputStream pdfStream, int pageNumber)
Sets PDF file and number of page which will be used as stamp.
PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf"); Stamp stamp = new Stamp(); //First page will be used as stamp. InputStream stream = new FileInputStream("stamp.pdf"); stamp.bindPdf(stream, 1); fileStamp.addStamp(stamp); fileStamp.close();
pdfStream
- Stream which contains PDF document.pageNumber
- Page index of the document whihc will be used as stamp.public void bindImage(String imageFile)
Sets image as a stamp.
PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf"); Stamp stamp = new Stamp(); stamp.bindImage("image.jpg"); fileStamp.addStamp(stamp); fileStamp.close();
imageFile
- Image file name and path.public void bindLogo(FormattedText formattedText)
Sets text as stamp.
formattedText
- FormattedText object which specifies text and text properties.public void setOrigin(float originX, float originY)
Sets position on page where stamp will be placed.
originX
- X coordinate of the stamp.originY
- Y coordinate of the stamp.public void setImageSize(float width, float height)
Sets size of image stamp. Image will be scaled according to the specified values.
width
- Image width.height
- Image height.public void bindImage(InputStream image)
Sets image which will be used as stamp.
image
- Stream which contains image data.public void close()