Stamp
Inheritance: java.lang.Object, com.aspose.pdf.facades.Stamp
public final class Stamp extends Object
Class represeting stamp.
Constructors
| Constructor | Description |
|---|---|
| Stamp | Constructor for Stamp object. |
Methods
| Method | Description |
|---|---|
| bindImage | Sets image which will be used as stamp. |
| bindImage | 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(); |
| bindLogo | Sets text as stamp. |
| bindPdf | 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(); |
| bindPdf | 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(); |
| bindTextState | Sets text state of stamp text. |
| close | Closes this instance |
| getBlendingSpace | Gets a BlendingColorSpace value that defines a color space that is used to perform transparency and blending operations on the page. |
| getOpacity | Gets opacity of the stamp. |
| getPageNumber | Gets page number. |
| getPages | Gets array with numbers of pages which will be affected by stamp. |
| getQuality | Gets quality of image stamp in percent. Valiued values 0..100%. |
| getRotation | Gets rotation of the stamp in degrees. |
| getStampId | Gets identifier of stamp. |
| isBackground | Gets background status. If true stamp will be placed as background of the spamped page. By default is set to false. |
| setBackground | Sets background status. If true stamp will be placed as background of the spamped page. By default is set to false. |
| setBlendingSpace | Sets a BlendingColorSpace value that defines a color space that is used to perform transparency and blending operations on the page. |
| setImageSize | Sets size of image stamp. Image will be scaled according to the specified values. |
| setOpacity | Sets opacity of the stamp. |
| setOrigin | Sets position on page where stamp will be placed. |
| setPageNumber | Sets page number. |
| setPages | Sets array with numbers of pages which will be affected by stamp. If Pages = null all pages of the document are affected. |
| setQuality | Sets quality of image stamp in percent. Valiued values 0..100%. |
| setRotation | Gets or sets rotation of the stamp in degrees. |
| setStampId | Sets identifier of stamp. |
Stamp
public Stamp()
Constructor for Stamp object.
bindImage
Sets image which will be used as stamp.
bindImage
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(); bindLogo
Sets text as stamp.
bindPdf
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(); bindPdf
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(); bindTextState
Sets text state of stamp text.
close
public void close()
Closes this instance
getBlendingSpace
public BlendingColorSpace getBlendingSpace()
Gets a BlendingColorSpace value that defines a color space that is used to perform transparency and blending operations on the page.
Returns: int value @see BlendingColorSpace
getOpacity
public float getOpacity()
Gets opacity of the stamp.
Returns: float value
getPageNumber
public int getPageNumber()
Gets page number.
Returns: int value
getPages
public int[] getPages()
Gets array with numbers of pages which will be affected by stamp.
Returns: int array
getQuality
public int getQuality()
Gets quality of image stamp in percent. Valiued values 0..100%.
Returns: int value
getRotation
public float getRotation()
Gets rotation of the stamp in degrees.
Returns: float value
getStampId
public int getStampId()
Gets identifier of stamp.
Returns: int value
isBackground
public boolean isBackground()
Gets background status. If true stamp will be placed as background of the spamped page. By default is set to false.
Returns: boolean value
setBackground
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.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean value |
setBlendingSpace
Sets a BlendingColorSpace value that defines a color space that is used to perform transparency and blending operations on the page.
setImageSize
public void setImageSize(float width, float height)
Sets size of image stamp. Image will be scaled according to the specified values.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| width | Image width. | |
| height | Image height. |
setOpacity
public void setOpacity(float value)
Sets opacity of the stamp.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | float value |
setOrigin
public void setOrigin(float originX, float originY)
Sets position on page where stamp will be placed.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| originX | X coordinate of the stamp. | |
| originY | Y coordinate of the stamp. |
setPageNumber
public void setPageNumber(int value)
Sets page number.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | int value |
setPages
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.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| 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(); |
setQuality
public void setQuality(int value)
Sets quality of image stamp in percent. Valiued values 0..100%.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | int value |
setRotation
public void setRotation(float value)
Gets or sets rotation of the stamp in degrees.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | float valuePdfFileStamp fileStamp = new PdfFileStamp(“input.pdf”, “output.pdf”); Stamp stamp = new Stamp(); stamp.bindLogo(new FormattedText(“STAMP”)); stamp.setRotation(90); fileStamp.addStamp(stamp); fileStamp.close(); |
setStampId
public void setStampId(int value)
Sets identifier of stamp.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | int value |