question: public static void renderFlattenedAnnotation ( final PdfObject form , final DynamicVectorRenderer current , final int pageNumber , final int rotation ) { final BufferedImage image = AnnotationFactory . getIcon ( form ) ; if ( image != null ) { final GraphicsState gs = new GraphicsState ( ) ; final int iconHeight = image . getHeight ( ) ; final int iconWidth = image . getWidth ( ) ; final float [ ] rect = form . getFloatArray ( PdfDictionary . Rect ) ; if ( form . getParameterConstant ( PdfDictionary . Subtype ) == PdfDictionary . Text ) { rect [ 2 ] = rect [ 0 ] + iconWidth ; rect [ 1 ] = rect [ 3 ] - iconHeight ; form . setFloatArray ( PdfDictionary . Rect , rect ) ; } switch ( rotation % 360 ) { case 0 : gs . CTM = new float [ ] [ ] { { iconWidth , 0 , 1 } , { 0 , iconHeight , 1 } , { 0 , 0 , 0 } } ; gs . x = rect [ 0 ] ; gs . y = rect [ 3 ] - iconHeight ; gs . CTM [ 2 ] [ 0 ] = rect [ 0 ] ; gs . CTM [ 2 ] [ 1 ] = rect [ 3 ] - iconHeight ; break ; case 90 : gs . CTM = new float [ ] [ ] { { 0 , iconWidth , 1 } , { - iconHeight , 0 , 1 } , { 0 , 0 , 0 } } ; gs . x = rect [ 0 ] + iconHeight ; gs . y = rect [ 3 ] ; gs . CTM [ 2 ] [ 0 ] = rect [ 0 ] + iconHeight ; gs . CTM [ 2 ] [ 1 ] = rect [ 3 ] ; break ; case 180 : gs . CTM = new float [ ] [ ] { { - iconWidth , 0 , 1 } , { 0 , - iconHeight , 1 } , { 0 , 0 , 0 } } ; gs . x = rect [ 0 ] ; gs . y = rect [ 3 ] + iconHeight ; gs . CTM [ 2 ] [ 0 ] = rect [ 0 ] ; gs . CTM [ 2 ] [ 1 ] = rect [ 3 ] + iconHeight ; break ; case 270 : gs . CTM = new float [ ] [ ] { { 0 , - iconWidth , 1 } , { iconHeight , 0 , 1 } , { 0 , 0 , 0 } } ; gs . x = rect [ 0 ] - iconHeight ; gs . y = rect [ 3 ] ; gs . CTM [ 2 ] [ 0 ] = rect [ 0 ] - iconHeight ; gs . CTM [ 2 ] [ 1 ] = rect [ 3 ] ; break ; } if ( form . getParameterConstant ( PdfDictionary . Subtype ) == PdfDictionary . Highlight ) { current . setGraphicsState ( GraphicsState . STROKE , gs . getAlpha ( GraphicsState . STROKE ) , PdfDictionary . Darken ) ; current . setGraphicsState ( GraphicsState . FILL , gs . getAlpha ( GraphicsState . FILL ) , PdfDictionary . Darken ) ; } current . drawImage ( pageNumber , image , gs , false , form . getObjectRefAsString ( ) , - 1 ) ; if ( form . getParameterConstant ( PdfDictionary . Subtype ) == PdfDictionary . Highlight ) { current . setGraphicsState ( GraphicsState . STROKE , gs . getAlpha ( GraphicsState . STROKE ) , PdfDictionary . Normal ) ; current . setGraphicsState ( GraphicsState . FILL , gs . getAlpha ( GraphicsState . FILL ) , PdfDictionary . Normal ) ; } } }
target:  Method to create an icon to represent the annotation and render it.