View Issue Details

IDProjectCategoryView StatusLast Update
0017519ScribusPrintingpublic2025-05-13 21:03
Reporterjirib Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version1.6.5.svn 
Summary0017519: Flaws with 'Alternative Printer Command' and 'File' output filename
DescriptionThere are flaws in Setup Print dialog, wrong handling of File and Alternative Printer Command
Steps To Reproducescenario 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 InformationI 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
                 {
---%<---
TagsNo tags attached.
PatchNo

Activities

jirib

2025-05-13 15:12

reporter  

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
 				{
printer-dialog.diff (1,588 bytes)   

jghali

2025-05-13 20:58

administrator   ~0052523

Last edited: 2025-05-13 21:03

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.

Issue History

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