Skip to content

Commit

Permalink
Don't fallback to default page size for PS->PDF (#69)
Browse files Browse the repository at this point in the history
If we have no output page size, but convert from PS to PDF,
Ghostscript will use the input Postscript page size.
  • Loading branch information
colinleroy authored Dec 1, 2024
1 parent 5cc755c commit eb2d498
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions cupsfilters/raster.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,22 @@ cfRasterPrepareHeader(cups_page_header_t *h, // I - Raster header
else if (size_name_buf[0])
_strlcpy(h->cupsPageSizeName, size_name_buf, sizeof(h->cupsPageSizeName));

cfSetPageDimensionsToDefault(&(dimensions[0]), &(dimensions[1]),
&(margins[0]), &(margins[1]),
&(margins[2]), &(margins[3]),
log, ld);
if (data->printer_attrs != NULL ||
data->job_attrs != NULL ||
final_outformat != CF_FILTER_OUT_FORMAT_PDF ||
data->content_type == NULL ||
strcmp(data->content_type, "application/postscript"))
{
cfSetPageDimensionsToDefault(&(dimensions[0]), &(dimensions[1]),
&(margins[0]), &(margins[1]),
&(margins[2]), &(margins[3]),
log, ld);
}
else
{
log(ld, CF_LOGLEVEL_DEBUG,
"Postscript to PDF and no attributes: not setting page size.");
}

if (!cupsrasterheader)
memset(margins, 0, sizeof(margins));
Expand Down

0 comments on commit eb2d498

Please sign in to comment.