com.aspose.pdf.facades

Class Stamp



  • public final class Stamp
    extends Object

    Class represeting stamp.

    • Constructor Summary

      Constructors 
      Constructor and Description
      Stamp()
      Constructor for Stamp object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      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.
    • Constructor Detail

      • Stamp

        public Stamp()

        Constructor for Stamp object.

    • Method Detail

      • getStampId

        public int getStampId()

        Gets identifier of stamp.

        Returns:
        int value
      • setStampId

        public void setStampId(int value)

        Sets identifier of stamp.

        Parameters:
        value - int value
      • getQuality

        public int getQuality()

        Gets quality of image stamp in percent. Valiued values 0..100%.

        Returns:
        int value
      • setQuality

        public void setQuality(int value)

        Sets quality of image stamp in percent. Valiued values 0..100%.

        Parameters:
        value - int value
      • getOpacity

        public float getOpacity()

        Gets opacity of the stamp.

        Returns:
        float value
      • setOpacity

        public void setOpacity(float value)

        Sets opacity of the stamp.

        Parameters:
        value - float value
      • getPageNumber

        public int getPageNumber()

        Gets page number.

        Returns:
        int value
      • setPageNumber

        public void setPageNumber(int value)

        Sets page number.

        Parameters:
        value - int value
      • getPages

        public int[] getPages()

        Gets array with numbers of pages which will be affected by stamp.

        Returns:
        int array
      • 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:
        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();
         
      • bindTextState

        public void bindTextState(TextState textState)

        Sets text state of stamp text.

        Parameters:
        textState - TextState object which specifies text properties.
      • getRotation

        public float getRotation()

        Gets rotation of the stamp in degrees.

        Returns:
        float value
      • setRotation

        public void setRotation(float value)

        Gets or sets rotation of the stamp in degrees.

        Parameters:
        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();
         
      • 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:
        value - boolean value
      • getBlendingSpace

        public int 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 Also:
        BlendingColorSpace
      • setBlendingSpace

        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.

        Parameters:
        value - int value
        See Also:
        BlendingColorSpace
      • bindPdf

        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();
         
        Parameters:
        pdfFile - Path to PDF file.
        pageNumber - Number of page in PDF file
      • bindPdf

        public 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();
         
        Parameters:
        pdfStream - Stream which contains PDF document.
        pageNumber - Page index of the document whihc will be used as stamp.
      • bindImage

        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();
         
        Parameters:
        imageFile - Image file name and path.
      • bindLogo

        public void bindLogo(FormattedText formattedText)

        Sets text as stamp.

        Parameters:
        formattedText - FormattedText object which specifies text and text properties.
      • setOrigin

        public void setOrigin(float originX,
                              float originY)

        Sets position on page where stamp will be placed.

        Parameters:
        originX - X coordinate of the stamp.
        originY - Y coordinate of the stamp.
      • setImageSize

        public void setImageSize(float width,
                                 float height)

        Sets size of image stamp. Image will be scaled according to the specified values.

        Parameters:
        width - Image width.
        height - Image height.
      • bindImage

        public void bindImage(InputStream image)

        Sets image which will be used as stamp.

        Parameters:
        image - Stream which contains image data.
      • close

        public void close()
        Closes this instance