cancel
Showing results for 
Search instead for 
Did you mean: 

adf-viewer-extension not working

michael-chan
Champ in-the-making
Champ in-the-making

I am trying the `adf-viewer-extension` but seems it's not reflecting.
Does anyone have idea?

My adf package version is 4.8.0.
(It works for other files like pdf, csv, png/jpg. I just want to explore if I can display word file.)

image

<adf-viewer
  id="dw-viewer-id"
  [(showViewer)]="showViewer"
  [displayName]="name"
  [blobFile]="content"
  (showViewerChange)="onViewerVisibilityChanged()"
>
  <adf-viewer-extension [supportedExtensions]="['doc', 'docx']" #extension>
    <ng-template let-urlFileContent="urlFileContent" let-extension="extension">
      <div>word</div>
    </ng-template>
  </adf-viewer-extension>

  <adf-viewer-more-actions *ngIf="enableDownload" id="dw-viewer-more-action-id">
    <button mat-menu-item (click)="downloadContent()">
      <mat-icon>file_download</mat-icon>
      <span>{{ 'ADF_VIEWER.ACTIONS.DOWNLOAD' | translate }}</span>
    </button>
  </adf-viewer-more-actions>
</adf-viewer>
2 REPLIES 2

KarekMedAM
Star Contributor
Star Contributor

It seems to me that your problem has nothing to do with ADF. Make sure your local transformation services are up and running correctly (especially libreoffice) 

mohib
Champ in-the-making
Champ in-the-making

This issue is coming while using blobFile in ADF viewer, you should try this... 

<adf-viewer
  id="dw-viewer-id"
  [(showViewer)]="showViewer"
  [displayName]="name"
  [blobFile]="content"
  (showViewerChange)="onViewerVisibilityChanged()"
#adfviewer .....

@ViewChild('adfviewer', { static: false }) 
adfviewer: ViewerComponent;

private changeDetectorRef: ChangeDetectorRef
....
if(this.content){ //blob content
this.changeDetectorRef.detectChanges();
this.adfviewer.viewerType = 'custom';
this.adfviewer.extensionTemplates[0].isVisible = true; // forcefully assign 1st template for blobFile value.
const url = URL.createObjectURL(this.content); // create blob url
this.adfviewer.urlFileContent = url;
}