Class RubberStampWithImage


  • public class RubberStampWithImage
    extends java.lang.Object
    This is an example on how to add a rubber stamp annotation with an image to pages of a PDF document. To add a normal image, use the AddImageToPDF.java example.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void appendRawCommands​(java.io.OutputStream os, java.lang.String commands)  
      void doIt​(java.lang.String[] args)
      Add a rubber stamp with an jpg image to every page of the given document.
      private void drawXObject​(PDImageXObject xobject, PDResources resources, java.io.OutputStream os, float x, float y, float width, float height)  
      static void main​(java.lang.String[] args)
      This creates an instance of RubberStampWithImage.
      private void usage()
      This will print the usage for this example.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SAVE_GRAPHICS_STATE

        private static final java.lang.String SAVE_GRAPHICS_STATE
        See Also:
        Constant Field Values
      • RESTORE_GRAPHICS_STATE

        private static final java.lang.String RESTORE_GRAPHICS_STATE
        See Also:
        Constant Field Values
      • CONCATENATE_MATRIX

        private static final java.lang.String CONCATENATE_MATRIX
        See Also:
        Constant Field Values
      • FORMATDECIMAL

        private static final java.text.NumberFormat FORMATDECIMAL
    • Constructor Detail

      • RubberStampWithImage

        public RubberStampWithImage()
    • Method Detail

      • doIt

        public void doIt​(java.lang.String[] args)
                  throws java.io.IOException
        Add a rubber stamp with an jpg image to every page of the given document.
        Parameters:
        args - the command line arguments
        Throws:
        java.io.IOException - an exception is thrown if something went wrong
      • drawXObject

        private void drawXObject​(PDImageXObject xobject,
                                 PDResources resources,
                                 java.io.OutputStream os,
                                 float x,
                                 float y,
                                 float width,
                                 float height)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • appendRawCommands

        private void appendRawCommands​(java.io.OutputStream os,
                                       java.lang.String commands)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException
        This creates an instance of RubberStampWithImage.
        Parameters:
        args - The command line arguments.
        Throws:
        java.io.IOException - If there is an error parsing the document.
      • usage

        private void usage()
        This will print the usage for this example.