projects/guix·blob python-team · refs

46 lines · 2.1 KiB

1This patch makes emission of /CreationDate and /ModDate headers optional.
2
3If the environment variable GS_GENERATE_UUIDS is set to "0" or "no", it will
4not write out the "/ID" field (if that's permissible).
5
6Upstream does not want to do this.
7
8See: https://bugs.ghostscript.com/show_bug.cgi?id=698208
9diff --git a/devices/vector/gdevpdf.c b/devices/vector/gdevpdf.c
10index cb268f62e..c5abefde2 100644
11--- a/devices/vector/gdevpdf.c
12+++ b/devices/vector/gdevpdf.c
13@@ -425,6 +425,9 @@ pdf_initialize_ids(gx_device_pdf * pdev)
14 * date and time, rather than (for example) %%CreationDate from the
15 * PostScript file. We think this is wrong, but we do the same.
16 */
17+ if (!getenv("GS_GENERATE_UUIDS") ||
18+ (strcasecmp(getenv("GS_GENERATE_UUIDS"), "0") != 0 &&
19+ strcasecmp(getenv("GS_GENERATE_UUIDS"), "no") != 0))
20 {
21 struct tm tms;
22 time_t t;
23diff --git a/devices/vector/gdevpdfe.c b/devices/vector/gdevpdfe.c
24index ec011d8ba..f083f1e93 100644
25--- a/devices/vector/gdevpdfe.c
26+++ b/devices/vector/gdevpdfe.c
27@@ -696,6 +696,9 @@ pdf_write_document_metadata(gx_device_pdf *pdev, const byte digest[6])
28 pdf_xml_attribute_name(s, "xmlns:xmp");
29 pdf_xml_attribute_value(s, "http://ns.adobe.com/xap/1.0/");
30 pdf_xml_tag_end(s);
31+ if (!getenv("GS_GENERATE_UUIDS") ||
32+ (strcasecmp(getenv("GS_GENERATE_UUIDS"), "0") != 0 &&
33+ strcasecmp(getenv("GS_GENERATE_UUIDS"), "no") != 0))
34 {
35 pdf_xml_tag_open_beg(s, "xmp:ModifyDate");
36 pdf_xml_tag_end(s);
37@@ -704,6 +707,9 @@ pdf_write_document_metadata(gx_device_pdf *pdev, const byte digest[6])
38 pdf_xml_tag_close(s, "xmp:ModifyDate");
39 pdf_xml_newline(s);
40 }
41+ if (!getenv("GS_GENERATE_UUIDS") ||
42+ (strcasecmp(getenv("GS_GENERATE_UUIDS"), "0") != 0 &&
43+ strcasecmp(getenv("GS_GENERATE_UUIDS"), "no") != 0))
44 {
45 pdf_xml_tag_open_beg(s, "xmp:CreateDate");
46 pdf_xml_tag_end(s);