Read PDF with OCR- Build a logic

Hi everyone, In my scope of work i need to extract data from different PDF files. In which most of them are scanned copies

issue i am facing is:

Some PDF files output is good with native scraping and others require to use OCR. Is there any way that i can build a logic by which has to take any PDF in folder as input and decide the better way of reading it(native or OCR) by its self.