Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. this._printService.GetWord(printInfo).subscribe((response:any) => {
  2. const filename = response.headers.get('Content-Disposition').split(/[;'=]/).pop();
  3. saveAs(response.body, decodeURIComponent(filename))
  4. });
  5.  
  6. GetWord(params: HttpParams): Observable<any> {
  7. return this.http.get<Blob>(
  8. `${this.apiUrl}/DemoWordGet`,
  9. {
  10. params,
  11. responseType: 'blob' as 'json',
  12. observe: 'response',
  13. });
  14. }
  15.  
  16. return this.http
  17. .get(`${this.apiUrl}/DemoWordGet`, {
  18. responseType: ResponseContentType.Blob
  19. })
  20. .map(res => {
  21. return {
  22. filename: 'filename.pdf',
  23. data: res.blob()
  24. };
  25. });
  26.  
  27. responseType: 'blob' as 'json'
  28.  
  29. responseType: "blob"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement