@@ -1059,13 +1059,19 @@ def write(self, *kl, **kwargs):
1059
1059
self .figure .set_facecolor (origfacecolor )
1060
1060
self .figure .set_edgecolor (origedgecolor )
1061
1061
1062
+ # check for custom metadata
1063
+ metadata = kwargs .pop ("metadata" , None )
1064
+ if metadata is not None and 'Creator' in metadata :
1065
+ creator_str = metadata ['Creator' ]
1066
+ else :
1067
+ creator_str = "matplotlib version " + __version__ + \
1068
+ ", http://matplotlib.org/"
1062
1069
def print_figure_impl ():
1063
1070
# write the PostScript headers
1064
1071
if isEPSF : print ("%!PS-Adobe-3.0 EPSF-3.0" , file = fh )
1065
1072
else : print ("%!PS-Adobe-3.0" , file = fh )
1066
1073
if title : print ("%%Title: " + title , file = fh )
1067
- print (("%%Creator: matplotlib version "
1068
- + __version__ + ", http://matplotlib.org/" ), file = fh )
1074
+ print ("%%Creator: " + creator_str , file = fh )
1069
1075
# get source date from SOURCE_DATE_EPOCH, if set
1070
1076
# See https://reproducible-builds.org/specs/source-date-epoch/
1071
1077
source_date_epoch = os .getenv ("SOURCE_DATE_EPOCH" )
@@ -1249,12 +1255,21 @@ def write(self, *kl, **kwargs):
1249
1255
self .figure .set_facecolor (origfacecolor )
1250
1256
self .figure .set_edgecolor (origedgecolor )
1251
1257
1258
+ # check for custom metadata
1259
+ metadata = kwargs .pop ("metadata" , None )
1260
+ if metadata is not None and 'Creator' in metadata :
1261
+ creator_str = metadata ['Creator' ]
1262
+ else :
1263
+ creator_str = "matplotlib version " + __version__ + \
1264
+ ", http://matplotlib.org/"
1265
+
1252
1266
# write to a temp file, we'll move it to outfile when done
1253
1267
fd , tmpfile = mkstemp ()
1254
1268
with io .open (fd , 'w' , encoding = 'latin-1' ) as fh :
1255
1269
# write the Encapsulated PostScript headers
1256
1270
print ("%!PS-Adobe-3.0 EPSF-3.0" , file = fh )
1257
1271
if title : print ("%%Title: " + title , file = fh )
1272
+ < << << << d8cac234387c1bc50b4686b9568b4f5e43149957
1258
1273
print (("%%Creator: matplotlib version "
1259
1274
+ __version__ + ", http://matplotlib.org/" ), file = fh )
1260
1275
# get source date from SOURCE_DATE_EPOCH, if set
@@ -1266,6 +1281,10 @@ def write(self, *kl, **kwargs):
1266
1281
else :
1267
1282
source_date = time .ctime ()
1268
1283
print ("%%CreationDate: " + source_date , file = fh )
1284
+ == == == =
1285
+ print ("%%Creator: " + creator_str , file = fh )
1286
+ print ("%%CreationDate: " + time .ctime (time .time ()), file = fh )
1287
+ >> >> >> > Allow to pass custom Creator to images created with ps backend
1269
1288
print ("%%%%BoundingBox: %d %d %d %d" % bbox , file = fh )
1270
1289
print ("%%EndComments" , file = fh )
1271
1290
0 commit comments