summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-09-15 17:13:07 +0100
committerRobin Watts <robin.watts@artifex.com>2016-09-16 14:00:32 +0100
commit3a1ae9b3db655efc98965bcc82ad545f6572158d (patch)
tree2178392f917e239a82c7c63bdb19e9a73661669b
parentdaf99a045fb45f6cc897887acd197824051787b1 (diff)
downloadmupdf-3a1ae9b3db655efc98965bcc82ad545f6572158d.tar.xz
Update gproof device to invoke gs better.
When invoking gs, pass in -gWIDTHxHEIGHT -dFitPage. This avoids any possible mismatch betwen the page size we expect and the page size that gs returns.
-rw-r--r--source/gprf/gprf-doc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/gprf/gprf-doc.c b/source/gprf/gprf-doc.c
index 3b8aa745..5ca14aea 100644
--- a/source/gprf/gprf-doc.c
+++ b/source/gprf/gprf-doc.c
@@ -555,10 +555,11 @@ generate_page(fz_context *ctx, gprf_page *page)
#ifdef USE_GS_API
void *instance;
int code;
- char *argv[] = { "gs", "-sDEVICE=gprf", "-dUsePDFX3Profile", NULL, "-o", NULL, NULL, NULL, NULL, NULL, NULL, NULL};
+ char *argv[] = { "gs", "-sDEVICE=gprf", "-dUsePDFX3Profile", NULL, "-o", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-dFitPage", NULL};
char arg_res[32];
char arg_fp[32];
char arg_lp[32];
+ char arg_g[32];
sprintf(arg_res, "-r%d", doc->res);
argv[3] = arg_res;
@@ -570,7 +571,9 @@ generate_page(fz_context *ctx, gprf_page *page)
argv[8] = disp_profile;
argv[9] = print_profile;
argv[10] = "-I%rom%Resource/Init/";
- argv[11] = doc->pdf_filename;
+ sprintf(arg_g, "-g%dx%d", page->width, page->height);
+ argv[11] = arg_g;
+ argv[13] = doc->pdf_filename;
code = gsapi_new_instance(&instance, ctx);
if (code < 0)
@@ -585,8 +588,8 @@ generate_page(fz_context *ctx, gprf_page *page)
fz_throw(ctx, FZ_ERROR_GENERIC, "GS run failed: %d", code);
#else
/* Invoke gs to convert to a temp file. */
- sprintf(gs_command, "gswin32c.exe -sDEVICE=gprf -r%d -o \"%s\" %s %s -I%%rom%%Resource/Init/ -dFirstPage=%d -dLastPage=%d \"%s\"",
- doc->res, filename, disp_profile, print_profile, page->number+1, page->number+1, doc->pdf_filename);
+ sprintf(gs_command, "gswin32c.exe -sDEVICE=gprf -r%d -o \"%s\" %s %s -I%%rom%%Resource/Init/ -dFirstPage=%d -dLastPage=%d -g%dx%d -dFitPage \"%s\"",
+ doc->res, filename, disp_profile, print_profile, page->number+1, page->number+1, page->width, page->height, doc->pdf_filename);
fz_system(ctx, gs_command);
#endif