Error when using Office Interop to convert Excel to PDF

Good day,

We are getting the following error on all conversions from Excel to PDF using Office Interop.

  • Printer spool is enabled
  • Desktop folder exists in systemprofile for correct version of Office
  • The version of Office is licensed

An error occurred while converting the file.\nDetailed error:
Message: Unable to find printer
Conditional expression: success
Version :
Filename : Convert.cpp
Function : trn::PDF::ToPdfPrinterManager::InitPrinter
Linenumber : 768\n\nError getting Workbook.ExportAsFixedFormat ID.\nCode: PDFTRON_UNKNOWN (-2147023174)
File: “Excel.cpp”:201
Start check system account.
Session ID is: 0.
Done checking system account.
Creating an Excel application instance.
Excel application instance created.
Application.AutomationSecurity ID obtained.
Application.AutomationSecurity value set to 3.
Application.DisplayAlerts ID obtained.
Application.Version ID obtained.
Application version: 16.
Application.Build ID obtained.
Application build: 0.
Application.Workbooks ID obtained.
Opening workbook “\\MB-FILE01W\convert-tmp\xlarge-example.xlsx”.
Workbooks.Open ID obtained.
Workbook “\\MB-FILE01W\convert-tmp\xlarge-example.xlsx” opened.
Workbook.Saved ID obtained.
Error setting Workbook.Saved value.\n

I managed to get this working by using Office 2013, instead of Office 2019/2016.