question: private void printAnnotationFromEditor ( final WorkflowAnnotation anno , final Graphics2D g2 ) { Graphics2D gPr = ( Graphics2D ) g2 . create ( ) ; Rectangle2D loc = anno . getLocation ( ) ; gPr . translate ( loc . getX ( ) , loc . getY ( ) ) ; gPr . setClip ( 0 , 0 , ( int ) loc . getWidth ( ) , ( int ) loc . getHeight ( ) ) ; Dimension size = new Dimension ( ( int ) loc . getWidth ( ) , ( int ) loc . getHeight ( ) ) ; pane . setSize ( size ) ; pane . setText ( AnnotationDrawUtils . createStyledCommentString ( anno ) ) ; pane . setCaretPosition ( 0 ) ; pane . paint ( gPr ) ; gPr . dispose ( ) ; }
target:  Bypass the cache and the speedy image drawing and directly paint the JEditorPane to the context. Required for printing in SVG format which would turn out pixelated if it were drawn as an image.