Prevent google from indexing pdf files

Is there anyway to prevent search engines like google from indexing pdf files? I know that we can do something like

<Files ~ "\.pdf$">
  Header set X-Robots-Tag "noindex, nofollow"
</Files>

in htaccess for normal websites. But how this is possible for discourse?

现在可以手动编辑 robots.txt。您可以向您的 robots.txt 添加

Disallow: /*.pdf

来禁止 PDF 文件的抓取。