diff --git a/src/app/contentManagement/controllers/JnlpController.php b/src/app/contentManagement/controllers/JnlpController.php
index 046f319a1a88eab1401c1134e9d34e4c18387062..e89147ca78014ec200111743049c2abdad0305e0 100755
--- a/src/app/contentManagement/controllers/JnlpController.php
+++ b/src/app/contentManagement/controllers/JnlpController.php
@@ -260,7 +260,7 @@ class JnlpController
                     $response->write($xmlResponse);
                     return $response->withHeader('Content-Type', 'application/xml');
                 }
-                $docserver  = DocserverModel::getById(['id' => $attachment['docserver_id'], 'select' => ['path_template']]);
+                $docserver  = DocserverModel::getByDocserverId(['docserverId' => $attachment['docserver_id'], 'select' => ['path_template']]);
 
                 $pathToCopy = $docserver['path_template'] . str_replace('#', DIRECTORY_SEPARATOR, $attachment['path']) . $attachment['filename'];
                 $extension  = pathinfo($pathToCopy, PATHINFO_EXTENSION);
diff --git a/src/frontend/app/attachments/attachment-create/attachment-create.component.html b/src/frontend/app/attachments/attachment-create/attachment-create.component.html
index 96d7dc40d6bcec1156fefa2b57c40006f09cb87a..4d453ae921514e2c729e851a3a4db8b4f59308dc 100644
--- a/src/frontend/app/attachments/attachment-create/attachment-create.component.html
+++ b/src/frontend/app/attachments/attachment-create/attachment-create.component.html
@@ -82,7 +82,7 @@
                     </div>
                     <div class="documentContent">
                         <app-document-viewer #appDocumentViewer style="height:100%;width:100%;position: relative;"
-                            [editMode]="true" [mode]="'attachment'" (triggerEvent)="setEncodedFile(i)">
+                            [editMode]="true" [mode]="'attachment'" (triggerEvent)="setDatasViewer(i)">
                         </app-document-viewer>
                         <div class="fieldState stateDoc">
                             <i class="fas fa-asterisk" *ngIf="!attachment['encodedFile'].hasError('required')"></i>
diff --git a/src/frontend/app/attachments/attachment-create/attachment-create.component.ts b/src/frontend/app/attachments/attachment-create/attachment-create.component.ts
index 4bdd0a8d869b2acae3b3553d22100759cf73b884..0023fd65010884a9b179635c0f10bf09c215f5a3 100644
--- a/src/frontend/app/attachments/attachment-create/attachment-create.component.ts
+++ b/src/frontend/app/attachments/attachment-create/attachment-create.component.ts
@@ -161,8 +161,16 @@ export class AttachmentCreateComponent implements OnInit {
         return state;
     }
 
-    setEncodedFile(i: number) {
+    setDatasViewer(i: number) {
+        let datas: any = {};
+        Object.keys(this.attachments[i]).forEach(element => {
+            if (['title', 'validationDate'].indexOf(element) > -1) {
+                datas[element] = this.attachments[i][element].value;
+            }
+        });
+        console.log(datas);
         this.attachments[i].encodedFile.setValue(this.appDocumentViewer.toArray()[i].getFile().content);
+        this.appDocumentViewer.toArray()[i].setDatas(datas);
     }
 
     newPj() {
diff --git a/src/frontend/app/attachments/attachments-page/attachment-page.component.html b/src/frontend/app/attachments/attachments-page/attachment-page.component.html
index 785b1302252b5e6374c1b26b7bf2d3bdf3e1d0ef..85dfc79280f4577c5bfc116c94116ce3e4d5aa13 100644
--- a/src/frontend/app/attachments/attachments-page/attachment-page.component.html
+++ b/src/frontend/app/attachments/attachments-page/attachment-page.component.html
@@ -187,7 +187,7 @@
                         </ng-template>
                         <app-document-viewer #appAttachmentViewer style="height:100%;width:100%;" [editMode]="editMode"
                             [resId]="data.resId" [mode]="'attachment'" [attachType]="attachment['type'].value"
-                            [infoPanel]="snavLeft" (triggerEvent)="setEncodedFile()"
+                            [infoPanel]="snavLeft" (triggerEvent)="setDatasViewer()"
                             [title]="attachment.chrono.value + ' - ' + attachment.title.value">
                         </app-document-viewer>
                     </mat-tab>
diff --git a/src/frontend/app/attachments/attachments-page/attachment-page.component.ts b/src/frontend/app/attachments/attachments-page/attachment-page.component.ts
index 262d518818c3c72af41d85043877522cd707a136..6b4690c9881064396f9ff712acec8c633243d7b3 100644
--- a/src/frontend/app/attachments/attachments-page/attachment-page.component.ts
+++ b/src/frontend/app/attachments/attachments-page/attachment-page.component.ts
@@ -182,8 +182,15 @@ export class AttachmentPageComponent implements OnInit {
         return attachmentValues;
     }
 
-    setEncodedFile() {
-        this.attachment['encodedFile'].setValue(this.appAttachmentViewer.getFile().content);
+    setDatasViewer() {
+        let datas: any = {};
+        Object.keys(this.attachment).forEach(element => {
+            if (['title', 'validationDate', 'effectiveDate'].indexOf(element) > -1) {
+                datas[element] = this.attachment[element].value;
+            }
+        });
+        this.attachment.encodedFile.setValue(this.appAttachmentViewer.getFile().content);
+        this.appAttachmentViewer.setDatas(datas);
     }
 
     getAttachType(attachType: any) {
diff --git a/src/frontend/app/viewer/document-viewer.component.html b/src/frontend/app/viewer/document-viewer.component.html
index 32c6cec2853aa97ca97f027ea5dbb603ca7ebcf5..435b7a7769526e098d79fecb0e6308baa1f4dbb4 100644
--- a/src/frontend/app/viewer/document-viewer.component.html
+++ b/src/frontend/app/viewer/document-viewer.component.html
@@ -58,6 +58,9 @@
                 <button *ngIf="editMode" mat-icon-button (click)="cleanFile()" [matTooltip]="lang.removeFile">
                     <mat-icon class="fa fa-trash" color="warn"></mat-icon>
                 </button>
+                <button *ngIf="editMode && mode === 'attachment' && resId !== null" mat-icon-button (click)="editAttachment()" [matTooltip]="lang.editDocument">
+                    <mat-icon class="fa fa-edit"></mat-icon>
+                </button>
             </div>
             <pdf-viewer *ngIf="file.src!==null" [src]="file.src" [render-text]="true" [autoresize]="true"
                 [original-size]="false" [show-all]="true" (error)="onError($event)" style="width:100%;"></pdf-viewer>
diff --git a/src/frontend/app/viewer/document-viewer.component.ts b/src/frontend/app/viewer/document-viewer.component.ts
index c2d4c8dfe7b9085ab0c36ad97f318cce36c9f65c..4c8fc7c41e637a01e74fb603c18935efe6d7bb47 100644
--- a/src/frontend/app/viewer/document-viewer.component.ts
+++ b/src/frontend/app/viewer/document-viewer.component.ts
@@ -511,7 +511,7 @@ export class DocumentViewerComponent implements OnInit {
             }),
             filter((data: string) => data === 'ok'),
             tap(() => {
-                this.refreshDatas.emit();
+                this.triggerEvent.emit();
                 const template = this.listTemplates.filter(template => template.id === templateId)[0];
                 this.editInProgress = true;
                 const jnlp: any = {
@@ -523,7 +523,7 @@ export class DocumentViewerComponent implements OnInit {
                 this.http.post('../../rest/jnlp', jnlp).pipe(
                     tap((data: any) => {
                         window.location.href = '../../rest/jnlp/' + data.generatedJnlp;
-                        this.checkLockFile(data.jnlpUniqueId, template);
+                        this.checkLockFile(data.jnlpUniqueId, template.extension);
                     })
                 ).subscribe();
             }),
@@ -534,18 +534,35 @@ export class DocumentViewerComponent implements OnInit {
         ).subscribe();
     }
 
+    editAttachment() {
+        this.editInProgress = true;
+        const jnlp: any = {
+            objectType: 'attachmentModification',
+            objectId: this.resId,
+            cookie: document.cookie,
+            data: this.resourceDatas,
+        };
+
+        this.http.post('../../rest/jnlp', jnlp).pipe(
+            tap((data: any) => {
+                window.location.href = '../../rest/jnlp/' + data.generatedJnlp;
+                this.checkLockFile(data.jnlpUniqueId, 'odt');
+            })
+        ).subscribe();
+    }
+
     setDatas(resourceDatas: any) {
         this.resourceDatas = resourceDatas;
     }
 
-    checkLockFile(id: string, template: any) {
+    checkLockFile(id: string, extension: string) {
         this.intervalLockFile = setInterval(() => {
             this.http.get('../../rest/jnlp/lock/' + id)
                 .subscribe((data: any) => {
                     if (!data.lockFileFound) {
                         this.editInProgress = false;
                         clearInterval(this.intervalLockFile);
-                        this.loadTmpFile(`${data.fileTrunk}.${template.extension}`);
+                        this.loadTmpFile(`${data.fileTrunk}.${extension}`);
                     }
                 });
         }, 1000);
@@ -566,7 +583,7 @@ export class DocumentViewerComponent implements OnInit {
         this.listTemplates = [];
         this.http.get('../../rest/attachmentsTypes').pipe(
             tap((data: any) => {
-                
+
                 Object.keys(data.attachmentsTypes).forEach(templateType => {
                     arrTypes.push({
                         id: templateType,
diff --git a/src/frontend/lang/lang-en.ts b/src/frontend/lang/lang-en.ts
index 8686a9e3a61265e24bed3b4f73b13bcd2210c762..cde74c4917303b77d9ed63723ddc25fe93c4a639 100755
--- a/src/frontend/lang/lang-en.ts
+++ b/src/frontend/lang/lang-en.ts
@@ -1311,4 +1311,5 @@ export const LANG_EN = {
     "newAttachment": "New attachment",
     "delAttachment": "Delete this attachment",
     "mustCompleteAllAttachments": "Please, complete all attachments",
+    "editDocument": "Edit document",
 };
diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts
index 9a7a4fe5406902cce12854e1cd3c2063ed39eb5b..a27cc128e670058074d73511115c073444a58c59 100755
--- a/src/frontend/lang/lang-fr.ts
+++ b/src/frontend/lang/lang-fr.ts
@@ -1349,4 +1349,5 @@ export const LANG_FR = {
     "newAttachment": "Nouvelle pièce jointe",
     "delAttachment": "Enlever la pièce jointe",
     "mustCompleteAllAttachments": "Veuillez compléter l'ensemble des pièces jointes",
+    "editDocument": "Editer le document",
 };
diff --git a/src/frontend/lang/lang-nl.ts b/src/frontend/lang/lang-nl.ts
index 7fcde461cf78ea79ad6ac4b3f57384f1ec64c2ee..5326c8eb22a38071c9a361a4790c2f12a0b08c09 100755
--- a/src/frontend/lang/lang-nl.ts
+++ b/src/frontend/lang/lang-nl.ts
@@ -1336,4 +1336,5 @@ export const LANG_NL = {
     "newAttachment": "New attachment", //_TO_TRANSLATE
     "delAttachment": "Delete this attachment", //_TO_TRANSLATE
     "mustCompleteAllAttachments": "Please, complete all attachments", //_TO_TRANSLATE
+    "editDocument": "Edit document", //_TO_TRANSLATE
 };