How to Delist & Prevent Indexing of PDFs from Search Engine

Hi there,

While trying to optimizing my blog for seo, I noticed that Google has indexed PDFs that I normally ask readers to sign-in for.

How can I:

  1. Delist the pdfs from search?
  2. Prevent other pdfs from being indexed?

Will adding the following in my robot.txt prevent indexing?

User-agent: *
Disallow: /*.pdf

I’m self-hosting my ghost blog using bitnami’s version on aws lightsail and using apache and mysql.

Would appreciate your help!