View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0017519 | Scribus | Printing | public | 2025-05-13 15:12 | 2025-05-15 21:03 |
Reporter | jirib | Assigned To | jghali | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 1.6.5.svn | ||||
Fixed in Version | 1.7.1.svn | ||||
Summary | 0017519: Print Dialog : 'Alternative Printer Command' should not be enabled when 'File' destination is selected | ||||
Description | There are flaws in Setup Print dialog, wrong handling of File and Alternative Printer Command | ||||
Steps To Reproduce | scenario I. ========= 1. ctrl-p to open 'Setup Printer' 2. select File destination (destination!) 3. see that 'File' output filename is defined, that is, non-empty (the file should not exist now!) 4. enable 'Alternative Printer Command' 5. see that 'File' output filename text box was grayed out (ineffective) 6. set 'Command' to /bin/true 7. Print button Result: /tmp/foo.pdf is present; /bin/true was never executed (observed via strace) scenario II. ========== 1. ctrl-p to open 'Setup Printer' 2. select File destination (destination!) 3. make 'File' output filename text box empty (no value) 4. enable 'Alternative Printer Command' 5. see that 'File' output filename text box was grayed out (ineffective) 6. set 'Command' to /bin/true 7. Print button Result: 'Printing failed!' | ||||
Additional Information | I tried to cook a diff, not sure if valid, sorry, not compiled and tested: ---%>--- diff --git a/scribus/plugins/scripter/api_printer.cpp b/scribus/plugins/scripter/api_printer.cpp index 1de480c6f..fb5d05f80 100644 --- a/scribus/plugins/scripter/api_printer.cpp +++ b/scribus/plugins/scripter/api_printer.cpp @@ -74,11 +74,9 @@ void PrinterAPI::doPrint() QString printcomm; bool fil, PSfile; PSfile = false; - // ReOrderText(ScCore->primaryMainWindow()->doc, ScCore->primaryMainWindow()->view); prn = printer; fna = file; - fil = (printer == QString("File")) ? true : false; std::vector<int> pageNs; PrintOptions options; for (int i = 0; i < pages.size(); ++i) { @@ -88,7 +86,6 @@ void PrinterAPI::doPrint() SepName = separation; options.printer = prn; options.prnEngine = (PrintEngine) pslevel; - options.toFile = fil; options.separationName = SepName; options.outputSeparations = (SepName == QString("No")) ? false : true; options.useColor = color; @@ -108,6 +105,8 @@ void PrinterAPI::doPrint() if (!PrinterUtil::checkPrintEngineSupport(options.printer, options.prnEngine, options.toFile)) options.prnEngine = PrinterUtil::getDefaultPrintEngine(options.printer, options.toFile); printcomm = cmd; + fil = (printer == QString("File")) && printcomm.trimmed().isEmpty(); + options.toFile = fil; QMap<QString, QMap<uint, FPointArray> > ReallyUsed; ReallyUsed.clear(); ScCore->primaryMainWindow()->doc->getUsedFonts(ReallyUsed); @@ -159,7 +158,7 @@ void PrinterAPI::doPrint() if (!fil) { - if (!printcomm.isEmpty()) + if (!printcomm.trimmed().isEmpty()) cmd = printcomm + " "+fna; else { ---%<--- | ||||
Tags | No tags attached. | ||||
Patch | No | ||||
|
printer-dialog.diff (1,588 bytes)
diff --git a/scribus/plugins/scripter/api_printer.cpp b/scribus/plugins/scripter/api_printer.cpp index 1de480c6f..fb5d05f80 100644 --- a/scribus/plugins/scripter/api_printer.cpp +++ b/scribus/plugins/scripter/api_printer.cpp @@ -74,11 +74,9 @@ void PrinterAPI::doPrint() QString printcomm; bool fil, PSfile; PSfile = false; - // ReOrderText(ScCore->primaryMainWindow()->doc, ScCore->primaryMainWindow()->view); prn = printer; fna = file; - fil = (printer == QString("File")) ? true : false; std::vector<int> pageNs; PrintOptions options; for (int i = 0; i < pages.size(); ++i) { @@ -88,7 +86,6 @@ void PrinterAPI::doPrint() SepName = separation; options.printer = prn; options.prnEngine = (PrintEngine) pslevel; - options.toFile = fil; options.separationName = SepName; options.outputSeparations = (SepName == QString("No")) ? false : true; options.useColor = color; @@ -108,6 +105,8 @@ void PrinterAPI::doPrint() if (!PrinterUtil::checkPrintEngineSupport(options.printer, options.prnEngine, options.toFile)) options.prnEngine = PrinterUtil::getDefaultPrintEngine(options.printer, options.toFile); printcomm = cmd; + fil = (printer == QString("File")) && printcomm.trimmed().isEmpty(); + options.toFile = fil; QMap<QString, QMap<uint, FPointArray> > ReallyUsed; ReallyUsed.clear(); ScCore->primaryMainWindow()->doc->getUsedFonts(ReallyUsed); @@ -159,7 +158,7 @@ void PrinterAPI::doPrint() if (!fil) { - if (!printcomm.isEmpty()) + if (!printcomm.trimmed().isEmpty()) cmd = printcomm + " "+fna; else { |
|
When the selected print destination is "File", the Alternative Print Command should be in fact disabled. Using an alternative print command has never been supported when printing to file. |
|
IIUC the Alternative Printer Command is logically independent on the destination mode: my testing revealed that the produces temporary PS file is passed to the command as argument: <command> /home/jiri/.local/share/scribus/temp//tmp.ps It has nothing to do with any printer or any defined File output filename; how <command> would process the argument external to Scribus. However, IIUC, the 'Alternative Printer Command' was introduced to provide additonal GUI dialog for the printers... I might see an usage for the 'Alternative Printer Command', a script modifying the postscript file, eg. `psnup' (to impose multiple logical pages on to each physical sheet of paper) etc... |
|
the diff did not solve it :/ |
|
IMO, if 'alternative printer command' is true, toFile should be false (gdb) p options $6 = (PrintOptions &) @0x5580340e6998: {firstUse = false, toFile = true, useAltPrintCommand = true, outputSeparations = false, useSpotColors = true, useColor = true, mirrorH = false, mirrorV = false, doGCR = false, doClip = false, setDevParam = false, useDocBleeds = false, cropMarks = true, bleedMarks = false, registrationMarks = false, colorMarks = false, includePDFMarks = true, copies = 1, prnLanguage = PrintLanguage::PDF, markLength = 20.001259842519687, markOffset = 0, bleeds = {m_top = 14.173228346456694, m_left = 14.173228346456694, m_bottom = 14.173228346456694, m_right = 14.173228346456694}, pageNumbers = std::vector of length 2, capacity 2 = {1, 2}, printerOptions = {d = 0x7fb4f25de6c0 <QArrayData::shared_null>}, printer = {d = 0x558031c528f0}, filename = { d = 0x55803444f300}, separationName = {d = 0x5580342470f0}, allSeparations = {<QList<QString>> = {<QListSpecialMethods<QString>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = { _q_value = std::atomic<int> = { -1 }}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x55803418f270}, d = 0x55803418f270}}, <No data fields>}, printerCommand = {d = 0x558034105010}, devMode = {d = 0x7fb4f25de6c0 <QArrayData::shared_null>}} i'm back with GDB :/ |
|
that above was related to: (gdb) frame #0 ScribusMainWindow::doPrint (this=0x558031b9ecb0, options=..., error=...) at /home/jiri/Documents/personal/src/svn-scribus-v16x/scribus/scribus.cpp:4360 4360 |
|
I can't reproduce with this diff: $ svn diff Index: scribus/ui/printdialog.cpp =================================================================== --- scribus/ui/printdialog.cpp (revision 26874) +++ scribus/ui/printdialog.cpp (working copy) @@ -501,6 +501,7 @@ { m_doc->Print_Options.printerCommand = altCommand->text(); m_doc->Print_Options.useAltPrintCommand = true; + m_doc->Print_Options.toFile = false; } else m_doc->Print_Options.useAltPrintCommand = false; @@ -543,6 +544,7 @@ { selectCommand(); altCommand->setText(m_doc->Print_Options.printerCommand); + m_doc->Print_Options.toFile = false; } printAllRadio->setChecked(prefs->getBool("PrintAll", true)); printCurrentRadio->setChecked(prefs->getBool("CurrentPage", false)); altcmd.diff (718 bytes)
Index: scribus/ui/printdialog.cpp =================================================================== --- scribus/ui/printdialog.cpp (revision 26874) +++ scribus/ui/printdialog.cpp (working copy) @@ -501,6 +501,7 @@ { m_doc->Print_Options.printerCommand = altCommand->text(); m_doc->Print_Options.useAltPrintCommand = true; + m_doc->Print_Options.toFile = false; } else m_doc->Print_Options.useAltPrintCommand = false; @@ -543,6 +544,7 @@ { selectCommand(); altCommand->setText(m_doc->Print_Options.printerCommand); + m_doc->Print_Options.toFile = false; } printAllRadio->setChecked(prefs->getBool("PrintAll", true)); printCurrentRadio->setChecked(prefs->getBool("CurrentPage", false)); |
|
The patch is not correct. It breaks the case where print destination is "File". As I already wrote it, this is the alternative printer command which must be disabled when print destination is "File", not the reverse. |
|
my C++ skills are very bad; so if it is easy to solve by somebody else, it would be great; otherwise i might try to fix it... |
Date Modified | Username | Field | Change |
---|---|---|---|
2025-05-13 15:12 | jirib | New Issue | |
2025-05-13 15:12 | jirib | File Added: printer-dialog.diff | |
2025-05-13 20:58 | jghali | Note Added: 0052523 | |
2025-05-13 21:03 | jghali | Note Edited: 0052523 | |
2025-05-14 04:55 | jirib | Note Added: 0052525 | |
2025-05-14 08:47 | jirib | Note Added: 0052527 | |
2025-05-14 10:46 | jirib | Note Added: 0052528 | |
2025-05-14 10:47 | jirib | Note Added: 0052529 | |
2025-05-14 12:18 | jirib | Note Added: 0052530 | |
2025-05-14 12:18 | jirib | File Added: altcmd.diff | |
2025-05-14 18:16 | jghali | Note Added: 0052532 | |
2025-05-14 20:24 | jirib | Note Added: 0052536 | |
2025-05-15 19:26 | jghali | Summary | Flaws with 'Alternative Printer Command' and 'File' output filename => Print Dialog : 'Alternative Printer Command' should not be enabled when 'File' destination is selected |
2025-05-15 21:03 | jghali | Assigned To | => jghali |
2025-05-15 21:03 | jghali | Status | new => resolved |
2025-05-15 21:03 | jghali | Resolution | open => fixed |
2025-05-15 21:03 | jghali | Fixed in Version | => 1.7.1.svn |