Errors when calling PDFNet SDK ConvertToPDF

Hi,

I am trying to convert doc, docx, xls, xlsx, ppt and pptx files using PDFNet SDK. I am failing on pdftron.PDF.Convert.ToPdf(doc, inputPath).

pptxt and ppt file

“Exception: \n\t Message: An error occurred while converting the file.\nDetailed error:\n\tError creating a new PowerPoint application instance.\nCode: PDFTRON_UNKNOWN (-2147024891)\n\t File: “PowerPoint.cpp”:62\n\tLog:\n\t Start check system account.\n\t Session ID is: 0.\n\t Done checking system account.\n\t Creating a PowerPoint application instance.\n\n\t Conditional expression: false\n\t Version : 6.8.66.N\n\t Filename : Convert.cpp\n\t Function : trn::PDF::Convert::ToPdf\n\t Linenumber : 1734\n”

docx and doc file

{“Exception: \n\t Message: An error occurred while converting the file.\nDetailed error:\n\tError creating a new Word application instance.\nCode: PDFTRON_UNKNOWN (-2147024891)\n\t File: “Word.cpp”:141\n\tLog:\n\t Start check system account.\n\t Session ID is: 0.\n\t Done checking system account.\n\t Start checking registry.\n\t Registry check done.\n\t Creating a Word application instance.\n\n\t Conditional expression: false\n\t Version : 6.8.66.N\n\t Filename : Convert.cpp\n\t Function : trn::PDF::Convert::ToPdf\n\t Linenumber : 1734\n”}

xls and xlsx file

{“Exception: \n\t Message: An error occurred while converting the file.\nDetailed error:\n\tException: \n\t Message: Error opening the workbook (workbook maybe invalid, corrupted, or password protected).\nCode: DISP_E_EXCEPTION\n\tCOM Interop Error:\n\t Code: 0\n\t Source: Microsoft Excel\n\t Description: Microsoft Excel cannot access the file ‘D:\SimpleHQ\simple_api\AssetsAuthModule\Assets\4e4488ca44644aac8f160f47b02995e6.xlsx’. There are several possible reasons:\n\n• The file name or path does not exist.\n• The file is being used by another program.\n• The workbook you are trying to save has the same name as a currently open workbook.\n\t Help File: xlmain11.chm\n\t Help Context ID: 0\n\t ARG Index: 0\n\t File: “Excel.cpp”:493\n\tLog:\n\t Start check system account.\n\t Session ID is: 0.\n\t Done checking system account.\n\t Creating an Excel application instance.\n\t Excel application instance created.\n\t Application.AutomationSecurity ID obtained.\n\t Application.AutomationSecurity value set to 3.\n\t Application.DisplayAlerts ID obtained.\n\t Application.Version ID obtained.\n\t Application version: 16.\n\t Application.Build ID obtained.\n\t Application build: 0.\n\t Application.Workbooks ID obtained.\n\t Opening workbook “D:\SimpleHQ\simple_api\AssetsAuthModule\Assets\4e4488ca44644aac8f160f47b02995e6.xlsx”.\n\t Workbooks.Open ID obtained.\n\n\t Conditional expression: FALSE\n\t Version : 6.8.66.N\n\t Filename : Convert.cpp\n\t Function : trn::PDF::Convert::ToPDFViaOffice\n\t Linenumber : 1788\n\nError opening the workbook (workbook maybe invalid, corrupted, or password protected).\nCode: DISP_E_EXCEPTION\n\tCOM Interop Error:\n\t Code: 0\n\t Source: Microsoft Excel\n\t Description: Microsoft Excel cannot access the file ‘D:\SimpleHQ\simple_api\AssetsAuthModule\Assets\4e4488ca44644aac8f160f47b02995e6.xlsx’. There are several possible reasons:\n\n• The file name or path does not exist.\n• The file is being used by another program.\n• The workbook you are trying to save has the same name as a currently open workbook.\n\t Help File: xlmain11.chm\n\t Help Context ID: 0\n\t ARG Index: 0\n\t File: “Excel.cpp”:493\n\tLog:\n\t Start check system account.\n\t Session ID is: 0.\n\t Done checking system account.\n\t Creating an Excel application instance.\n\t Excel application instance created.\n\t Application.AutomationSecurity ID obtained.\n\t Application.AutomationSecurity value set to 3.\n\t Application.DisplayAlerts ID obtained.\n\t Application.Version ID obtained.\n\t Application version: 16.\n\t Application.Build ID obtained.\n\t Application build: 0.\n\t Application.Workbooks ID obtained.\n\t Opening workbook “D:\SimpleHQ\simple_api\AssetsAuthModule\Assets\4e4488ca44644aac8f160f47b02995e6.xlsx”.\n\t Workbooks.Open ID obtained.\n\n\t Conditional expression: false\n\t Version : 6.8.66.N\n\t Filename : Convert.cpp\n\t Function : trn::PDF::Convert::ToPdf\n\t Linenumber : 1734\n”}

I am getting this even though the workbook isn’t open.

I am using build 6.8.66.7102. Thank you!

How are you running the conversion? Normal process? Service? Web app?

All the errors you report look to be permission related, so I assume you are not running as a normal process.

This guide might be helpful

Additional requirements perhaps not mentioned in the guides above:
Licensed copy of MS Office
Print spooler service running