开发者

Mac Terminal change PDF author

I need to change the author of a PDF file on my Mac. I have tried to use grep and sed to accomplish this, but haven't succeeded.

If I open a PDF file in Preview.app and go to Tools > Show Inspector I see "Author: yonatan".

Is it possible to use Terminal.app to change this string?

Thanks

P.S. I know I can create a new User Acc开发者_运维问答ount on my Mac or use Adobe Acrobat Professional.


  1. open Automator & create a New Workflow
  2. search "spec" & add Get Specified Finder Items
  3. search "meta" & add Set PDF Metadata
  4. drag-drop the desired PDFs onto the Get Specified Finder Items area
  5. in the Set PDF Metadata area, update the metadata
  6. in the upper-right corner, click [Run]

For more detail see the screenshot below:

Mac Terminal change PDF author


A better way would be to make use of exiftool, which on Mac you could install with use of Homebrew:

brew install exiftool

You would then edit your metadata in your PDF in the following manner:

exiftool  -Title="Change This Title" -Subject="Fun and PDF" change_my_meta.pdf

Removing metadata

If you only want to remove metadata you can use pdf-redact-tools:

pdf-redact-tools --sanitize untrusted.pdf


You could use Automator. I dont think that sed is going to work because pdfs are largely binary, or very jumbled at the least. One of the defined 'pdf' actions in Automator is defining metadata, one field which is author. Then call the automator workflow with terminal, or just save the workflow as a droplet.


Having used the proposed methods, I obtained a decrease in quality of my paper (using pdf-redact-tools). For me, using MacOS, the best way to irreversibly remove all metadata from a pdf was performed using both exiftool and qpdf, as follows.

  1. replace metadata with nulls
exiftool -all:all= CLEAN_file.pdf -overwrite_original
  1. linearize the pdf to remove the old metadata (which were replaced with nulls), preventing from restoring of these metadata:
qpdf --linearize file_from_exif.pdf file_out.pdf
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜