I am using web viewer at angular application for document edit like doc , docx file and enableOfficeEditing: true and try to add custom button like maximize and save document buttom but its not showing. here below my code
Thank you, after enable enableOfficeEditing is true i am trying to add annotation feature as well but its not work(its working only when enableOfficeEditing is false )
instance.UI.enableElements([‘toolbarGroup-Annotate’]);
instance.UI.enableFeatures([instance.UI.Feature.Annotations]);
I have added toggle button to shift annotation mode to edit mode again loading the reintialize the webviewer. i am loading the document dynamically i am using keyup event. the problem is here its show the last loaded document content is there any way to remove or destroy the previous loaded webviewer docviewer so can get only current loaded document event not previous loaded document this is my below code
i am passing apryse data through input output decorator
<app-pdf-apryse
[filePath]=“filePath”
[fileName]=“selectedFile[0]?.name”
[documentAnnotation]=“documentAnnotation”
[isShowAnnotation]=“true”
[documentEditable]=“isEditable”
[vehicleId]=“data.vehicleId”
[reportId]=“data.reportId”
[showToggleBtn]=“showToggleBtn”
(savePdfEvent)=“onSavePdf($event)”> initial loading the webViewer at ngAfterViewInit
here i am trying to use keyup event its show previous file data also its not cleaning the previous webviewer
documentViewer.addEventListener(‘keyUp’, () => {
console.log(‘fileNam’, this.fileName)
const { documentViewer } = this.wvInstance!.Core;
if (this.documentEditable) {
console.log(‘keyUp’, this.fileName);
const docData = await documentViewer.getDocument().getFileData();
const blob = new Blob([docData], {
type: ‘application/vnd.openxmlformats-officedocument.wordprocessingml.document’,
});
const formData = new FormData();
formData.append(‘file’, blob, this.fileName);
formData.append(‘userId’, this.userId ? this.userId : ‘’);
}); note: is there any textChange event is there for edit docx file at apryse
thanks
sonu kumar
Thank you Kevin. it’s working fine. I am facing one issue here like i have uploaded the doc file and edited and saved to db again try to open this doc file in edited mode its not open(its show only loader). note: this problem only with doc file not docx file
below my code to save to db and getting back in url
const extension = this.fileName?.split(‘.’).pop();
const docData = await documentViewer.getDocument().getFileData();
const blob = new Blob([docData], {
type:
extension == ‘doc’
? ‘application/msword’
: ‘application/vnd.openxmlformats-officedocument.wordprocessingml.document’,
});
const formData = new FormData();
formData.append(‘file’, blob, this.fileName);