Hi @Yahia_khalid
You can add a trigger condition that will control the execution of the flow. In trigger condition, we will check the file extension and it is found to be .pdf then only allow the flow to execute. The flow will not be executed for other file extensions.
Here are the steps to add trigger condition:
First, click on menu (...) and select 'Settings' option

Next, add the trigger condition for validating the file extension and finally click on Done button.

Expression used for validation file extension is:
@endswith(triggerOutputs()?['body/{FilenameWithExtension}'],'.pdf')
If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.
Thanks