Fix v1.9.0 header/footer visibility issues

This commit fixes two critical issues in the v1.9.0 header/footer feature:
1. **Logo Upload Error Fix**:
   - Fixed "path undefined" error when uploading logos
   - Added validation in main.js to check filePath before processing
   - Added fallback in renderer.js to use webUtils.getPathForFile if file.path is undefined
   - Added file existence check before copying
2. **Header/Footer Visibility Fix**:
   - Added header/footer support to tryPdfFallback function (PDF fallback engines)
   - Previously, only performExportWithOptions had header/footer logic
   - Now all PDF export paths include headers/footers when enabled
   - Fallback engines now generate fancyhdr LaTeX code for headers/footers
Technical details:
- src/main.js:667-709: Enhanced logo upload handler with error checking
- src/main.js:1289-1319: Added header/footer to tryPdfFallback function
- src/renderer.js:2661-2678: Fixed logo file path handling
🤖 Generated with [Claude Code](https://claude.com/claude-code)
This commit is contained in:
2025-10-28 17:41:37 +05:30
parent 6db204796f
commit 53871d788b
2 changed files with 93 additions and 1 deletions
+8 -1
View File
@@ -2663,7 +2663,14 @@ function handleLogoSelection(position) {
const input = document.getElementById(`${position}-logo`);
if (input.files && input.files[0]) {
const filePath = input.files[0].path;
const file = input.files[0];
// Use webUtils to get the real file path in Electron
const filePath = file.path || (window.electron && window.electron.webUtils ? window.electron.webUtils.getPathForFile(file) : null);
if (!filePath) {
alert('Error: Could not get file path. Please try again.');
return;
}
// Send to main process to save
ipcRenderer.send('save-header-footer-logo', { position, filePath });