If PDFs in your document libraries won’t open directly in the browser, the secret is kept in the General Settings (Central Admin) for your Web Application.

Look for a setting called ‘Browser File Handling’. Most likely, it’s set to
‘Strict’. change that setting to ‘Permissive’ and it should work pretty much as expected.