- 🇦🇺Australia stephenrodrigo@yahoo.com Melbourne
I agree with @solideogloria.
Here is a good article how to remove the metadata in PDFs.
Removing metadata from PDF files using Exiftool and qpdfI am actually using this in file_pre_save hook
function xxx_file_presave($file) { // only proceed with pdf if ( !isset($file->filemime) || !preg_match('/pdf/', $file->filemime) ) { return; } $tmpfilename = 'private://' . drupal_random_key(); $file_realpath = drupal_realpath($file->uri); $tmpfilename_realpath = drupal_realpath($tmpfilename); try { copy($file_realpath, $tmpfilename_realpath); $a = `exiftool -all:all= $tmpfilename_realpath`; $b = `qpdf --linearize $tmpfilename_realpath ${tmpfilename_realpath}_linear`; $c = `exiftool -all:all= ${tmpfilename_realpath}_linear`; $d = `qpdf --linearize ${tmpfilename_realpath}_linear ${tmpfilename_realpath}_linear_cleaned_linear`; copy("${tmpfilename_realpath}_linear_cleaned_linear", $file_realpath); drupal_set_message(t('PDF metadata cleaned for @filename.', array('@filename' => $file->filename))); } catch (\Exception $e) { watchdog(WATCHDOG_ERROR, 'PDF metadata cleaning failed for @filename.', array('@filename' => $file->filename)); watchdog(WATCHDOG_DEBUG, $e->getMessage()); } }