This is Possible for all Office types but sadly not possible for PDF documents .

Supported Types:

 - Microsoft Office InfoPath forms  
 - The 97-2003 file formats for the
   following Microsoft Office programs:  Word, Excel, and PowerPoint 
 - The Office Open XML Formats for the following Microsoft Office   
   programs: Word, Excel, and PowerPoint
 - The XML Paper Specification (XPS) format

If its for Office type Documents then, You can do this by enabling Information Rights Management IRM.

>You can use Information Rights Management (IRM) to help control and protect files that are downloaded from lists or libraries.
>
>Microsoft Active Directory Rights Management Services (AD RMS) supports Information Rights Management for sites. No separate or additional installations are required.
>
>To apply IRM to a list or library, you must have administrator permissions for that list or library.
>
>Before you apply IRM to a list or library it must first be enabled by an administrator for your site.

More details steps available at

https://support.office.com/en-us/article/Apply-Information-Rights-Management-to-a-list-or-library-3bdb5c4e-94fc-4741-b02f-4e7cc3c54aa1?ui=en-US&rs=en-US&ad=US 

https://support.office.com/en-us/article/Restrict-permission-to-content-in-a-file-3cdd7eda-79d4-471f-91af-4dd02cc6f764