remove_properties method

remove_properties

Removes metadata properties satisfying the specified predicate.

def remove_properties(self, predicate):
    ...
Parameter Type Description
predicate Func[MetadataProperty, bool] A function to test each metadata property for a condition.

Returns: int: The number of affected properties.

Example

from groupdocs.metadata import Metadata

def remove_author_properties(input_path, output_path):
    with Metadata(input_path) as metadata:
        affected = metadata.remove_properties(
            lambda p: p.name is not None and "author" in p.name.lower()
        )
        print(f"Removed {affected} properties")
        metadata.save(output_path)

See Also