diegomura / diegomura/react-pdf
Electron/React to PDF not Saving as PDF
- Dominant language
- TypeScript
- Stars
- 16.8k
- Forks
- 1.3k
- Avg merge
- 5h 6m
- Merged PRs (30d)
- 52
Description
**Describe the bug**
With Electron/React using PDFDownloadLink the Save As prompt wont allow to save as a PDF. You have to manually type .pdf
**To Reproduce**
Steps to reproduce the behavior including code snippet (if applies):
import React from 'react';
import { Page, Text, View, Document, StyleSheet, PDFDownloadLink, pdf } from '@react-pdf/renderer';
`// Create styles
const styles = StyleSheet.create({
page: {
flexDirection: 'row',
backgroundColor: '#E4E4E4',
color: '#000000'
},
section: {
margin: 0,
padding: 0,
flexGrow: 1
}
});
// Create Document Component
const PrintHeader = () => (
Section #1
Section #2
);
const PrintHeader2 = () => (
} fileName="Header.pdf">
{({ blob, url, loading, error }) => (loading ? 'Loading document...' : 'Download now!')}
)
export default PrintHeader2;`
When you click on the Download now! it will prompt a save as but will not allow to save as PDF unless you manually type .PDF
**Expected behavior**
The prompt should automatically default to .PDF
**Screenshots**

**Desktop (please complete the following information):**
- OS: Windows 10
- Browser Electron / Chrome
- React-pdf version 2.13.0
Contributor guide
Research direction
Start by reproducing the issue with the provided PDFDownloadLink example in Electron/Chrome on Windows 10, using react-pdf 2.13.0. Inspect how PDFDownloadLink supplies the download filename and verify that the Save As prompt defaults to a PDF file without requiring the user to type the extension.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, react, typescript
- Domain
- desktop, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100