QCAD - 2D CAD System.
Please search for existing tasks (also closed ones) before opening a new task.
Please make sure that you are using the latest Version of QCAD before posting a bug (menu Help - Check for Updates)
FS#1001 - PDF export fails silently
Opened by Tamas TEVESZ (kazmer) - Sunday, 29 December 2013, 18:25 GMT+1
Last edited by Andrew (andrew) - Monday, 30 December 2013, 22:56 GMT+1
I only have Git head operational now (am on FreeBSD ATM), but looking at the respective scripts in the downloadable Pro trial, it is affected too. Also, only FreeBSD at the moment to try, but the nature of the bug makes me say all systems are affected.
PDF export fails silently if a file name for which no parent directory exists or that parent directory is not writeable by the current user.
How to reproduce: XD, then in the Save As dialog, manually specify a nonexistent directory + a file name (eg. “/nonexistent/out.pdf” on POSIX, whatever on Windows) or, if you will, browse to a directory for which you have no write permission, specify any file name, then hit Save (case in point: it is not limited to the probably rare-ish cases when the end user browses to the destination directory as opposed to just quickly typing in the full file path).
Result is “Export complete” on the status line. It obviously didn’t complete.
The cause is insufficient checking of the return value of QPainter::begin() in scripts/File/Print/Print.js:
149 var painter = new QPainter(); 150 painter.begin(printer);
This will actually return false if the output format is PdfFormat and it can not create OutputFileName (cf. Print.js:70-71).
I am not sure how (if at all) it can fail if printing is done to an actual printer.
Setting to medium since in some sense it is silent data loss.