Apache 2.4 is the answer:
Set Cache-Control header when response content type is application / pdf
Header set Cache-Control "no-store,no-transform" "expr=%{resp:Content-Type} =~ m|application/pdf|"
DO NOT try with the IF directive. He is evaluated too early in the process. For example, the following will NOT work:
<If "%{resp:Content-Type} =~ m|application/pdf|"> Header set Cache-Control "no-store, no-transform" </If>
Scott
source share