diff options
author | Michael R Sweet <michael.r.sweet@gmail.com> | 2019-04-23 17:31:23 -0400 |
---|---|---|
committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2019-04-23 17:31:23 -0400 |
commit | b13a9a96331deaae6f197a621b7de2378c12c1ee (patch) | |
tree | cca02dfd44e750a09ae85ac797016ffb71a5f2e4 /test | |
parent | 7331c1b6334e680fbe8e54c9d1ea7fca6d83dbf2 (diff) | |
download | cups-b13a9a96331deaae6f197a621b7de2378c12c1ee.tar.gz |
Fix PDF filtering.
Diffstat (limited to 'test')
-rw-r--r-- | test/ippeveps.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/test/ippeveps.c b/test/ippeveps.c index dbd6a810d..a6eb55f51 100644 --- a/test/ippeveps.c +++ b/test/ippeveps.c @@ -777,6 +777,8 @@ pdf_to_ps(const char *filename, /* I - Filename */ const char *pdf_argv[8]; /* Command-line arguments */ char pdf_options[1024]; /* Options */ const char *value; /* Option value */ + const char *job_id, /* job-id value */ + *job_name; /* job-name value */ /* @@ -798,10 +800,15 @@ pdf_to_ps(const char *filename, /* I - Filename */ else pdf_options[0] = '\0'; + if ((job_id = getenv("IPP_JOB_ID")) == NULL) + job_id = "42"; + if ((job_name = getenv("IPP_JOB_NAME")) == NULL) + job_name = "untitled"; + pdf_argv[0] = "printer"; - pdf_argv[1] = getenv("IPP_JOB_ID"); + pdf_argv[1] = job_id; pdf_argv[2] = cupsUser(); - pdf_argv[3] = getenv("IPP_JOB_NAME"); + pdf_argv[3] = job_name; pdf_argv[4] = "1"; pdf_argv[5] = pdf_options; pdf_argv[6] = filename; @@ -932,24 +939,26 @@ ps_to_ps(const char *filename, /* I - Filename */ dsc_header(0); + first_pos = 0; + while (fgets(line, sizeof(line), fp)) { if (!strncmp(line, "%%Page:", 7)) break; + first_pos = ftell(fp); + if (line[0] != '%') fputs(line, stdout); } if (!strncmp(line, "%%Page:", 7)) { - first_pos = ftell(fp) - (long)strlen(line); - for (copy = 0; copy < copies; copy ++) { int copy_page = 0; /* Do we copy the page data? */ - if (fp != stdin && copy > 0) + if (fp != stdin) fseek(fp, first_pos, SEEK_SET); page = 0; |