Index: PdfGraphics2D.java
===================================================================
--- PdfGraphics2D.java	(revision 104492)
+++ PdfGraphics2D.java	(working copy)
@@ -465,9 +465,26 @@
                     height /= scale;
                 double leftX = cb.getXTLM();
                 double leftY = cb.getYTLM();
-                PdfAction action = new  PdfAction(url.toString());
-                cb.setAction(action, (float)leftX, (float)leftY, (float)(leftX+width), (float)(leftY+height));
+				String urlStr = url.toString();
+				if (urlStr.startsWith("#")) 
+				{
+					cb.localGoto(urlStr.substring(1), (float) leftX, (float) leftY,
+							(float) (leftX + width), (float) (leftY + height));
+				} 
+				else 
+				{
+	               PdfAction action = new  PdfAction(url.toString());
+              	   cb.setAction(action, (float)leftX, (float)leftY, (float)(leftX+width), (float)(leftY+height));
+				}
+              
             }
+            Object id = getRenderingHint(IdKey.KEY_INSTANCE);
+            if (id!=null && !id.equals(IdKey.VALUE_IDKEY_OFF))
+            {
+            	double leftX = cb.getXTLM();
+                double leftY = cb.getYTLM();
+            	cb.localDestination(id.toString(),new PdfDestination(PdfDestination.XYZ, (float)leftX, (float)leftY, 0) );
+            }
             if (s.length() > 1) {
                 float adv = ((float)width - baseFont.getWidthPoint(s, fontSize)) / (s.length() - 1);
                 cb.setCharacterSpacing(adv);
@@ -555,6 +572,27 @@
      */
     public void fill(Shape s) {
         followPath(s, FILL);
+        Object url = getRenderingHint(HyperLinkKey.KEY_INSTANCE);
+        if (url != null && !url.equals(HyperLinkKey.VALUE_HYPERLINKKEY_OFF)) {
+
+            String urlStr = url.toString();
+            Rectangle2D bounds= transform.createTransformedShape(s).getBounds2D();
+            if (urlStr.startsWith("#")) 
+            {
+                cb.localGoto(urlStr.substring(1),(float)bounds.getMinX(),normalizeY((float)bounds.getMinY()),(float)bounds.getMaxX(),normalizeY((float)bounds.getMaxY()));
+            } 
+            else 
+            {
+                PdfAction action = new  PdfAction(url.toString());
+                cb.setAction(action, (float)bounds.getMinX(),normalizeY((float) bounds.getMinY()),(float)bounds.getMaxX(),normalizeY((float) bounds.getMaxY()));
+            }
+        }
+        Object id = getRenderingHint(IdKey.KEY_INSTANCE);
+        if (id!=null && !id.equals(IdKey.VALUE_IDKEY_OFF))
+        {
+            Rectangle2D bounds=transform.createTransformedShape(s).getBounds2D();
+            cb.localDestination(id.toString(),new PdfDestination(PdfDestination.XYZ, (float)bounds.getMinX(),normalizeY((float)bounds.getMinY()), 0) );
+        }
     }
     
     /**
@@ -1481,9 +1519,23 @@
             cb.addImage(image, (float)mx[0], (float)mx[1], (float)mx[2], (float)mx[3], (float)mx[4], (float)mx[5]);
             Object url = getRenderingHint(HyperLinkKey.KEY_INSTANCE);
             if (url != null && !url.equals(HyperLinkKey.VALUE_HYPERLINKKEY_OFF)) {
-            	PdfAction action = new  PdfAction(url.toString());
-                cb.setAction(action, (float)mx[4], (float)mx[5], (float)(mx[0]+mx[4]), (float)(mx[3]+mx[5]));
+
+				String urlStr = url.toString();
+            	if (urlStr.startsWith("#")) 
+				{
+					cb.localGoto(urlStr.substring(1), (float)mx[4], (float)mx[5], (float)(mx[0]+mx[4]), (float)(mx[3]+mx[5]));
+				} 
+				else 
+				{
+            		PdfAction action = new  PdfAction(url.toString());
+               		cb.setAction(action, (float)mx[4], (float)mx[5], (float)(mx[0]+mx[4]), (float)(mx[3]+mx[5]));
+				}
             }
+            Object id = getRenderingHint(IdKey.KEY_INSTANCE);
+            if (id!=null && !id.equals(IdKey.VALUE_IDKEY_OFF))
+            {
+            	cb.localDestination(id.toString(),new PdfDestination(PdfDestination.XYZ, (float)mx[4], (float)mx[5], 0) );
+            }
         } catch (Exception ex) {
             throw new IllegalArgumentException();
         }
@@ -1665,5 +1717,23 @@
 			return "HyperLinkKey";
 		}
 	}
+    public static class IdKey extends RenderingHints.Key
+	{
+	 	public static final IdKey KEY_INSTANCE = new IdKey(10000);
+	 	public static final Object VALUE_IDKEY_OFF = "0";
+	 	
+		protected IdKey(int arg0) {
+			super(arg0);
+		}
+		
+		public boolean isCompatibleValue(Object val)
+		{
+			return true;
+		}
+		public String toString()
+		{
+			return "IdKey";
+		}
+	}
 
 }
