Description
Bug report
Bug summary
We document that if you pass metadata=None
through to the PdfPages
we will not emit the auto-generated creator / producer / date metadata (https://matplotlib.org/3.3.0/api/backend_pdf_api.html#matplotlib.backends.backend_pdf.PdfPages) the code does not actually support this:
Code for reproduction
import matplotlib.pyplot as plt
from io import BytesIO
buf = BytesIO()
plt.gcf().savefig(buf, metadata=None, format='pdf')
buf.seek(0)
assert b'Matplotlib' not in buf.getvalue()
Actual outcome
----> 1 assert b'Matplotlib' not in buf.getvalue()
AssertionError:
Labeling this as a good first issue as there is no API design or controversy here (the code does not do what it is documented to do and I do not think it is controversial to have a way to fully suppress the generation of meta-adat).
The fix is likely spread across Figure.savefig
, FigureCanvasPdf.print_pdf
, and the PdfPages
class. I suspect we need to change of the default values to a sentinal (rather than None
), but not sure exactly where. This should be straight forward and contained to one module, but not an issue to learn Python on.