Skip to content

Commit

Permalink
pdftops, mupdftoraster: Let pdftops call mutool directly and so that …
Browse files Browse the repository at this point in the history
…it directly outputs PostScript.
  • Loading branch information
tillkamppeter committed May 16, 2019
1 parent 767aecf commit 1368e71
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 212 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ NEWS - OpenPrinting CUPS Filters v1.22.6 - 2019-05-15

CHANGES IN V1.23.0

- pdftops, mupdftoraster: Let pdftops call mutool directly and
so that it directly outputs PostScript, eliminating the need
to call the mupdftoraster and rastertops filters.
- mupdftoraster: Reduced the use of temporary files from 3 to
just one.
- imagetopdf, imagetoraster, pdftopdf: Add support for
Expand Down
21 changes: 2 additions & 19 deletions filter/mupdftoraster.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ parse_pdf_header_options(FILE *fp, mupdf_page_header *h)

static void
add_pdf_header_options(mupdf_page_header *h,
cups_array_t *mupdf_args,
int gray_output)
cups_array_t *mupdf_args)
{
char tmpstr[1024];

Expand Down Expand Up @@ -160,12 +159,6 @@ add_pdf_header_options(mupdf_page_header *h,
snprintf(tmpstr, sizeof(tmpstr), "-cmono");
break;
}
/* If we got called by pdftops, gray_output is set to 0 or 1,
0 for a color job and 1 for a gray job */
if (gray_output == 1)
snprintf(tmpstr, sizeof(tmpstr), "-cgray");
else if (gray_output == 0)
snprintf(tmpstr, sizeof(tmpstr), "-ccmyk");
cupsArrayAdd(mupdf_args, strdup(tmpstr));
}

Expand Down Expand Up @@ -253,7 +246,6 @@ main (int argc, char **argv, char *envp[])
int n;
int num_options;
int status = 1;
int gray_output = -1;
ppd_file_t *ppd = NULL;
struct sigaction sa;
cm_calibration_t cm_calibrate;
Expand Down Expand Up @@ -407,17 +399,8 @@ main (int argc, char **argv, char *envp[])
h.MirrorPrint = CUPS_FALSE;
h.Orientation = CUPS_ORIENT_0;

/* If we got called by pdftops, the option "pdftops-mutool-gray"
is supplied and 0 for a color job and 1 for a gray job */
t = cupsGetOption("pdftops-mutool-gray", num_options, options);
if (t) {
gray_output = atoi(t);
if (gray_output < 0 || gray_output > 1)
gray_output = -1;
}

/* get all the data from the header and pass it to mutool */
add_pdf_header_options (&h, mupdf_args, gray_output);
add_pdf_header_options (&h, mupdf_args);

snprintf(tmpstr, sizeof(tmpstr), "%s", infilename);
cupsArrayAdd(mupdf_args, strdup(tmpstr));
Expand Down
Loading

0 comments on commit 1368e71

Please sign in to comment.