python-3.xreportlab

ReportLab - Metadata, CreationDate and ModificationDate


How can I change metadata fields, CreationDate and ModificationDate, when I create a pdf with Reportlab?


Solution

  • Take a look at where modification and creation dates are set:

    D['ModDate'] = D["CreationDate"] = \
                 Date(ts=document._timeStamp,dateFormatter=self._dateFormatter)
    # ...
    return PDFDictionary(D).format(document)
    

    Basically, metadata is a dictionary saved at the end of binary string, start of string is file contents (document).

    Inside Reportlab the workflow you ask about can be:

    Change metadata of pdf file with pypdf also attempts similar goal.