Open Command Prompt as Admin and then type or copy then paste the following command, then hit Enter:
dism /Online /Disable-Feature /FeatureName:"Printing-PrintToPDFServices-Features" /NoRestart
Wait while the command executes successfully
At the command prompt, type or copy then paste the second command, then hit Enter:
dism /Online /Enable-Feature /FeatureName:"Printing-PrintToPDFServices-Features" /NoRestart
Wait while the command executes successfully.
You should now see the Microsoft Print to PDF restored.