Skip to content

Commit c3be0c8

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 6e4a2c6 commit c3be0c8

6 files changed

Lines changed: 17 additions & 5 deletions

File tree

cups/encode.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ static const _ipp_option_t ipp_options[] =
298298
{ 0, "ppi-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
299299
{ 0, "prettyprint", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
300300
{ 0, "prettyprint-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
301+
{ 0, "print-as-raster", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
302+
{ 0, "print-as-raster-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
301303
{ 0, "print-color-mode", IPP_TAG_KEYWORD, IPP_TAG_JOB,
302304
IPP_TAG_DOCUMENT },
303305
{ 0, "print-color-mode-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },

doc/help/man-lp.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ <h3 id="lp-1.options.common-job-options">Common Job Options</h3>
184184
</p>
185185
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>-o orientation-requested=6</strong><br>
186186
Prints the job in reverse portrait (rotated 180 degrees).
187+
</p>
188+
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>-o print-as-raster</strong><br>
189+
Prints the job as raster.
187190
</p>
188191
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>-o print-quality=3</strong><br>
189192
</p>

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
@@ -1517,6 +1517,9 @@ add_job(cupsd_client_t *con, /* I - Client connection */
15171517
return (NULL);
15181518
}
15191519

1520+
if (ippGetBoolean(ippFindAttribute(con->request, "print-as-raster", IPP_TAG_BOOLEAN), 0))
1521+
job->print_as_raster = 1;
1522+
15201523
job->dtype = printer->type & (CUPS_PTYPE_CLASS | CUPS_PTYPE_REMOTE);
15211524
job->attrs = con->request;
15221525
job->dirty = 1;

scheduler/job.c

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

580580
cupsRWLockWrite(&MimeDatabase->lock);
581581

582-
if (job->retry_as_raster)
582+
if (job->print_as_raster)
583583
{
584584
/*
585585
* Need to figure out whether the printer supports image/pwg-raster or
@@ -596,9 +596,9 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */
596596
}
597597

598598
if (dst)
599-
cupsdLogJob(job, CUPSD_LOG_DEBUG, "Retrying job as \"%s\".", strchr(dst->type, '/') + 1);
599+
cupsdLogJob(job, CUPSD_LOG_DEBUG, "%s job as \"%s\".", job->print_as_raster > 0 ? "Printing" : "Retrying", strchr(dst->type, '/') + 1);
600600
else
601-
cupsdLogJob(job, CUPSD_LOG_ERROR, "Unable to retry job using a supported raster format.");
601+
cupsdLogJob(job, CUPSD_LOG_ERROR, "Unable to force job using a supported raster format.");
602602
}
603603

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

52495249
if (!strcmp(message, "cups-retry-as-raster"))
5250-
job->retry_as_raster = 1;
5250+
job->print_as_raster = -1;
52515251
else
52525252
ippSetString(job->attrs, &job->reasons, 0, message);
52535253
}

scheduler/job.h

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

0 commit comments

Comments
 (0)