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, 17:25 GMT
Last edited by Andrew (andrew) - Tuesday, 15 April 2014, 19:11 GMT
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.
Tuesday, 15 April 2014, 19:11 GMT
Reason for closing: Fixed
Additional comments about closing: https://github.com/qcad/qcad/commit/b35c b7debf340cc686d6cc7c3f4e45f657c93c70