Bug 560817: [Model2Doc] The user must be able to define the margin around the image representing the diagram

Change-Id: I27786036eb90182fb954575b106e19f05e98c676
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
diff --git a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.edit/META-INF/MANIFEST.MF b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.edit/META-INF/MANIFEST.MF
index 8939b40..a921583 100755
--- a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.edit/META-INF/MANIFEST.MF
+++ b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.edit/META-INF/MANIFEST.MF
@@ -23,5 +23,6 @@
  org.eclipse.papyrus.infra.emf.expressions;bundle-version="[1.1.0,2.0.0)",
  org.eclipse.papyrus.infra.emf.expressions.edit;bundle-version="[1.1.0,2.0.0)",
  org.eclipse.papyrus.model2doc.core.author.edit;bundle-version="[0.7.0,1.0.0)",
- org.eclipse.papyrus.model2doc.core.builtintypes;bundle-version="[0.7.0,1.0.0)"
+ org.eclipse.papyrus.model2doc.core.builtintypes;bundle-version="[0.7.0,1.0.0)",
+ org.eclipse.papyrus.model2doc.core.builtintypes.edit;bundle-version="[0.7.0,1.0.0)"
 Bundle-ActivationPolicy: lazy
diff --git a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.edit/plugin.properties b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.edit/plugin.properties
index 1362735..c395776 100755
--- a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.edit/plugin.properties
+++ b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.edit/plugin.properties
@@ -25,3 +25,4 @@
 _UI_Unknown_datatype= Value
 _UI_GMFDiagramView_diagramType_feature = Diagram Type
 _UI_Unknown_feature = Unspecified
+_UI_GMFDiagramView_diagramImageMargin_feature = Diagram Image Margin
diff --git a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.edit/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/provider/GMFDiagramViewItemProvider.java b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.edit/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/provider/GMFDiagramViewItemProvider.java
index c9a9198..3315ffa 100755
--- a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.edit/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/provider/GMFDiagramViewItemProvider.java
+++ b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.edit/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/provider/GMFDiagramViewItemProvider.java
@@ -83,6 +83,7 @@
 			addGenerateTitlePropertyDescriptor(object);
 			addCustomTitlePropertyDescriptor(object);
 			addDiagramTypePropertyDescriptor(object);
+			addDiagramImageMarginPropertyDescriptor(object);
 		}
 		return itemPropertyDescriptors;
 	}
@@ -172,6 +173,27 @@
 	}
 
 	/**
+	 * This adds a property descriptor for the Diagram Image Margin feature.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @generated
+	 */
+	protected void addDiagramImageMarginPropertyDescriptor(Object object) {
+		itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
+				getResourceLocator(),
+				getString("_UI_GMFDiagramView_diagramImageMargin_feature"), //$NON-NLS-1$
+				getString("_UI_PropertyDescriptor_description", "_UI_GMFDiagramView_diagramImageMargin_feature", "_UI_GMFDiagramView_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				GMFDocumentStructureTemplatePackage.Literals.GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN,
+				true,
+				false,
+				false,
+				ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
+				null,
+				null));
+	}
+
+	/**
 	 * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
 	 * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
 	 * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
@@ -258,6 +280,7 @@
 		case GMFDocumentStructureTemplatePackage.GMF_DIAGRAM_VIEW__GENERATE_TITLE:
 		case GMFDocumentStructureTemplatePackage.GMF_DIAGRAM_VIEW__CUSTOM_TITLE:
 		case GMFDocumentStructureTemplatePackage.GMF_DIAGRAM_VIEW__DIAGRAM_TYPE:
+		case GMFDocumentStructureTemplatePackage.GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN:
 			fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
 			return;
 		case GMFDocumentStructureTemplatePackage.GMF_DIAGRAM_VIEW__GENERATE_BRANCH_CONDITION:
diff --git a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.edit/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/provider/GMFDocumentStructureTemplateEditPlugin.java b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.edit/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/provider/GMFDocumentStructureTemplateEditPlugin.java
index 3ec6134..e544f53 100755
--- a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.edit/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/provider/GMFDocumentStructureTemplateEditPlugin.java
+++ b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.edit/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/provider/GMFDocumentStructureTemplateEditPlugin.java
@@ -21,6 +21,7 @@
 
 import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsEditPlugin;
 import org.eclipse.papyrus.model2doc.core.author.provider.AuthorEditPlugin;
+import org.eclipse.papyrus.model2doc.core.builtintypes.provider.BuiltInTypesEditPlugin;
 import org.eclipse.papyrus.model2doc.core.generatorconfiguration.provider.GeneratorconfigurationEditPlugin;
 
 import org.eclipse.papyrus.model2doc.emf.documentstructuretemplate.provider.DocumentStructureTemplateEditPlugin;
@@ -67,6 +68,7 @@
 				GeneratorconfigurationEditPlugin.INSTANCE,
 				AuthorEditPlugin.INSTANCE,
 				ExpressionsEditPlugin.INSTANCE,
+				BuiltInTypesEditPlugin.INSTANCE,
 		});
 	}
 
diff --git a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/META-INF/MANIFEST.MF b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/META-INF/MANIFEST.MF
index 20be856..92d716a 100755
--- a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/META-INF/MANIFEST.MF
+++ b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/META-INF/MANIFEST.MF
@@ -17,5 +17,6 @@
  org.eclipse.papyrus.model2doc.core.generatorconfiguration;bundle-version="[0.7.0,1.0.0)",
  org.eclipse.gmf.runtime.notation;bundle-version="[1.9.0,2.0.0)",
  org.eclipse.papyrus.infra.emf.expressions;bundle-version="[1.1.0,2.0.0)",
- org.eclipse.papyrus.model2doc.core.author;bundle-version="[0.7.0,1.0.0)"
+ org.eclipse.papyrus.model2doc.core.author;bundle-version="[0.7.0,1.0.0)",
+ org.eclipse.papyrus.model2doc.core.builtintypes;bundle-version="[0.7.0,1.0.0)"
 Bundle-ActivationPolicy: lazy
diff --git a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/model/gmfdocumentstructuretemplate.ecore b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/model/gmfdocumentstructuretemplate.ecore
index e156f33..9ca0de7 100755
--- a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/model/gmfdocumentstructuretemplate.ecore
+++ b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/model/gmfdocumentstructuretemplate.ecore
@@ -31,6 +31,13 @@
         <details key="documentation" value="The type of diagram to manage. If no type is defined, we will take all diagrams."/>
       </eAnnotations>
     </eStructuralFeatures>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="diagramImageMargin" ordered="false"
+        lowerBound="1" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
+        defaultValueLiteral="10">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="This field allows to define the size of the margin around the diagram snapshot. The value is interpreted as Pixel. The default value is 10."/>
+      </eAnnotations>
+    </eStructuralFeatures>
   </eClassifiers>
   <eClassifiers xsi:type="ecore:EClass" name="Diagram" instanceClassName="org.eclipse.gmf.runtime.notation.Diagram"
       abstract="true" interface="true">
diff --git a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/model/gmfdocumentstructuretemplate.genmodel b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/model/gmfdocumentstructuretemplate.genmodel
index c77b7ba..52dcc8e 100755
--- a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/model/gmfdocumentstructuretemplate.genmodel
+++ b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/model/gmfdocumentstructuretemplate.genmodel
@@ -10,7 +10,7 @@
     nonNLSMarkers="true" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
     codeFormatting="true" commentFormatting="true" testsDirectory="/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.tests/src-gen"
     importerID="org.eclipse.uml2.uml.ecore.importer" complianceLevel="8.0" copyrightFields="false"
-    usedGenPackages="../../org.eclipse.papyrus.model2doc.emf.documentstructuretemplate/model/documentstructuretemplate.genmodel#//documentstructuretemplate ../../org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore ../../org.eclipse.papyrus.model2doc.core.generatorconfiguration/model/generatorconfiguration.genmodel#//generatorconfiguration ../../org.eclipse.papyrus.model2doc.core.author/model/author.genmodel#//author ../../org.eclipse.papyrus.infra.emf.expressions/model/expressions.genmodel#//expressions"
+    usedGenPackages="../../org.eclipse.papyrus.model2doc.emf.documentstructuretemplate/model/documentstructuretemplate.genmodel#//documentstructuretemplate ../../org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore ../../org.eclipse.papyrus.model2doc.core.generatorconfiguration/model/generatorconfiguration.genmodel#//generatorconfiguration ../../org.eclipse.papyrus.model2doc.core.author/model/author.genmodel#//author ../../org.eclipse.papyrus.infra.emf.expressions/model/expressions.genmodel#//expressions ../../org.eclipse.papyrus.model2doc.core.builtintypes/model/BuiltInTypes.genmodel#//builtintypes"
     operationReflection="true" importOrganizing="true" cleanup="true" oSGiCompatible="true"
     pluralizedGetters="true">
   <genAnnotations source="http://www.eclipse.org/emf/2002/GenModel/importer/org.eclipse.uml2.uml.ecore.importer">
@@ -45,6 +45,7 @@
     <genClasses xsi:type="genmodel:GenClass" ecoreClass="gmfdocumentstructuretemplate.ecore#//GMFDiagramView"
         labelFeature="../../org.eclipse.papyrus.model2doc.emf.documentstructuretemplate/model/documentstructuretemplate.genmodel#//documentstructuretemplate/IBodySectionPartTemplate/customTitle">
       <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute gmfdocumentstructuretemplate.ecore#//GMFDiagramView/diagramType"/>
+      <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute gmfdocumentstructuretemplate.ecore#//GMFDiagramView/diagramImageMargin"/>
       <genOperations xsi:type="genmodel:GenOperation" ecoreOperation="gmfdocumentstructuretemplate.ecore#//GMFDiagramView/getMatchingDiagrams">
         <genParameters xsi:type="genmodel:GenParameter" ecoreParameter="gmfdocumentstructuretemplate.ecore#//GMFDiagramView/getMatchingDiagrams/expectedDiagramContext"/>
       </genOperations>
diff --git a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/model/gmfdocumentstructuretemplate.notation b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/model/gmfdocumentstructuretemplate.notation
index 20063e2..5df4418 100755
--- a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/model/gmfdocumentstructuretemplate.notation
+++ b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/model/gmfdocumentstructuretemplate.notation
@@ -62,6 +62,10 @@
         <element xmi:type="uml:Property" href="gmfdocumentstructuretemplate.uml#_m-bngFbTEemQV827ZWTfig"/>
         <layoutConstraint xmi:type="notation:Location" xmi:id="_m-n0wVbTEemQV827ZWTfig"/>
       </children>
+      <children xmi:type="notation:Shape" xmi:id="_kegPwF4vEeq9HfUuM3wZYw" type="Property_ClassAttributeLabel">
+        <element xmi:type="uml:Property" href="gmfdocumentstructuretemplate.uml#_kd-rUF4vEeq9HfUuM3wZYw"/>
+        <layoutConstraint xmi:type="notation:Location" xmi:id="_kegPwV4vEeq9HfUuM3wZYw"/>
+      </children>
       <styles xmi:type="notation:TitleStyle" xmi:id="_cqq4tFbTEemQV827ZWTfig"/>
       <styles xmi:type="notation:SortingStyle" xmi:id="_cqq4tVbTEemQV827ZWTfig"/>
       <styles xmi:type="notation:FilteringStyle" xmi:id="_cqq4tlbTEemQV827ZWTfig"/>
@@ -116,13 +120,13 @@
     <element xmi:type="uml:Interface" href="gmfdocumentstructuretemplate.uml#_qmWI8FwvEemF3-UZXrtb4g"/>
     <layoutConstraint xmi:type="notation:Bounds" xmi:id="_qmXXEVwvEemF3-UZXrtb4g" x="80" y="440" width="181" height="141"/>
   </children>
-  <children xmi:type="notation:Shape" xmi:id="_7tCBoIXzEemhaembVcoeKQ" type="StereotypeComment">
-    <styles xmi:type="notation:TitleStyle" xmi:id="_7tCBoYXzEemhaembVcoeKQ"/>
-    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_7tCBo4XzEemhaembVcoeKQ" name="BASE_ELEMENT">
+  <children xmi:type="notation:Shape" xmi:id="_hFCZkF4vEeq9HfUuM3wZYw" type="StereotypeComment">
+    <styles xmi:type="notation:TitleStyle" xmi:id="_hFCZkV4vEeq9HfUuM3wZYw"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_hFCZk14vEeq9HfUuM3wZYw" name="BASE_ELEMENT">
       <eObjectValue xmi:type="uml:Interface" href="gmfdocumentstructuretemplate.uml#_qmWI8FwvEemF3-UZXrtb4g"/>
     </styles>
     <element xsi:nil="true"/>
-    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7tCBooXzEemhaembVcoeKQ" x="280" y="440"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hFCZkl4vEeq9HfUuM3wZYw" x="280" y="440"/>
   </children>
   <styles xmi:type="notation:StringValueStyle" xmi:id="_N4Mi4VbTEemQV827ZWTfig" name="diagram_compatibility_version" stringValue="1.4.0"/>
   <styles xmi:type="notation:DiagramStyle" xmi:id="_N4Mi4lbTEemQV827ZWTfig"/>
@@ -163,14 +167,14 @@
     <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_0Oo5UFbTEemQV827ZWTfig" id="(0.4990403071017274,0.0)"/>
     <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_0Oo5UVbTEemQV827ZWTfig" id="(0.4968944099378882,1.0)"/>
   </edges>
-  <edges xmi:type="notation:Connector" xmi:id="_7tCosIXzEemhaembVcoeKQ" type="StereotypeCommentLink" source="_qmXXEFwvEemF3-UZXrtb4g" target="_7tCBoIXzEemhaembVcoeKQ">
-    <styles xmi:type="notation:FontStyle" xmi:id="_7tCosYXzEemhaembVcoeKQ"/>
-    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_7tCotYXzEemhaembVcoeKQ" name="BASE_ELEMENT">
+  <edges xmi:type="notation:Connector" xmi:id="_hFDAoF4vEeq9HfUuM3wZYw" type="StereotypeCommentLink" source="_qmXXEFwvEemF3-UZXrtb4g" target="_hFCZkF4vEeq9HfUuM3wZYw">
+    <styles xmi:type="notation:FontStyle" xmi:id="_hFDAoV4vEeq9HfUuM3wZYw"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_hFDApV4vEeq9HfUuM3wZYw" name="BASE_ELEMENT">
       <eObjectValue xmi:type="uml:Interface" href="gmfdocumentstructuretemplate.uml#_qmWI8FwvEemF3-UZXrtb4g"/>
     </styles>
     <element xsi:nil="true"/>
-    <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_7tCosoXzEemhaembVcoeKQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
-    <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_7tCos4XzEemhaembVcoeKQ"/>
-    <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_7tCotIXzEemhaembVcoeKQ"/>
+    <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hFDAol4vEeq9HfUuM3wZYw" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+    <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hFDAo14vEeq9HfUuM3wZYw"/>
+    <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hFDApF4vEeq9HfUuM3wZYw"/>
   </edges>
 </notation:Diagram>
diff --git a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/model/gmfdocumentstructuretemplate.uml b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/model/gmfdocumentstructuretemplate.uml
index bf01cc1..803206f 100755
--- a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/model/gmfdocumentstructuretemplate.uml
+++ b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/model/gmfdocumentstructuretemplate.uml
@@ -15,6 +15,17 @@
         <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/EcorePrimitiveTypes.library.uml#EString"/>
         <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_L5x48FbUEemQV827ZWTfig"/>
       </ownedAttribute>
+      <ownedAttribute xmi:type="uml:Property" xmi:id="_kd-rUF4vEeq9HfUuM3wZYw" name="diagramImageMargin">
+        <ownedComment xmi:type="uml:Comment" xmi:id="_ngasIF4wEeq9HfUuM3wZYw" annotatedElement="_kd-rUF4vEeq9HfUuM3wZYw">
+          <body>This field allows to define the size of the margin around the diagram snapshot. The value is interpreted as Pixel. The default value is 10.</body>
+        </ownedComment>
+        <type xmi:type="uml:PrimitiveType" href="pathmap://ECORE_METAMODEL_LIBRARY/Ecore.uml#_SeWkZcX_EduPJbEsMYXjUQ"/>
+        <defaultValue xmi:type="uml:LiteralInteger" xmi:id="_XN_mgF4wEeq9HfUuM3wZYw" name="DEFAULT_VALUE" value="10">
+          <ownedComment xmi:type="uml:Comment" xmi:id="_4rHdkF4wEeq9HfUuM3wZYw" annotatedElement="_XN_mgF4wEeq9HfUuM3wZYw">
+            <body>Default value for the margin (10 pixels), to get the initial GMF behavior, we use the same value than declared in org.eclipse.gmf.runtime.diagram.ui.render.clipboard.DiagramGenerator.DEFAULT_IMAGE_MARGIN_PIXELS.</body>
+          </ownedComment>
+        </defaultValue>
+      </ownedAttribute>
       <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_zuWPsFbTEemQV827ZWTfig" client="_cqi84FbTEemQV827ZWTfig">
         <supplier xmi:type="uml:Interface" href="pathmap://DOCUMENT_STRUCTURE_TEMPLATE/documentstructuretemplate.uml#_DwGdIFYFEemKJasCEBKPhQ"/>
         <contract xmi:type="uml:Interface" href="pathmap://DOCUMENT_STRUCTURE_TEMPLATE/documentstructuretemplate.uml#_DwGdIFYFEemKJasCEBKPhQ"/>
diff --git a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/GMFDiagramView.java b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/GMFDiagramView.java
index e5d4eb4..6fa80a7 100755
--- a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/GMFDiagramView.java
+++ b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/GMFDiagramView.java
@@ -36,6 +36,7 @@
  * </p>
  * <ul>
  * <li>{@link org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.GMFDiagramView#getDiagramType <em>Diagram Type</em>}</li>
+ * <li>{@link org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.GMFDiagramView#getDiagramImageMargin <em>Diagram Image Margin</em>}</li>
  * </ul>
  *
  * @see org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.GMFDocumentStructureTemplatePackage#getGMFDiagramView()
@@ -72,6 +73,35 @@
 	void setDiagramType(String value);
 
 	/**
+	 * Returns the value of the '<em><b>Diagram Image Margin</b></em>' attribute.
+	 * The default value is <code>"10"</code>.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * <!-- begin-model-doc -->
+	 * This field allows to define the size of the margin around the diagram snapshot. The value is interpreted as Pixel. The default value is 10.
+	 * <!-- end-model-doc -->
+	 *
+	 * @return the value of the '<em>Diagram Image Margin</em>' attribute.
+	 * @see #setDiagramImageMargin(int)
+	 * @see org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.GMFDocumentStructureTemplatePackage#getGMFDiagramView_DiagramImageMargin()
+	 * @model default="10" required="true" ordered="false"
+	 * @generated
+	 */
+	int getDiagramImageMargin();
+
+	/**
+	 * Sets the value of the '{@link org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.GMFDiagramView#getDiagramImageMargin <em>Diagram Image Margin</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @param value
+	 *                  the new value of the '<em>Diagram Image Margin</em>' attribute.
+	 * @see #getDiagramImageMargin()
+	 * @generated
+	 */
+	void setDiagramImageMargin(int value);
+
+	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * <!-- begin-model-doc -->
diff --git a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/GMFDocumentStructureTemplatePackage.java b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/GMFDocumentStructureTemplatePackage.java
index 6a337a3..6f9c3e8 100755
--- a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/GMFDocumentStructureTemplatePackage.java
+++ b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/GMFDocumentStructureTemplatePackage.java
@@ -137,6 +137,16 @@
 	int GMF_DIAGRAM_VIEW__DIAGRAM_TYPE = DocumentStructureTemplatePackage.ITEMPLATE_PART_VIEW_FEATURE_COUNT + 4;
 
 	/**
+	 * The feature id for the '<em><b>Diagram Image Margin</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @generated
+	 * @ordered
+	 */
+	int GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN = DocumentStructureTemplatePackage.ITEMPLATE_PART_VIEW_FEATURE_COUNT + 5;
+
+	/**
 	 * The number of structural features of the '<em>GMF Diagram View</em>' class.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -144,7 +154,7 @@
 	 * @generated
 	 * @ordered
 	 */
-	int GMF_DIAGRAM_VIEW_FEATURE_COUNT = DocumentStructureTemplatePackage.ITEMPLATE_PART_VIEW_FEATURE_COUNT + 5;
+	int GMF_DIAGRAM_VIEW_FEATURE_COUNT = DocumentStructureTemplatePackage.ITEMPLATE_PART_VIEW_FEATURE_COUNT + 6;
 
 	/**
 	 * The operation id for the '<em>Build Part Template Title</em>' operation.
@@ -242,6 +252,18 @@
 	EAttribute getGMFDiagramView_DiagramType();
 
 	/**
+	 * Returns the meta object for the attribute '{@link org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.GMFDiagramView#getDiagramImageMargin <em>Diagram Image Margin</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @return the meta object for the attribute '<em>Diagram Image Margin</em>'.
+	 * @see org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.GMFDiagramView#getDiagramImageMargin()
+	 * @see #getGMFDiagramView()
+	 * @generated
+	 */
+	EAttribute getGMFDiagramView_DiagramImageMargin();
+
+	/**
 	 * Returns the meta object for the '{@link org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.GMFDiagramView#getMatchingDiagrams(org.eclipse.emf.ecore.EObject) <em>Get Matching Diagrams</em>}' operation.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -310,6 +332,15 @@
 		EAttribute GMF_DIAGRAM_VIEW__DIAGRAM_TYPE = eINSTANCE.getGMFDiagramView_DiagramType();
 
 		/**
+		 * The meta object literal for the '<em><b>Diagram Image Margin</b></em>' attribute feature.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 *
+		 * @generated
+		 */
+		EAttribute GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN = eINSTANCE.getGMFDiagramView_DiagramImageMargin();
+
+		/**
 		 * The meta object literal for the '<em><b>Get Matching Diagrams</b></em>' operation.
 		 * <!-- begin-user-doc -->
 		 * <!-- end-user-doc -->
diff --git a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/impl/GMFDiagramViewImpl.java b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/impl/GMFDiagramViewImpl.java
index de14c7d..d7cc185 100755
--- a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/impl/GMFDiagramViewImpl.java
+++ b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/impl/GMFDiagramViewImpl.java
@@ -51,6 +51,7 @@
  * <li>{@link org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.impl.GMFDiagramViewImpl#getCustomTitle <em>Custom Title</em>}</li>
  * <li>{@link org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.impl.GMFDiagramViewImpl#getGenerateBranchCondition <em>Generate Branch Condition</em>}</li>
  * <li>{@link org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.impl.GMFDiagramViewImpl#getDiagramType <em>Diagram Type</em>}</li>
+ * <li>{@link org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.impl.GMFDiagramViewImpl#getDiagramImageMargin <em>Diagram Image Margin</em>}</li>
  * </ul>
  *
  * @generated
@@ -156,6 +157,28 @@
 	protected String diagramType = DIAGRAM_TYPE_EDEFAULT;
 
 	/**
+	 * The default value of the '{@link #getDiagramImageMargin() <em>Diagram Image Margin</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @see #getDiagramImageMargin()
+	 * @generated
+	 * @ordered
+	 */
+	protected static final int DIAGRAM_IMAGE_MARGIN_EDEFAULT = 10;
+
+	/**
+	 * The cached value of the '{@link #getDiagramImageMargin() <em>Diagram Image Margin</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @see #getDiagramImageMargin()
+	 * @generated
+	 * @ordered
+	 */
+	protected int diagramImageMargin = DIAGRAM_IMAGE_MARGIN_EDEFAULT;
+
+	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 *
@@ -343,6 +366,32 @@
 	 * @generated
 	 */
 	@Override
+	public int getDiagramImageMargin() {
+		return diagramImageMargin;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @generated
+	 */
+	@Override
+	public void setDiagramImageMargin(int newDiagramImageMargin) {
+		int oldDiagramImageMargin = diagramImageMargin;
+		diagramImageMargin = newDiagramImageMargin;
+		if (eNotificationRequired()) {
+			eNotify(new ENotificationImpl(this, Notification.SET, GMFDocumentStructureTemplatePackage.GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN, oldDiagramImageMargin, diagramImageMargin));
+		}
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @generated
+	 */
+	@Override
 	public String buildPartTemplateTitle(final EObject context) {
 		return org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate.internal.operations.GMFBodySectionPartTemplateTitleOperations.GMF_INSTANCE.buildPartTemplateTitle(this, context);
 	}
@@ -412,6 +461,8 @@
 			return getGenerateBranchCondition();
 		case GMFDocumentStructureTemplatePackage.GMF_DIAGRAM_VIEW__DIAGRAM_TYPE:
 			return getDiagramType();
+		case GMFDocumentStructureTemplatePackage.GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN:
+			return getDiagramImageMargin();
 		}
 		return super.eGet(featureID, resolve, coreType);
 	}
@@ -440,6 +491,9 @@
 		case GMFDocumentStructureTemplatePackage.GMF_DIAGRAM_VIEW__DIAGRAM_TYPE:
 			setDiagramType((String) newValue);
 			return;
+		case GMFDocumentStructureTemplatePackage.GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN:
+			setDiagramImageMargin((Integer) newValue);
+			return;
 		}
 		super.eSet(featureID, newValue);
 	}
@@ -468,6 +522,9 @@
 		case GMFDocumentStructureTemplatePackage.GMF_DIAGRAM_VIEW__DIAGRAM_TYPE:
 			setDiagramType(DIAGRAM_TYPE_EDEFAULT);
 			return;
+		case GMFDocumentStructureTemplatePackage.GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN:
+			setDiagramImageMargin(DIAGRAM_IMAGE_MARGIN_EDEFAULT);
+			return;
 		}
 		super.eUnset(featureID);
 	}
@@ -491,6 +548,8 @@
 			return generateBranchCondition != null;
 		case GMFDocumentStructureTemplatePackage.GMF_DIAGRAM_VIEW__DIAGRAM_TYPE:
 			return DIAGRAM_TYPE_EDEFAULT == null ? diagramType != null : !DIAGRAM_TYPE_EDEFAULT.equals(diagramType);
+		case GMFDocumentStructureTemplatePackage.GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN:
+			return diagramImageMargin != DIAGRAM_IMAGE_MARGIN_EDEFAULT;
 		}
 		return super.eIsSet(featureID);
 	}
@@ -642,6 +701,8 @@
 		result.append(customTitle);
 		result.append(", diagramType: "); //$NON-NLS-1$
 		result.append(diagramType);
+		result.append(", diagramImageMargin: "); //$NON-NLS-1$
+		result.append(diagramImageMargin);
 		result.append(')');
 		return result.toString();
 	}
diff --git a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/impl/GMFDocumentStructureTemplatePackageImpl.java b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/impl/GMFDocumentStructureTemplatePackageImpl.java
index 6f8e9d2..f130b0f 100755
--- a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/impl/GMFDocumentStructureTemplatePackageImpl.java
+++ b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/gmf/documentstructuretemplate/impl/GMFDocumentStructureTemplatePackageImpl.java
@@ -25,6 +25,7 @@
 
 import org.eclipse.papyrus.infra.emf.expressions.ExpressionsPackage;
 import org.eclipse.papyrus.model2doc.core.author.AuthorPackage;
+import org.eclipse.papyrus.model2doc.core.builtintypes.BuiltInTypesPackage;
 import org.eclipse.papyrus.model2doc.core.generatorconfiguration.GeneratorConfigurationPackage;
 
 import org.eclipse.papyrus.model2doc.emf.documentstructuretemplate.DocumentStructureTemplatePackage;
@@ -119,6 +120,7 @@
 		GeneratorConfigurationPackage.eINSTANCE.eClass();
 		AuthorPackage.eINSTANCE.eClass();
 		ExpressionsPackage.eINSTANCE.eClass();
+		BuiltInTypesPackage.eINSTANCE.eClass();
 
 		// Create package meta-data objects
 		theGMFDocumentStructureTemplatePackage.createPackageContents();
@@ -163,6 +165,17 @@
 	 * @generated
 	 */
 	@Override
+	public EAttribute getGMFDiagramView_DiagramImageMargin() {
+		return (EAttribute) gmfDiagramViewEClass.getEStructuralFeatures().get(1);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @generated
+	 */
+	@Override
 	public EOperation getGMFDiagramView__GetMatchingDiagrams__EObject() {
 		return gmfDiagramViewEClass.getEOperations().get(0);
 	}
@@ -214,6 +227,7 @@
 		// Create classes and their features
 		gmfDiagramViewEClass = createEClass(GMF_DIAGRAM_VIEW);
 		createEAttribute(gmfDiagramViewEClass, GMF_DIAGRAM_VIEW__DIAGRAM_TYPE);
+		createEAttribute(gmfDiagramViewEClass, GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN);
 		createEOperation(gmfDiagramViewEClass, GMF_DIAGRAM_VIEW___GET_MATCHING_DIAGRAMS__EOBJECT);
 
 		diagramEClass = createEClass(DIAGRAM);
@@ -261,6 +275,7 @@
 		// Initialize classes, features, and operations; add parameters
 		initEClass(gmfDiagramViewEClass, GMFDiagramView.class, "GMFDiagramView", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
 		initEAttribute(getGMFDiagramView_DiagramType(), ecorePackage.getEString(), "diagramType", null, 0, 1, GMFDiagramView.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); //$NON-NLS-1$
+		initEAttribute(getGMFDiagramView_DiagramImageMargin(), theEcorePackage.getEInt(), "diagramImageMargin", "10", 1, 1, GMFDiagramView.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
 
 		EOperation op = initEOperation(getGMFDiagramView__GetMatchingDiagrams__EObject(), this.getDiagram(), "getMatchingDiagrams", 0, -1, IS_UNIQUE, !IS_ORDERED); //$NON-NLS-1$
 		addEParameter(op, theEcorePackage.getEObject(), "expectedDiagramContext", 1, 1, IS_UNIQUE, !IS_ORDERED); //$NON-NLS-1$
diff --git a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.template2structure/src/org/eclipse/papyrus/model2doc/gmf/template2structure/internal/mapping/CustomCopyToImageUtils.java b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.template2structure/src/org/eclipse/papyrus/model2doc/gmf/template2structure/internal/mapping/CustomCopyToImageUtils.java
new file mode 100755
index 0000000..b78d0ab
--- /dev/null
+++ b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.template2structure/src/org/eclipse/papyrus/model2doc/gmf/template2structure/internal/mapping/CustomCopyToImageUtils.java
@@ -0,0 +1,83 @@
+/*****************************************************************************
+ * Copyright (c) 2020 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ *    Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.model2doc.gmf.template2structure.internal.mapping;
+
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.image.ImageFileFormat;
+import org.eclipse.gmf.runtime.diagram.ui.render.clipboard.DiagramGenerator;
+import org.eclipse.gmf.runtime.diagram.ui.render.util.CopyToImageUtil;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil;
+
+/**
+ * TODO : move me into Papyrus
+ *
+ * Allows to create diagram image defining the margin around the diagram
+ */
+public class CustomCopyToImageUtils extends CopyToImageUtil {
+
+	/**
+	 * equivalent to the margin defined by org.eclipse.gmf.runtime.diagram.ui.render.clipboard.DiagramGenerator.DEFAULT_IMAGE_MARGIN_PIXELS
+	 */
+	private static final int DEFAULT_MARGIN = 10;
+
+	/**
+	 * The size of the margin
+	 */
+	private int margin = 0;
+
+	/**
+	 *
+	 * Constructor.
+	 *
+	 * @param margin
+	 *            the margin to use around the image, in pixel value
+	 */
+	public CustomCopyToImageUtils(int margin) {
+		super();
+		if (this.margin >= 0) {
+			this.margin = margin;
+		} else {
+			this.margin = DEFAULT_MARGIN;
+		}
+
+	}
+
+	/**
+	 *
+	 * Constructor.
+	 *
+	 */
+	public CustomCopyToImageUtils() {
+		this(DEFAULT_MARGIN);
+	}
+
+	/**
+	 * @see org.eclipse.gmf.runtime.diagram.ui.render.util.CopyToImageUtil#getDiagramGenerator(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart, org.eclipse.gmf.runtime.diagram.ui.image.ImageFileFormat)
+	 *
+	 * @param diagramEP
+	 * @param format
+	 * @return
+	 */
+	@Override
+	protected DiagramGenerator getDiagramGenerator(final DiagramEditPart diagramEP, final ImageFileFormat format) {
+		DiagramGenerator generator = super.getDiagramGenerator(diagramEP, format);
+		final IMapMode mm = MapModeUtil.getMapMode(diagramEP.getFigure());
+		generator.setImageMargin(mm.DPtoLP(this.margin));
+		return generator;
+	}
+
+}
diff --git a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.template2structure/src/org/eclipse/papyrus/model2doc/gmf/template2structure/internal/mapping/GMFDiagramImageUtils.java b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.template2structure/src/org/eclipse/papyrus/model2doc/gmf/template2structure/internal/mapping/GMFDiagramImageUtils.java
index 2b7b55c..57ffe49 100755
--- a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.template2structure/src/org/eclipse/papyrus/model2doc/gmf/template2structure/internal/mapping/GMFDiagramImageUtils.java
+++ b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.template2structure/src/org/eclipse/papyrus/model2doc/gmf/template2structure/internal/mapping/GMFDiagramImageUtils.java
@@ -44,9 +44,10 @@
 	 *
 	 * @param diagram
 	 * @param pathRoot
+	 * @param margin
 	 * @return
 	 */
-	public static void generateImageOfDiagram(final Diagram diagram, final String pathRoot) {
+	public static void generateImageOfDiagram(final Diagram diagram, final String pathRoot, final int margin) {
 		// to be sure, but currently, we only propose svg, so, it should be ok.
 		Assert.isTrue(pathRoot.endsWith(SVG_EXTENSION));
 
@@ -61,7 +62,7 @@
 			}
 		}
 
-		final CopyToImageUtil copyImageUtil = new CopyToImageUtil();
+		final CopyToImageUtil copyImageUtil = new CustomCopyToImageUtils(margin);
 
 		try {
 			copyImageUtil.copyToImage(diagram, imagePath, ImageFileFormat.SVG, new NullProgressMonitor(),
diff --git a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.template2structure/src/org/eclipse/papyrus/model2doc/gmf/template2structure/internal/mapping/GMFDiagramViewMapper.java b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.template2structure/src/org/eclipse/papyrus/model2doc/gmf/template2structure/internal/mapping/GMFDiagramViewMapper.java
index 8d27abd..f1a8ca1 100755
--- a/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.template2structure/src/org/eclipse/papyrus/model2doc/gmf/template2structure/internal/mapping/GMFDiagramViewMapper.java
+++ b/plugins/gmf/org.eclipse.papyrus.model2doc.gmf.template2structure/src/org/eclipse/papyrus/model2doc/gmf/template2structure/internal/mapping/GMFDiagramViewMapper.java
@@ -98,7 +98,7 @@
 
 			String imagePath = GeneratorConfigurationOperations.getImageFileLocalPath(conf, imageNameBuilder.toString(), GMFDiagramImageUtils.SVG_EXTENSION);
 			imagePath = imagePath.replaceAll("file:/", ""); //$NON-NLS-1$ //$NON-NLS-2$
-			GMFDiagramImageUtils.generateImageOfDiagram(current, imagePath);
+			GMFDiagramImageUtils.generateImageOfDiagram(current, imagePath, gmfDiagramView.getDiagramImageMargin());
 			image.setImagePath(imagePath);
 			if (null == title) {
 				returnedValue.add(returnedClassType.cast(image));
diff --git a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.edit/META-INF/MANIFEST.MF b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.edit/META-INF/MANIFEST.MF
index b9fc254..aca5b47 100755
--- a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.edit/META-INF/MANIFEST.MF
+++ b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.edit/META-INF/MANIFEST.MF
@@ -31,5 +31,6 @@
  org.eclipse.papyrus.infra.emf.expressions;bundle-version="[1.1.0,2.0.0)",
  org.eclipse.papyrus.infra.emf.expressions.edit;bundle-version="[1.1.0,2.0.0)",
  org.eclipse.papyrus.model2doc.core.author.edit;bundle-version="[0.7.0,1.0.0)",
- org.eclipse.papyrus.model2doc.core.builtintypes;bundle-version="[0.7.0,1.0.0)"
+ org.eclipse.papyrus.model2doc.core.builtintypes;bundle-version="[0.7.0,1.0.0)",
+ org.eclipse.papyrus.model2doc.core.builtintypes.edit;bundle-version="[0.7.0,1.0.0)"
 Bundle-ActivationPolicy: lazy
diff --git a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.edit/plugin.properties b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.edit/plugin.properties
index 59ec1f9..c8f17a4 100755
--- a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.edit/plugin.properties
+++ b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.edit/plugin.properties
@@ -30,3 +30,4 @@
 _UI_ContextFilterBehavior_SEMANTIC_CONTEXT_literal = SEMANTIC_CONTEXT
 _UI_ContextFilterBehavior_GRAPHICAL_CONTEXT_literal = GRAPHICAL_CONTEXT
 _UI_ContextFilterBehavior_BOTH_literal = BOTH
+_UI_PapyrusGMFDiagramView_diagramImageMargin_feature = Diagram Image Margin
diff --git a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.edit/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/provider/PapyrusGMFDiagramViewItemProvider.java b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.edit/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/provider/PapyrusGMFDiagramViewItemProvider.java
index c25bd02..d284e51 100755
--- a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.edit/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/provider/PapyrusGMFDiagramViewItemProvider.java
+++ b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.edit/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/provider/PapyrusGMFDiagramViewItemProvider.java
@@ -86,6 +86,7 @@
 			addDiagramKindIdPropertyDescriptor(object);
 			addDiagramTypePropertyDescriptor(object);
 			addContextFilterRulePropertyDescriptor(object);
+			addDiagramImageMarginPropertyDescriptor(object);
 		}
 		return itemPropertyDescriptors;
 	}
@@ -219,6 +220,27 @@
 	}
 
 	/**
+	 * This adds a property descriptor for the Diagram Image Margin feature.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @generated
+	 */
+	protected void addDiagramImageMarginPropertyDescriptor(Object object) {
+		itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
+				getResourceLocator(),
+				getString("_UI_PapyrusGMFDiagramView_diagramImageMargin_feature"), //$NON-NLS-1$
+				getString("_UI_PropertyDescriptor_description", "_UI_PapyrusGMFDiagramView_diagramImageMargin_feature", "_UI_PapyrusGMFDiagramView_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				PapyrusGMFDocumentStructureTemplatePackage.Literals.PAPYRUS_GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN,
+				true,
+				false,
+				false,
+				ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
+				null,
+				null));
+	}
+
+	/**
 	 * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
 	 * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
 	 * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
@@ -307,6 +329,7 @@
 		case PapyrusGMFDocumentStructureTemplatePackage.PAPYRUS_GMF_DIAGRAM_VIEW__DIAGRAM_KIND_ID:
 		case PapyrusGMFDocumentStructureTemplatePackage.PAPYRUS_GMF_DIAGRAM_VIEW__DIAGRAM_TYPE:
 		case PapyrusGMFDocumentStructureTemplatePackage.PAPYRUS_GMF_DIAGRAM_VIEW__CONTEXT_FILTER_RULE:
+		case PapyrusGMFDocumentStructureTemplatePackage.PAPYRUS_GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN:
 			fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
 			return;
 		case PapyrusGMFDocumentStructureTemplatePackage.PAPYRUS_GMF_DIAGRAM_VIEW__GENERATE_BRANCH_CONDITION:
diff --git a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.edit/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/provider/PapyrusGMFDocumentStructureTemplateEditPlugin.java b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.edit/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/provider/PapyrusGMFDocumentStructureTemplateEditPlugin.java
index 33a680a..3816931 100755
--- a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.edit/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/provider/PapyrusGMFDocumentStructureTemplateEditPlugin.java
+++ b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.edit/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/provider/PapyrusGMFDocumentStructureTemplateEditPlugin.java
@@ -21,6 +21,7 @@
 
 import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsEditPlugin;
 import org.eclipse.papyrus.model2doc.core.author.provider.AuthorEditPlugin;
+import org.eclipse.papyrus.model2doc.core.builtintypes.provider.BuiltInTypesEditPlugin;
 import org.eclipse.papyrus.model2doc.core.generatorconfiguration.provider.GeneratorconfigurationEditPlugin;
 
 import org.eclipse.papyrus.model2doc.emf.documentstructuretemplate.provider.DocumentStructureTemplateEditPlugin;
@@ -67,6 +68,7 @@
 				GeneratorconfigurationEditPlugin.INSTANCE,
 				AuthorEditPlugin.INSTANCE,
 				ExpressionsEditPlugin.INSTANCE,
+				BuiltInTypesEditPlugin.INSTANCE,
 		});
 	}
 
diff --git a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/META-INF/MANIFEST.MF b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/META-INF/MANIFEST.MF
index c6da98d..07bae3f 100755
--- a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/META-INF/MANIFEST.MF
+++ b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/META-INF/MANIFEST.MF
@@ -16,7 +16,8 @@
  org.eclipse.emf.ecore;bundle-version="[2.17.0,3.0.0)",
  org.eclipse.papyrus.infra.gmfdiag.style;bundle-version="[2.0.0,3.0.0)",
  org.eclipse.papyrus.infra.emf.expressions;bundle-version="[1.1.0,2.0.0)",
- org.eclipse.papyrus.model2doc.core.author;bundle-version="[0.7.0,1.0.0)"
+ org.eclipse.papyrus.model2doc.core.author;bundle-version="[0.7.0,1.0.0)",
+ org.eclipse.papyrus.model2doc.core.builtintypes;bundle-version="[0.7.0,1.0.0)"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Export-Package: org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate,
  org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.impl,
diff --git a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/model/papyrusgmfdocumentstructuretemplate.ecore b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/model/papyrusgmfdocumentstructuretemplate.ecore
index af41b17..c81a26a 100755
--- a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/model/papyrusgmfdocumentstructuretemplate.ecore
+++ b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/model/papyrusgmfdocumentstructuretemplate.ecore
@@ -45,6 +45,13 @@
         <details key="documentation" value="This property allows to define how to use the parameter of the method getMatchingDiagram."/>
       </eAnnotations>
     </eStructuralFeatures>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="diagramImageMargin" ordered="false"
+        lowerBound="1" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
+        defaultValueLiteral="10">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="This field allows to define the size of the margin around the diagram snapshot. The value is interpreted as Pixel. The default value is 10."/>
+      </eAnnotations>
+    </eStructuralFeatures>
   </eClassifiers>
   <eClassifiers xsi:type="ecore:EEnum" name="ContextFilterBehavior">
     <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
diff --git a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/model/papyrusgmfdocumentstructuretemplate.genmodel b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/model/papyrusgmfdocumentstructuretemplate.genmodel
index 40f8824..3790175 100755
--- a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/model/papyrusgmfdocumentstructuretemplate.genmodel
+++ b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/model/papyrusgmfdocumentstructuretemplate.genmodel
@@ -11,7 +11,7 @@
     nonNLSMarkers="true" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
     codeFormatting="true" commentFormatting="true" testsDirectory="/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.tests/src-gen"
     importerID="org.eclipse.uml2.uml.ecore.importer" complianceLevel="8.0" copyrightFields="false"
-    usedGenPackages="../../org.eclipse.papyrus.model2doc.emf.documentstructuretemplate/model/documentstructuretemplate.genmodel#//documentstructuretemplate ../../org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore ../../org.eclipse.papyrus.model2doc.core.generatorconfiguration/model/generatorconfiguration.genmodel#//generatorconfiguration ../../org.eclipse.papyrus.model2doc.core.author/model/author.genmodel#//author ../../org.eclipse.papyrus.infra.emf.expressions/model/expressions.genmodel#//expressions"
+    usedGenPackages="../../org.eclipse.papyrus.model2doc.emf.documentstructuretemplate/model/documentstructuretemplate.genmodel#//documentstructuretemplate ../../org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore ../../org.eclipse.papyrus.model2doc.core.generatorconfiguration/model/generatorconfiguration.genmodel#//generatorconfiguration ../../org.eclipse.papyrus.model2doc.core.author/model/author.genmodel#//author ../../org.eclipse.papyrus.infra.emf.expressions/model/expressions.genmodel#//expressions ../../org.eclipse.papyrus.model2doc.core.builtintypes/model/BuiltInTypes.genmodel#//builtintypes"
     operationReflection="true" importOrganizing="true" cleanup="true" oSGiCompatible="true"
     pluralizedGetters="true">
   <genAnnotations source="http://www.eclipse.org/emf/2002/GenModel/importer/org.eclipse.uml2.uml.ecore.importer">
@@ -53,6 +53,7 @@
       <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute papyrusgmfdocumentstructuretemplate.ecore#//PapyrusGMFDiagramView/diagramKindId"/>
       <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute papyrusgmfdocumentstructuretemplate.ecore#//PapyrusGMFDiagramView/diagramType"/>
       <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute papyrusgmfdocumentstructuretemplate.ecore#//PapyrusGMFDiagramView/contextFilterRule"/>
+      <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute papyrusgmfdocumentstructuretemplate.ecore#//PapyrusGMFDiagramView/diagramImageMargin"/>
       <genOperations xsi:type="genmodel:GenOperation" ecoreOperation="papyrusgmfdocumentstructuretemplate.ecore#//PapyrusGMFDiagramView/getMatchingDiagrams">
         <genParameters xsi:type="genmodel:GenParameter" ecoreParameter="papyrusgmfdocumentstructuretemplate.ecore#//PapyrusGMFDiagramView/getMatchingDiagrams/expectedDiagramContext"/>
       </genOperations>
diff --git a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/model/papyrusgmfdocumentstructuretemplate.notation b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/model/papyrusgmfdocumentstructuretemplate.notation
index 95de1bc..34bc1df 100755
--- a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/model/papyrusgmfdocumentstructuretemplate.notation
+++ b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/model/papyrusgmfdocumentstructuretemplate.notation
@@ -18,6 +18,10 @@
         <element xmi:type="uml:Property" href="papyrusgmfdocumentstructuretemplate.uml#_OS1sUGXNEemOJZbgd4DmNg"/>
         <layoutConstraint xmi:type="notation:Location" xmi:id="_OTtPAWXNEemOJZbgd4DmNg"/>
       </children>
+      <children xmi:type="notation:Shape" xmi:id="_788Q4F7DEeq_NYEfEw1Skw" type="Property_ClassAttributeLabel">
+        <element xmi:type="uml:Property" href="papyrusgmfdocumentstructuretemplate.uml#_78Ul0F7DEeq_NYEfEw1Skw"/>
+        <layoutConstraint xmi:type="notation:Location" xmi:id="_788Q4V7DEeq_NYEfEw1Skw"/>
+      </children>
       <styles xmi:type="notation:TitleStyle" xmi:id="_Qbn54V0eEemxcMQajU1fyA"/>
       <styles xmi:type="notation:SortingStyle" xmi:id="_Qbn54l0eEemxcMQajU1fyA"/>
       <styles xmi:type="notation:FilteringStyle" xmi:id="_Qbn5410eEemxcMQajU1fyA"/>
@@ -44,7 +48,7 @@
       <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Qbn57l0eEemxcMQajU1fyA"/>
     </children>
     <element xmi:type="uml:Class" href="papyrusgmfdocumentstructuretemplate.uml#_QbIxsF0eEemxcMQajU1fyA"/>
-    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_QbbFkF0eEemxcMQajU1fyA" x="100" y="400" width="601" height="161"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_QbbFkF0eEemxcMQajU1fyA" x="100" y="400" width="601" height="261"/>
   </children>
   <children xmi:type="notation:Shape" xmi:id="_IyIzEF9aEemxcMQajU1fyA" type="Interface_Shape">
     <children xmi:type="notation:DecorationNode" xmi:id="_IyJaIF9aEemxcMQajU1fyA" type="Interface_NameLabel"/>
@@ -150,13 +154,13 @@
     <element xmi:type="uml:Enumeration" href="papyrusgmfdocumentstructuretemplate.uml#_zDXDQGXMEemOJZbgd4DmNg"/>
     <layoutConstraint xmi:type="notation:Bounds" xmi:id="_zDzIIWXMEemOJZbgd4DmNg" x="760" y="400" width="261" height="161"/>
   </children>
-  <children xmi:type="notation:Shape" xmi:id="_QRE_YIXyEemhaembVcoeKQ" type="StereotypeComment">
-    <styles xmi:type="notation:TitleStyle" xmi:id="_QRE_YYXyEemhaembVcoeKQ"/>
-    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_QRE_Y4XyEemhaembVcoeKQ" name="BASE_ELEMENT">
+  <children xmi:type="notation:Shape" xmi:id="_5S8Iw17DEeq_NYEfEw1Skw" type="StereotypeComment">
+    <styles xmi:type="notation:TitleStyle" xmi:id="_5S8IxF7DEeq_NYEfEw1Skw"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_5S8v0F7DEeq_NYEfEw1Skw" name="BASE_ELEMENT">
       <eObjectValue xmi:type="uml:Interface" href="papyrusgmfdocumentstructuretemplate.uml#_ck2IkF9aEemxcMQajU1fyA"/>
     </styles>
     <element xsi:nil="true"/>
-    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_QRE_YoXyEemhaembVcoeKQ" x="960" y="260"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_5S8IxV7DEeq_NYEfEw1Skw" x="960" y="260"/>
   </children>
   <styles xmi:type="notation:StringValueStyle" xmi:id="_WLlO8VxxEemyeb6zzD570Q" name="diagram_compatibility_version" stringValue="1.4.0"/>
   <styles xmi:type="notation:DiagramStyle" xmi:id="_WLlO8lxxEemyeb6zzD570Q"/>
@@ -194,14 +198,14 @@
     <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_O4u94F9aEemxcMQajU1fyA" id="(0.49916805324459235,0.0)"/>
     <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_O4u94V9aEemxcMQajU1fyA" id="(0.4975124378109453,1.0)"/>
   </edges>
-  <edges xmi:type="notation:Connector" xmi:id="_QRFmcIXyEemhaembVcoeKQ" type="StereotypeCommentLink" source="_ck4k0F9aEemxcMQajU1fyA" target="_QRE_YIXyEemhaembVcoeKQ">
-    <styles xmi:type="notation:FontStyle" xmi:id="_QRFmcYXyEemhaembVcoeKQ"/>
-    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_QRGNgIXyEemhaembVcoeKQ" name="BASE_ELEMENT">
+  <edges xmi:type="notation:Connector" xmi:id="_5S8v0V7DEeq_NYEfEw1Skw" type="StereotypeCommentLink" source="_ck4k0F9aEemxcMQajU1fyA" target="_5S8Iw17DEeq_NYEfEw1Skw">
+    <styles xmi:type="notation:FontStyle" xmi:id="_5S8v0l7DEeq_NYEfEw1Skw"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_5S8v1l7DEeq_NYEfEw1Skw" name="BASE_ELEMENT">
       <eObjectValue xmi:type="uml:Interface" href="papyrusgmfdocumentstructuretemplate.uml#_ck2IkF9aEemxcMQajU1fyA"/>
     </styles>
     <element xsi:nil="true"/>
-    <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_QRFmcoXyEemhaembVcoeKQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
-    <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_QRFmc4XyEemhaembVcoeKQ"/>
-    <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_QRFmdIXyEemhaembVcoeKQ"/>
+    <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_5S8v017DEeq_NYEfEw1Skw" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+    <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_5S8v1F7DEeq_NYEfEw1Skw"/>
+    <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_5S8v1V7DEeq_NYEfEw1Skw"/>
   </edges>
 </notation:Diagram>
diff --git a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/model/papyrusgmfdocumentstructuretemplate.uml b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/model/papyrusgmfdocumentstructuretemplate.uml
index 7ceb37c..246e76f 100755
--- a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/model/papyrusgmfdocumentstructuretemplate.uml
+++ b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/model/papyrusgmfdocumentstructuretemplate.uml
@@ -37,6 +37,17 @@
           <body>This property allows to define how to use the parameter of the method getMatchingDiagram.</body>
         </ownedComment>
       </ownedAttribute>
+      <ownedAttribute xmi:type="uml:Property" xmi:id="_78Ul0F7DEeq_NYEfEw1Skw" name="diagramImageMargin">
+        <ownedComment xmi:type="uml:Comment" xmi:id="_G3oc0F7EEeq_NYEfEw1Skw" annotatedElement="_78Ul0F7DEeq_NYEfEw1Skw">
+          <body>This field allows to define the size of the margin around the diagram snapshot. The value is interpreted as Pixel. The default value is 10.</body>
+        </ownedComment>
+        <type xmi:type="uml:PrimitiveType" href="pathmap://ECORE_METAMODEL_LIBRARY/Ecore.uml#_SeWkZcX_EduPJbEsMYXjUQ"/>
+        <defaultValue xmi:type="uml:LiteralInteger" xmi:id="_CuL7MF7EEeq_NYEfEw1Skw" name="DEFAULT_VALUE" value="10">
+          <ownedComment xmi:type="uml:Comment" xmi:id="_MWXWYF7EEeq_NYEfEw1Skw" annotatedElement="_CuL7MF7EEeq_NYEfEw1Skw">
+            <body>Default value for the margin (10 pixels), to get the initial GMF behavior, we use the same value than declared in org.eclipse.gmf.runtime.diagram.ui.render.clipboard.DiagramGenerator.DEFAULT_IMAGE_MARGIN_PIXELS.</body>
+          </ownedComment>
+        </defaultValue>
+      </ownedAttribute>
       <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_OV4vgF9aEemxcMQajU1fyA" client="_QbIxsF0eEemxcMQajU1fyA">
         <supplier xmi:type="uml:Interface" href="pathmap://DOCUMENT_STRUCTURE_TEMPLATE/documentstructuretemplate.uml#_DwGdIFYFEemKJasCEBKPhQ"/>
         <contract xmi:type="uml:Interface" href="pathmap://DOCUMENT_STRUCTURE_TEMPLATE/documentstructuretemplate.uml#_DwGdIFYFEemKJasCEBKPhQ"/>
diff --git a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/PapyrusGMFDiagramView.java b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/PapyrusGMFDiagramView.java
index 54759bd..8f4491b 100755
--- a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/PapyrusGMFDiagramView.java
+++ b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/PapyrusGMFDiagramView.java
@@ -39,6 +39,7 @@
  * <li>{@link org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.PapyrusGMFDiagramView#getDiagramKindId <em>Diagram Kind Id</em>}</li>
  * <li>{@link org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.PapyrusGMFDiagramView#getDiagramType <em>Diagram Type</em>}</li>
  * <li>{@link org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.PapyrusGMFDiagramView#getContextFilterRule <em>Context Filter Rule</em>}</li>
+ * <li>{@link org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.PapyrusGMFDiagramView#getDiagramImageMargin <em>Diagram Image Margin</em>}</li>
  * </ul>
  *
  * @see org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.PapyrusGMFDocumentStructureTemplatePackage#getPapyrusGMFDiagramView()
@@ -134,6 +135,35 @@
 	void setContextFilterRule(ContextFilterBehavior value);
 
 	/**
+	 * Returns the value of the '<em><b>Diagram Image Margin</b></em>' attribute.
+	 * The default value is <code>"10"</code>.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * <!-- begin-model-doc -->
+	 * This field allows to define the size of the margin around the diagram snapshot. The value is interpreted as Pixel. The default value is 10.
+	 * <!-- end-model-doc -->
+	 *
+	 * @return the value of the '<em>Diagram Image Margin</em>' attribute.
+	 * @see #setDiagramImageMargin(int)
+	 * @see org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.PapyrusGMFDocumentStructureTemplatePackage#getPapyrusGMFDiagramView_DiagramImageMargin()
+	 * @model default="10" required="true" ordered="false"
+	 * @generated
+	 */
+	int getDiagramImageMargin();
+
+	/**
+	 * Sets the value of the '{@link org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.PapyrusGMFDiagramView#getDiagramImageMargin <em>Diagram Image Margin</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @param value
+	 *                  the new value of the '<em>Diagram Image Margin</em>' attribute.
+	 * @see #getDiagramImageMargin()
+	 * @generated
+	 */
+	void setDiagramImageMargin(int value);
+
+	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * <!-- begin-model-doc -->
diff --git a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/PapyrusGMFDocumentStructureTemplatePackage.java b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/PapyrusGMFDocumentStructureTemplatePackage.java
index 2d8186b..6d9aadf 100755
--- a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/PapyrusGMFDocumentStructureTemplatePackage.java
+++ b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/PapyrusGMFDocumentStructureTemplatePackage.java
@@ -158,6 +158,16 @@
 	int PAPYRUS_GMF_DIAGRAM_VIEW__CONTEXT_FILTER_RULE = DocumentStructureTemplatePackage.ITEMPLATE_PART_VIEW_FEATURE_COUNT + 6;
 
 	/**
+	 * The feature id for the '<em><b>Diagram Image Margin</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @generated
+	 * @ordered
+	 */
+	int PAPYRUS_GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN = DocumentStructureTemplatePackage.ITEMPLATE_PART_VIEW_FEATURE_COUNT + 7;
+
+	/**
 	 * The number of structural features of the '<em>Papyrus GMF Diagram View</em>' class.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -165,7 +175,7 @@
 	 * @generated
 	 * @ordered
 	 */
-	int PAPYRUS_GMF_DIAGRAM_VIEW_FEATURE_COUNT = DocumentStructureTemplatePackage.ITEMPLATE_PART_VIEW_FEATURE_COUNT + 7;
+	int PAPYRUS_GMF_DIAGRAM_VIEW_FEATURE_COUNT = DocumentStructureTemplatePackage.ITEMPLATE_PART_VIEW_FEATURE_COUNT + 8;
 
 	/**
 	 * The operation id for the '<em>Build Part Template Title</em>' operation.
@@ -298,6 +308,18 @@
 	EAttribute getPapyrusGMFDiagramView_ContextFilterRule();
 
 	/**
+	 * Returns the meta object for the attribute '{@link org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.PapyrusGMFDiagramView#getDiagramImageMargin <em>Diagram Image Margin</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @return the meta object for the attribute '<em>Diagram Image Margin</em>'.
+	 * @see org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.PapyrusGMFDiagramView#getDiagramImageMargin()
+	 * @see #getPapyrusGMFDiagramView()
+	 * @generated
+	 */
+	EAttribute getPapyrusGMFDiagramView_DiagramImageMargin();
+
+	/**
 	 * Returns the meta object for the '{@link org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.PapyrusGMFDiagramView#getMatchingDiagrams(org.eclipse.emf.ecore.EObject) <em>Get Matching Diagrams</em>}' operation.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -395,6 +417,15 @@
 		EAttribute PAPYRUS_GMF_DIAGRAM_VIEW__CONTEXT_FILTER_RULE = eINSTANCE.getPapyrusGMFDiagramView_ContextFilterRule();
 
 		/**
+		 * The meta object literal for the '<em><b>Diagram Image Margin</b></em>' attribute feature.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 *
+		 * @generated
+		 */
+		EAttribute PAPYRUS_GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN = eINSTANCE.getPapyrusGMFDiagramView_DiagramImageMargin();
+
+		/**
 		 * The meta object literal for the '<em><b>Get Matching Diagrams</b></em>' operation.
 		 * <!-- begin-user-doc -->
 		 * <!-- end-user-doc -->
diff --git a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/impl/PapyrusGMFDiagramViewImpl.java b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/impl/PapyrusGMFDiagramViewImpl.java
index 061212e..897b5fa 100755
--- a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/impl/PapyrusGMFDiagramViewImpl.java
+++ b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/impl/PapyrusGMFDiagramViewImpl.java
@@ -54,6 +54,7 @@
  * <li>{@link org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.impl.PapyrusGMFDiagramViewImpl#getDiagramKindId <em>Diagram Kind Id</em>}</li>
  * <li>{@link org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.impl.PapyrusGMFDiagramViewImpl#getDiagramType <em>Diagram Type</em>}</li>
  * <li>{@link org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.impl.PapyrusGMFDiagramViewImpl#getContextFilterRule <em>Context Filter Rule</em>}</li>
+ * <li>{@link org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.impl.PapyrusGMFDiagramViewImpl#getDiagramImageMargin <em>Diagram Image Margin</em>}</li>
  * </ul>
  *
  * @generated
@@ -203,6 +204,28 @@
 	protected ContextFilterBehavior contextFilterRule = CONTEXT_FILTER_RULE_EDEFAULT;
 
 	/**
+	 * The default value of the '{@link #getDiagramImageMargin() <em>Diagram Image Margin</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @see #getDiagramImageMargin()
+	 * @generated
+	 * @ordered
+	 */
+	protected static final int DIAGRAM_IMAGE_MARGIN_EDEFAULT = 10;
+
+	/**
+	 * The cached value of the '{@link #getDiagramImageMargin() <em>Diagram Image Margin</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @see #getDiagramImageMargin()
+	 * @generated
+	 * @ordered
+	 */
+	protected int diagramImageMargin = DIAGRAM_IMAGE_MARGIN_EDEFAULT;
+
+	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 *
@@ -442,6 +465,32 @@
 	 * @generated
 	 */
 	@Override
+	public int getDiagramImageMargin() {
+		return diagramImageMargin;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @generated
+	 */
+	@Override
+	public void setDiagramImageMargin(int newDiagramImageMargin) {
+		int oldDiagramImageMargin = diagramImageMargin;
+		diagramImageMargin = newDiagramImageMargin;
+		if (eNotificationRequired()) {
+			eNotify(new ENotificationImpl(this, Notification.SET, PapyrusGMFDocumentStructureTemplatePackage.PAPYRUS_GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN, oldDiagramImageMargin, diagramImageMargin));
+		}
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @generated
+	 */
+	@Override
 	public String buildPartTemplateTitle(final EObject context) {
 		return org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate.internal.operations.PapyrusGMFBodySectionPartTemplateTitleOperations.PAPYRUS_GMF_INSTANCE.buildPartTemplateTitle(this, context);
 	}
@@ -515,6 +564,8 @@
 			return getDiagramType();
 		case PapyrusGMFDocumentStructureTemplatePackage.PAPYRUS_GMF_DIAGRAM_VIEW__CONTEXT_FILTER_RULE:
 			return getContextFilterRule();
+		case PapyrusGMFDocumentStructureTemplatePackage.PAPYRUS_GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN:
+			return getDiagramImageMargin();
 		}
 		return super.eGet(featureID, resolve, coreType);
 	}
@@ -549,6 +600,9 @@
 		case PapyrusGMFDocumentStructureTemplatePackage.PAPYRUS_GMF_DIAGRAM_VIEW__CONTEXT_FILTER_RULE:
 			setContextFilterRule((ContextFilterBehavior) newValue);
 			return;
+		case PapyrusGMFDocumentStructureTemplatePackage.PAPYRUS_GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN:
+			setDiagramImageMargin((Integer) newValue);
+			return;
 		}
 		super.eSet(featureID, newValue);
 	}
@@ -583,6 +637,9 @@
 		case PapyrusGMFDocumentStructureTemplatePackage.PAPYRUS_GMF_DIAGRAM_VIEW__CONTEXT_FILTER_RULE:
 			setContextFilterRule(CONTEXT_FILTER_RULE_EDEFAULT);
 			return;
+		case PapyrusGMFDocumentStructureTemplatePackage.PAPYRUS_GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN:
+			setDiagramImageMargin(DIAGRAM_IMAGE_MARGIN_EDEFAULT);
+			return;
 		}
 		super.eUnset(featureID);
 	}
@@ -610,6 +667,8 @@
 			return DIAGRAM_TYPE_EDEFAULT == null ? diagramType != null : !DIAGRAM_TYPE_EDEFAULT.equals(diagramType);
 		case PapyrusGMFDocumentStructureTemplatePackage.PAPYRUS_GMF_DIAGRAM_VIEW__CONTEXT_FILTER_RULE:
 			return contextFilterRule != CONTEXT_FILTER_RULE_EDEFAULT;
+		case PapyrusGMFDocumentStructureTemplatePackage.PAPYRUS_GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN:
+			return diagramImageMargin != DIAGRAM_IMAGE_MARGIN_EDEFAULT;
 		}
 		return super.eIsSet(featureID);
 	}
@@ -765,6 +824,8 @@
 		result.append(diagramType);
 		result.append(", contextFilterRule: "); //$NON-NLS-1$
 		result.append(contextFilterRule);
+		result.append(", diagramImageMargin: "); //$NON-NLS-1$
+		result.append(diagramImageMargin);
 		result.append(')');
 		return result.toString();
 	}
diff --git a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/impl/PapyrusGMFDocumentStructureTemplatePackageImpl.java b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/impl/PapyrusGMFDocumentStructureTemplatePackageImpl.java
index ae7f811..d522fc7 100755
--- a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/impl/PapyrusGMFDocumentStructureTemplatePackageImpl.java
+++ b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.documentstructuretemplate/src-gen/org/eclipse/papyrus/model2doc/integration/gmf/documentstructuretemplate/impl/PapyrusGMFDocumentStructureTemplatePackageImpl.java
@@ -26,6 +26,7 @@
 
 import org.eclipse.papyrus.infra.emf.expressions.ExpressionsPackage;
 import org.eclipse.papyrus.model2doc.core.author.AuthorPackage;
+import org.eclipse.papyrus.model2doc.core.builtintypes.BuiltInTypesPackage;
 import org.eclipse.papyrus.model2doc.core.generatorconfiguration.GeneratorConfigurationPackage;
 
 import org.eclipse.papyrus.model2doc.emf.documentstructuretemplate.DocumentStructureTemplatePackage;
@@ -129,6 +130,7 @@
 		GeneratorConfigurationPackage.eINSTANCE.eClass();
 		AuthorPackage.eINSTANCE.eClass();
 		ExpressionsPackage.eINSTANCE.eClass();
+		BuiltInTypesPackage.eINSTANCE.eClass();
 
 		// Create package meta-data objects
 		thePapyrusGMFDocumentStructureTemplatePackage.createPackageContents();
@@ -195,6 +197,17 @@
 	 * @generated
 	 */
 	@Override
+	public EAttribute getPapyrusGMFDiagramView_DiagramImageMargin() {
+		return (EAttribute) papyrusGMFDiagramViewEClass.getEStructuralFeatures().get(3);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 *
+	 * @generated
+	 */
+	@Override
 	public EOperation getPapyrusGMFDiagramView__GetMatchingDiagrams__EObject() {
 		return papyrusGMFDiagramViewEClass.getEOperations().get(0);
 	}
@@ -259,6 +272,7 @@
 		createEAttribute(papyrusGMFDiagramViewEClass, PAPYRUS_GMF_DIAGRAM_VIEW__DIAGRAM_KIND_ID);
 		createEAttribute(papyrusGMFDiagramViewEClass, PAPYRUS_GMF_DIAGRAM_VIEW__DIAGRAM_TYPE);
 		createEAttribute(papyrusGMFDiagramViewEClass, PAPYRUS_GMF_DIAGRAM_VIEW__CONTEXT_FILTER_RULE);
+		createEAttribute(papyrusGMFDiagramViewEClass, PAPYRUS_GMF_DIAGRAM_VIEW__DIAGRAM_IMAGE_MARGIN);
 		createEOperation(papyrusGMFDiagramViewEClass, PAPYRUS_GMF_DIAGRAM_VIEW___GET_MATCHING_DIAGRAMS__EOBJECT);
 
 		diagramEClass = createEClass(DIAGRAM);
@@ -312,6 +326,8 @@
 		initEAttribute(getPapyrusGMFDiagramView_DiagramType(), theEcorePackage.getEString(), "diagramType", null, 0, 1, PapyrusGMFDiagramView.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); //$NON-NLS-1$
 		initEAttribute(getPapyrusGMFDiagramView_ContextFilterRule(), this.getContextFilterBehavior(), "contextFilterRule", null, 1, 1, PapyrusGMFDiagramView.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, //$NON-NLS-1$
 				!IS_ORDERED);
+		initEAttribute(getPapyrusGMFDiagramView_DiagramImageMargin(), theEcorePackage.getEInt(), "diagramImageMargin", "10", 1, 1, PapyrusGMFDiagramView.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, //$NON-NLS-1$ //$NON-NLS-2$
+				!IS_ORDERED);
 
 		EOperation op = initEOperation(getPapyrusGMFDiagramView__GetMatchingDiagrams__EObject(), this.getDiagram(), "getMatchingDiagrams", 0, -1, IS_UNIQUE, !IS_ORDERED); //$NON-NLS-1$
 		addEParameter(op, theEcorePackage.getEObject(), "expectedDiagramContext", 1, 1, IS_UNIQUE, !IS_ORDERED); //$NON-NLS-1$
diff --git a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.template2structure/src/org/eclipse/papyrus/model2doc/integration/gmf/template2structure/internal/mapping/CustomCopyToImageUtils.java b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.template2structure/src/org/eclipse/papyrus/model2doc/integration/gmf/template2structure/internal/mapping/CustomCopyToImageUtils.java
new file mode 100755
index 0000000..3c3fbd7
--- /dev/null
+++ b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.template2structure/src/org/eclipse/papyrus/model2doc/integration/gmf/template2structure/internal/mapping/CustomCopyToImageUtils.java
@@ -0,0 +1,83 @@
+/*****************************************************************************
+ * Copyright (c) 2020 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ *    Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.model2doc.integration.gmf.template2structure.internal.mapping;
+
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.image.ImageFileFormat;
+import org.eclipse.gmf.runtime.diagram.ui.render.clipboard.DiagramGenerator;
+import org.eclipse.gmf.runtime.diagram.ui.render.util.CopyToImageUtil;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil;
+
+/**
+ * TODO : move me into Papyrus
+ *
+ * Allows to create diagram image defining the margin around the diagram
+ */
+public class CustomCopyToImageUtils extends CopyToImageUtil {
+
+	/**
+	 * equivalent to the margin defined by org.eclipse.gmf.runtime.diagram.ui.render.clipboard.DiagramGenerator.DEFAULT_IMAGE_MARGIN_PIXELS
+	 */
+	private static final int DEFAULT_MARGIN = 10;
+
+	/**
+	 * The size of the margin
+	 */
+	private int margin = 0;
+
+	/**
+	 *
+	 * Constructor.
+	 *
+	 * @param margin
+	 *            the margin to use around the image, in pixel value
+	 */
+	public CustomCopyToImageUtils(int margin) {
+		super();
+		if (this.margin >= 0) {
+			this.margin = margin;
+		} else {
+			this.margin = DEFAULT_MARGIN;
+		}
+
+	}
+
+	/**
+	 *
+	 * Constructor.
+	 *
+	 */
+	public CustomCopyToImageUtils() {
+		this(DEFAULT_MARGIN);
+	}
+
+	/**
+	 * @see org.eclipse.gmf.runtime.diagram.ui.render.util.CopyToImageUtil#getDiagramGenerator(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart, org.eclipse.gmf.runtime.diagram.ui.image.ImageFileFormat)
+	 *
+	 * @param diagramEP
+	 * @param format
+	 * @return
+	 */
+	@Override
+	protected DiagramGenerator getDiagramGenerator(final DiagramEditPart diagramEP, final ImageFileFormat format) {
+		final DiagramGenerator generator = super.getDiagramGenerator(diagramEP, format);
+		final IMapMode mm = MapModeUtil.getMapMode(diagramEP.getFigure());
+		generator.setImageMargin(mm.DPtoLP(this.margin));
+		return generator;
+	}
+
+}
diff --git a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.template2structure/src/org/eclipse/papyrus/model2doc/integration/gmf/template2structure/internal/mapping/GMFDiagramImageUtils.java b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.template2structure/src/org/eclipse/papyrus/model2doc/integration/gmf/template2structure/internal/mapping/GMFDiagramImageUtils.java
index c6c75fd..6c6adc5 100755
--- a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.template2structure/src/org/eclipse/papyrus/model2doc/integration/gmf/template2structure/internal/mapping/GMFDiagramImageUtils.java
+++ b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.template2structure/src/org/eclipse/papyrus/model2doc/integration/gmf/template2structure/internal/mapping/GMFDiagramImageUtils.java
@@ -44,9 +44,10 @@
 	 *
 	 * @param diagram
 	 * @param pathRoot
+	 * @param margin
 	 * @return
 	 */
-	public static void generateImageOfDiagram(final Diagram diagram, final String pathRoot) {
+	public static void generateImageOfDiagram(final Diagram diagram, final String pathRoot, final int margin) {
 		// to be sure, but currently, we only propose svg, so, it should be ok.
 		Assert.isTrue(pathRoot.endsWith(SVG_EXTENSION));
 
@@ -61,14 +62,21 @@
 			}
 		}
 
-		final CopyToImageUtil copyImageUtil = new CopyToImageUtil();
+		final CopyToImageUtil copyImageUtil = new CustomCopyToImageUtils(margin);
+
 
 		try {
+			// Dimension d = new Dimension(1402, 757).scale(0.70);
+			// copyImageUtil.copyToConstrainedImage(diagram, imagePath, ImageFileFormat.SVG, d.width, d.height, new NullProgressMonitor(),
+			// PreferencesHint.USE_DEFAULTS, false);
 			copyImageUtil.copyToImage(diagram, imagePath, ImageFileFormat.SVG, new NullProgressMonitor(),
 					PreferencesHint.USE_DEFAULTS);
 		} catch (CoreException e) {
 			Activator.log.error(e);
 		}
-	}
+		if (true) {
+			return;
+		}
 
+	}
 }
diff --git a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.template2structure/src/org/eclipse/papyrus/model2doc/integration/gmf/template2structure/internal/mapping/PapyrusGMFDiagramViewMapper.java b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.template2structure/src/org/eclipse/papyrus/model2doc/integration/gmf/template2structure/internal/mapping/PapyrusGMFDiagramViewMapper.java
index 847d8fb..b187104 100755
--- a/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.template2structure/src/org/eclipse/papyrus/model2doc/integration/gmf/template2structure/internal/mapping/PapyrusGMFDiagramViewMapper.java
+++ b/plugins/integration/org.eclipse.papyrus.model2doc.integration.gmf.template2structure/src/org/eclipse/papyrus/model2doc/integration/gmf/template2structure/internal/mapping/PapyrusGMFDiagramViewMapper.java
@@ -107,7 +107,7 @@
 			}
 			String imagePath = GeneratorConfigurationOperations.getImageFileLocalPath(conf, imageNameBuilder.toString(), GMFDiagramImageUtils.SVG_EXTENSION);
 			imagePath = imagePath.replaceAll("file:/", ""); //$NON-NLS-1$ //$NON-NLS-2$
-			GMFDiagramImageUtils.generateImageOfDiagram(current, imagePath);
+			GMFDiagramImageUtils.generateImageOfDiagram(current, imagePath, gmfDiagramView.getDiagramImageMargin());
 			image.setImagePath(imagePath);
 			if (null == title) {
 				returnedValue.add(returnedClassType.cast(image));