You don’t have to replace spaces if you enclose your path in <> :
<>
[Text](<file:///path to file.pdf>)