projects/guix·blob javascript-team · refs

49 lines · 2.4 KiB

1This patch makes the UUIDs in the XMP header optional, depending on the
2setting of the environment variable GS_GENERATE_UUIDS.
3
4If the environment variable GS_GENERATE_UUIDS is set to "0" or "no", it will
5not write out the Document UUID field and also will write the Instance ID
6field value as "".
7
8Upstream does not want to do this.
9
10See: https://bugs.ghostscript.com/show_bug.cgi?id=698208
11diff --git a/devices/vector/gdevpdfe.c b/devices/vector/gdevpdfe.c
12index f083f1e93..a19c64ac0 100644
13--- a/devices/vector/gdevpdfe.c
14+++ b/devices/vector/gdevpdfe.c
15@@ -624,7 +624,7 @@ pdf_write_document_metadata(gx_device_pdf *pdev, const byte digest[6])
16 return code;
17
18 /* PDF/A XMP reference recommends setting UUID to empty. If not empty must be a URI */
19- if (pdev->PDFA != 0)
20+ if (pdev->PDFA != 0 || (getenv("GS_GENERATE_UUIDS") && (strcasecmp(getenv("GS_GENERATE_UUIDS"), "0") == 0 || strcasecmp(getenv("GS_GENERATE_UUIDS"), "no") == 0)))
21 instance_uuid[0] = 0x00;
22
23 cre_date_time_len = pdf_get_docinfo_item(pdev, "/CreationDate", cre_date_time, sizeof(cre_date_time));
24@@ -730,14 +730,17 @@ pdf_write_document_metadata(gx_device_pdf *pdev, const byte digest[6])
25 pdf_xml_tag_close(s, "rdf:Description");
26 pdf_xml_newline(s);
27
28- pdf_xml_tag_open_beg(s, "rdf:Description");
29- pdf_xml_copy(s, " rdf:about=\"\"");
30- pdf_xml_attribute_name(s, "xmlns:xapMM");
31- pdf_xml_attribute_value(s, "http://ns.adobe.com/xap/1.0/mm/");
32- pdf_xml_attribute_name(s, "xapMM:DocumentID");
33- pdf_xml_attribute_value(s, document_uuid);
34- pdf_xml_tag_end_empty(s);
35- pdf_xml_newline(s);
36+ if (!getenv("GS_GENERATE_UUIDS") || (strcasecmp(getenv("GS_GENERATE_UUIDS"), "0") != 0 && strcasecmp(getenv("GS_GENERATE_UUIDS"), "no") != 0))
37+ {
38+ pdf_xml_tag_open_beg(s, "rdf:Description");
39+ pdf_xml_copy(s, " rdf:about=\"\"");
40+ pdf_xml_attribute_name(s, "xmlns:xapMM");
41+ pdf_xml_attribute_value(s, "http://ns.adobe.com/xap/1.0/mm/");
42+ pdf_xml_attribute_name(s, "xapMM:DocumentID");
43+ pdf_xml_attribute_value(s, document_uuid);
44+ pdf_xml_tag_end_empty(s);
45+ pdf_xml_newline(s);
46+ }
47
48 pdf_xml_tag_open_beg(s, "rdf:Description");
49 pdf_xml_copy(s, " rdf:about=\"\"");