cognidox / OfficeToPDF

A command line tool to convert Microsoft Office documents to PDFs
https://www.cognidox.com/
Other
609 stars 137 forks source link

Cannot convert when using as windows service #66

Closed zssng closed 4 years ago

zssng commented 4 years ago

I got this error when i call office to pdf in windows service.

C:/xx/OfficeToPDF.exe C:/xx/office_to_pdf/dist/live/ODa0EN1Gq-a.xlsx
stdout: ���� COM �๤���� CLSID Ϊ {00024500-0000-0000-C000-000000000046} �����ʧ�ܣ�ԭ���dz������´���: 80070520 ָ���ĵ�¼�Ự�����ڡ������ѱ���ֹ�� (�쳣���� HRESULT:0x80070520)��
Did not convert

Does the OfficeToPDF support calling in service?

polybas commented 4 years ago

I think that the problem is in the user under which the service is running. By default, this is Local System. Try to change the user under which you log into the system.

zssng commented 4 years ago

Thank you for your reply. I retried changing service account, get this failed due to the following error: 80070520 A specified logon session does not exist. It may already have been terminated. (Exception from HRESULT: 0x80070520). I check the event log ,Audit was succeed.

zssng commented 4 years ago

Using built-in admin account as service account,got this stdout: ���� COM �๤���� CLSID Ϊ {00024500-0000-0000-C000-000000000046} �����ʧ�ܣ�ԭ���dz������´���: 80070005 �ܾ����ʡ� (�쳣���� HRESULT:0x80070005 (E_ACCESSDENIED))�� Did not convert

polybas commented 4 years ago

Is xlsx converted from console command (not service)?

zssng commented 4 years ago

I package a node app as exe,the exe run as service, use const {exec} = require('child_process') to call officetopdf.exe,command line is cmd.exe /c officetopdf.exe test.xlsx.

lauritsriple commented 4 years ago

Maybe related to #33, #19. The solutions mentioned there seems to work for me running OfficeToPDF from Jenkins job (running as service)

zssng commented 4 years ago

Create deskstop folder still got ���� COM �๤���� CLSID Ϊ {00024500-0000-0000-C000-000000000046} �����ʧ�ܣ�ԭ���dz������´���: 80070520 ָ���ĵ�¼�Ự�����ڡ������ѱ���ֹ�� (�쳣���� HRESULT:0x80070520)��

lauritsriple commented 4 years ago

Maybe something like this. Except that one is for Word, so you would have to change every mention of word with excel.

zssng commented 4 years ago

Thank you, it works!😁

Maybe something like this. Except that one is for Word, so you would have to change every mention of word with excel.