diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2021-09-01 13:56:54 +0100 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2021-09-01 13:56:54 +0100 |
commit | 1981ae3aded48d965bc24afaa4a2cac03e3567f7 (patch) | |
tree | 4a8a914ac1b7cdf7315629578c6e146c72b9ee72 | |
parent | c62817bb4c0b36dd07c27977faa9226f2a754052 (diff) | |
download | ghostpdl-1981ae3aded48d965bc24afaa4a2cac03e3567f7.tar.gz |
GhostPDF - implement NOSUBSTDEVICECOLORS
This implements the 'NOSUBSTDEVICECOLORS' switch in GhostPDF. When set
any Default* colour spaces in the input PDF file are not used as
replacements for the Device* colour spaces.
-rw-r--r-- | pdf/ghostpdf.h | 1 | ||||
-rw-r--r-- | pdf/pdf_int.c | 3 | ||||
-rw-r--r-- | pdf/pdf_page.c | 3 | ||||
-rw-r--r-- | pdf/pdftop.c | 5 |
4 files changed, 12 insertions, 0 deletions
diff --git a/pdf/ghostpdf.h b/pdf/ghostpdf.h index 9d10d0f74..625dca7dd 100644 --- a/pdf/ghostpdf.h +++ b/pdf/ghostpdf.h @@ -191,6 +191,7 @@ typedef struct cmd_args_s { bool renderttnotdef; bool pdfinfo; bool UsePDFX3Profile; + bool NOSUBSTDEVICECOLORS; bool ditherppi; int PDFX3Profile_num; char *UseOutputIntent; diff --git a/pdf/pdf_int.c b/pdf/pdf_int.c index 4ac7a5177..a8e31facf 100644 --- a/pdf/pdf_int.c +++ b/pdf/pdf_int.c @@ -1768,6 +1768,9 @@ static int setup_stream_DefaultSpaces(pdf_context *ctx, pdf_dict *stream_dict) * spaces. */ + if (ctx->args.NOSUBSTDEVICECOLORS) + return 0; + code = pdfi_dict_knownget(ctx, stream_dict, "Resources", (pdf_obj **)&resources_dict); if (code > 0) { code = pdfi_dict_knownget(ctx, resources_dict, "ColorSpace", (pdf_obj **)&colorspaces_dict); diff --git a/pdf/pdf_page.c b/pdf/pdf_page.c index 7e5b45244..9439b6e34 100644 --- a/pdf/pdf_page.c +++ b/pdf/pdf_page.c @@ -692,6 +692,9 @@ static int setup_page_DefaultSpaces(pdf_context *ctx, pdf_dict *page_dict) /* First off, discard any dangling Default* colour spaces, just in case. */ release_page_DefaultSpaces(ctx); + if (ctx->args.NOSUBSTDEVICECOLORS) + return 0; + /* Create any required DefaultGray, DefaultRGB or DefaultCMYK * spaces. */ diff --git a/pdf/pdftop.c b/pdf/pdftop.c index 66baf722a..feb8e8b3e 100644 --- a/pdf/pdftop.c +++ b/pdf/pdftop.c @@ -655,6 +655,11 @@ pdf_impl_set_param(pl_interp_implementation_t *impl, if (code < 0) return code; } + if (!strncmp(param, "NOSUBSTDEVICECOLORS", strlen("NOSUBSTDEVICECOLORS"))) { + code = plist_value_get_bool(&pvalue, &ctx->args.NOSUBSTDEVICECOLORS); + if (code < 0) + return code; + } if (!strncmp(param, "UseOutputIntent", strlen("UseOutputIntent"))) { code = plist_value_get_string_or_name(ctx, &pvalue, &ctx->args.UseOutputIntent, &len); if (code < 0) |