2

I am using following code in my angular11 project to convert base64 string to pdf and open it in new tab, this works fine but when I click on save it dose not work, however if do some changes like highlight text or draw something using tools available in menu bar I am able to save the file.

getDocument(documentId){
    this.documentApiService.getDocument(documentId).pipe(takeUntil(this._destroyed$)).subscribe(o => {
      var pdfWindow = window.open('');
      pdfWindow.document.write('<iframe width=\'100%\' height=\'100%\' src=\'data:application/pdf;base64, ' +
        encodeURI(o.entity) + '\'></iframe>'
      );
    });
  }

Is there any attribute to enable save/download without editing the file? or is there any other way to do it?

SwapnilKumbhar
  • 347
  • 2
  • 5
  • 17

0 Answers0