Skip to content

Commit 441e5d3

Browse files
committed
Introduce print-as-raster as printer/job attribute
Some printers do not take kindly newer PDF versions which results in omitting font characters in the printout. Such jobs print fine as a raster, however retrying as raster depends on benevolence of the printer firmware what it counts as an unrecoverable printing error. In the past, we preferred raster over PDF in cups-filters, causing other issues like with finishings, or solutions like generating PCLm PPD were mentioned, however it would require a way how to define for which models it should be used, and take of such database. Thus introducing print-as-raster job attribute, which makes the job to be printed as raster, and print-as-raster-default printer attributes, which makes any job coming into the printer object to be printed as raster. Internally it uses similar mechanism as raster retry, which was adjusted to match both use cases now.
1 parent ce5ea6b commit 441e5d3

7 files changed

Lines changed: 19 additions & 5 deletions

File tree

cups/encode.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ static const _ipp_option_t ipp_options[] =
300300
{ 0, "ppi-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
301301
{ 0, "prettyprint", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
302302
{ 0, "prettyprint-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
303+
{ 0, "print-as-raster", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
304+
{ 0, "print-as-raster-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
303305
{ 0, "print-color-mode", IPP_TAG_KEYWORD, IPP_TAG_JOB,
304306
IPP_TAG_DOCUMENT },
305307
{ 0, "print-color-mode-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },

doc/help/man-lp.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ <h3><a name="COMMON_JOB_OPTIONS">Common Job Options</a></h3>
155155
<dd style="margin-left: 5.0em">Prints the job in landscape (rotated 90 degrees clockwise).
156156
<dt><b>-o orientation-requested=6</b>
157157
<dd style="margin-left: 5.0em">Prints the job in reverse portrait (rotated 180 degrees).
158+
<dt><b>-o print-as-raster</b>
159+
<dd style="margin-left: 5.0em">Prints the job as raster.
158160
<dt><b>-o print-quality=3</b>
159161
<dd style="margin-left: 5.0em"><dt><b>-o print-quality=4</b>
160162
<dd style="margin-left: 5.0em"><dt><b>-o print-quality=5</b>

man/lp.1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ Prints the job in landscape (rotated 90 degrees clockwise).
180180
\fB\-o orientation\-requested=6\fR
181181
Prints the job in reverse portrait (rotated 180 degrees).
182182
.TP 5
183+
\fB\-o print-as-raster\fR
184+
Prints the job as raster.
185+
.TP 5
183186
\fB\-o print\-quality=3\fR
184187
.TP 5
185188
\fB\-o print\-quality=4\fR

scheduler/ipp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,6 +1524,9 @@ add_job(cupsd_client_t *con, /* I - Client connection */
15241524
return (NULL);
15251525
}
15261526

1527+
if (ippGetBoolean(ippFindAttribute(con->request, "print-as-raster", IPP_TAG_BOOLEAN), 0))
1528+
job->print_as_raster = 1;
1529+
15271530
job->dtype = printer->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_REMOTE);
15281531
job->attrs = con->request;
15291532
job->dirty = 1;

scheduler/job.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */
583583

584584
_cupsRWLockWrite(&MimeDatabase->lock);
585585

586-
if (job->retry_as_raster)
586+
if (job->print_as_raster)
587587
{
588588
/*
589589
* Need to figure out whether the printer supports image/pwg-raster or
@@ -600,9 +600,9 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */
600600
}
601601

602602
if (dst)
603-
cupsdLogJob(job, CUPSD_LOG_DEBUG, "Retrying job as \"%s\".", strchr(dst->type, '/') + 1);
603+
cupsdLogJob(job, CUPSD_LOG_DEBUG, "%s job as \"%s\".", job->print_as_raster > 0 ? "Printing" : "Retrying", strchr(dst->type, '/') + 1);
604604
else
605-
cupsdLogJob(job, CUPSD_LOG_ERROR, "Unable to retry job using a supported raster format.");
605+
cupsdLogJob(job, CUPSD_LOG_ERROR, "Unable to print job using a supported raster format.");
606606
}
607607

608608
filters = mimeFilter2(MimeDatabase, job->filetypes[job->current_file], (size_t)fileinfo.st_size, dst, &(job->cost));
@@ -5220,7 +5220,7 @@ update_job(cupsd_job_t *job) /* I - Job to check */
52205220
cupsdLogJob(job, CUPSD_LOG_DEBUG, "JOBSTATE: %s", message);
52215221

52225222
if (!strcmp(message, "cups-retry-as-raster"))
5223-
job->retry_as_raster = 1;
5223+
job->print_as_raster = -1;
52245224
else
52255225
ippSetString(job->attrs, &job->reasons, 0, message);
52265226
}

scheduler/job.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ struct cupsd_job_s /**** Job request ****/
7575
int status; /* Status code from filters */
7676
int tries; /* Number of tries for this job */
7777
int completed; /* cups-waiting-for-job-completed seen */
78-
int retry_as_raster;/* Need to retry the job as raster */
78+
int print_as_raster;
79+
/* Need to print the job as raster */
7980
char *auth_env[3], /* AUTH_xxx environment variables,
8081
* if any */
8182
*auth_uid; /* AUTH_UID environment variable */

scheduler/printers.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,9 @@ cupsdCreateCommonData(void)
564564
/* pdl-override-supported */
565565
ippAddString(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "pdl-override-supported", NULL, "attempted");
566566

567+
/* print-as-raster-supported */
568+
ippAddBoolean(CommonData, IPP_TAG_PRINTER, "print-as-raster-supported", 1);
569+
567570
/* print-scaling-supported */
568571
ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "print-scaling-supported", sizeof(print_scaling) / sizeof(print_scaling[0]), NULL, print_scaling);
569572

0 commit comments

Comments
 (0)