Check that the PDF printer exists
The printer is an optional feature and can be missing after a slim install. **Get-Printer** lists it by its exact name, which the print dialog uses.
Get-Printer | Select-Object Name,DriverName,PortName,PrinterStatus
Get-WindowsOptionalFeature -Online -FeatureName Printing-PDF | Select-Object FeatureName,State
Get-PrintConfiguration -PrinterName 'Microsoft Print to PDF' -ErrorAction SilentlyContinue | Select-Object PrinterName,PaperSize