Is there a way to do this programmatically using vba or C#, etc
You can use PrintDocument.PrinterSettings, like :
PrintDocument.PrinterSettings.PrinterName = "Microsoft Print to PDF";
PrintDocument.PrinterSettings.PrintToFile = true;
PrintDocument.PrinterSettings.PrintFileName = "pdf_filename";