eligrey / eligrey/FileSaver.js

file-saver saveAs : Error while opening the pdf

Open
#662 4 comments 4 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
22k
Forks
4.3k
PR merge metrics
No merged PRs in 30d

Description

I am saving a pdf to my local machine, using saveAs from 'file-saver' library. Data is provided locally, it is not fetched from server.

Pdf is getting saved successfully, but while opening the pdf I am getting an error as **File type plain text document (text/plain) is not supported** though I am mentioning type as pdf.

Below is the code. I am developing the application using reactjs.

```
import { saveAs } from 'file-saver';

const blob = new Blob([ ], { type: 'application/pdf'
})

saveAs(blob, "trial.pdf" );
```
**Attatching screenshot of the error**

![error](https://user-images.githubusercontent.com/62637739/87250478-a1f1ea80-c482-11ea-87a3-f7aef61c0302.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.