Bug 508559

Summary: Exporting pages to an existing filename modifies the pages in the existing PDF
Product: [Applications] Skanpage Reporter: Mohammed Khoory <the.9a3eedi>
Component: generalAssignee: Alexander Stippich <a.stippich>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 25.04.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 26.04.0
Sentry Crash Report:

Description Mohammed Khoory 2025-08-21 14:28:35 UTC
SUMMARY
When exporting scanned pages to a PDF, if the filename exists, then it appears that Skanpage modifies the existing PDF, rather than overwrite it completely and make a new one. It seems that if I scan one page and then export it to an existing PDF, then the first page of the existing PDF is modified with the page scanned by Skanpage and the rest of the pages are left intact. 

What Skanpage should be doing is completely overwrite the existing PDF, and probably also inform the user that the program will overwrite the file, rather than modify it

STEPS TO REPRODUCE
1. Put a PDF with multiple pages somewhere. This PDF is to be overwritten by Skanpage
2. Scan a page with skanpage
3. Export the document to the same filename as the existing PDF 

OBSERVED RESULT
The existing PDF will have its first page overwritten by the scanned document. The dimensions of the scanned document will be scaled to match the original PDF's dimensions

EXPECTED RESULT
A completely new PDF with the scanned document replaces the old file, and pages from the old file should not show up in the new PDF.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Manjaro Linux x86_64 with kernel 6.6.99-1-MANJARO running distro-built KDE Plasma
KDE Plasma Version: 6.3.6
KDE Frameworks Version:  6.16.0
Qt Version: 6.9.1

ADDITIONAL INFORMATION
Skanpage version 25.04.3-1 (installed from distro repositories)
Comment 1 Nate Graham 2025-12-23 18:44:56 UTC
Git commit 00756239fdfd118997b9801d24eb8b997e790f43 by Nate Graham, on behalf of Nicola Felice.
Committed on 23/12/2025 at 18:44.
Pushed by ngraham into branch 'master'.

Ask before overwriting in ExportDialog

If the user manually changes the filename in the TextField and clicks
"Save", the program will overwrite existing files without confirmation.

Solution: Remove the file path from the fields in the ExportDialog and
move the possibility to change the path in the FileDialog. This way the
check to avoid overwriting files is done in a single place.
Related: bug 490999
FIXED-IN: 26.04.0

M  +16   -32   src/qml/ExportDialog.qml

https://invent.kde.org/utilities/skanpage/-/commit/00756239fdfd118997b9801d24eb8b997e790f43