parameters: (self, metadata_content)
docstring: Set the XMP metadata of the pdf, wrapping it with the necessary XMP header/footer.
          These are required for a PDF/A file to be completely compliant. Ommiting them would result in validation errors.
          :param metadata_content: bytes of the metadata to add to the pdf.
docstring_summary: Set the XMP metadata of the pdf, wrapping it with the necessary XMP header/footer.
          These are required for a PDF/A file to be completely compliant. Ommiting them would result in validation errors.
          :param metadata_content: bytes of the metadata to add to the pdf.
docstring_tokens: Set the XMP metadata of the pdf wrapping it with the necessary XMP header / footer . These are required for a PDF / A file to be completely compliant . Ommiting them would result in validation errors . : param metadata_content : bytes of the metadata to add to the pdf .
function: def add_file_metadata(self, metadata_content):
          """
          Set the XMP metadata of the pdf, wrapping it with the necessary XMP header/footer.
          These are required for a PDF/A file to be completely compliant. Ommiting them would result in validation errors.
          :param metadata_content: bytes of the metadata to add to the pdf.
          """
          # See https://wwwimages2.adobe.com/content/dam/acom/en/devnet/xmp/pdfs/XMP%20SDK%20Release%20cc-2016-08/XMPSpecificationPart1.pdf
          # Page 10/11
          header = b'<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>'
          footer = b'<?xpacket end="w"?>'
          metadata = b'%s%s%s' % (header, metadata_content, footer)
          file_entry = DecodedStreamObject()
          file_entry.setData(metadata)
          file_entry.update({
              NameObject("/Type"): NameObject("/Metadata"),
              NameObject("/Subtype"): NameObject("/XML"),
              NameObject("/Length"): NameObject(str(len(metadata))),
          })
  
          # Add the new metadata to the pdf, then redirect the reference to refer to this new object.
          metadata_object = self._addObject(file_entry)
          self._root_object.update({NameObject("/Metadata"): metadata_object})
function_tokens: def add_file_metadata ( self , metadata_content ) : # See https://wwwimages2.adobe.com/content/dam/acom/en/devnet/xmp/pdfs/XMP%20SDK%20Release%20cc-2016-08/XMPSpecificationPart1.pdf # Page 10/11 header = b'<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>' footer = b'<?xpacket end="w"?>' metadata = b'%s%s%s' % ( header , metadata_content , footer ) file_entry = DecodedStreamObject ( ) file_entry . setData ( metadata ) file_entry . update ( { NameObject ( "/Type" ) : NameObject ( "/Metadata" ) , NameObject ( "/Subtype" ) : NameObject ( "/XML" ) , NameObject ( "/Length" ) : NameObject ( str ( len ( metadata ) ) ) , } ) # Add the new metadata to the pdf, then redirect the reference to refer to this new object. metadata_object = self . _addObject ( file_entry ) self . _root_object . update ( { NameObject ( "/Metadata" ) : metadata_object } )