postyou/contao-pdf-metadata

Extends the contao file manager to clean up the metadata of PDF files for privacy reasons

2.0.0 2023-03-08 09:33 UTC

This package is auto-updated.

Last update: 2024-11-08 13:49:12 UTC


README

Extends the contao file manager to clean up the metadata of PDF files for privacy reasons.

Packagist Version

The following two commands are executed in the prozess:

$ exiftool -all= -Author='' -tagsfromfile @ -title -keywords -subject -description file.pdf -o intermediate.pdf
$ qpdf --linearize intermediate.pdf file.pdf

Requirements

  • ExifTool installed on the system
  • QPDF installed on the system

Configuration

# config/config.yaml
contao_pdf_metadata:
    exiftool:

        # Path to the exiftool binary.
        path:                 /usr/bin/exiftool

        # Environment variables when running exiftool.
        env:

            # Prototype
            name:                 ~
    qpdf:

        # Path to the qpdf binary.
        path:                 /usr/bin/qpdf

        # Environment variables when running qpdf.
        env:

            # Prototype
            name:                 ~

    # Clean up the metadata of PDF files immediately after uploading.
    cleanup_on_upload:    false

    # Overwrites metadata fields in the cleaned PDF file.
    metadata:
        author:               ''

Console Command

To clean up the metadata of PDF files in the files/ directory, you can use the following command:

$ vendor/bin/contao-console pdf-metadata:clean [<path>]