如何使用word转pdf的convert功能

目前正在使用7.2版本的docker部署的onlyoffice服务。

使用postman请求post http://documentServer/ConvertService.ashx会报错误代码-3、-4和-7,使用官方api中的示例并不能直接将docx文件转换为pdf,请求参数如下:

{
“async”: false,
“filetype”: “docx”,
“outputtype”: “pdf”,
“key”: “1136dab89e9ed71fcdbf”, # 通过前端预览s
“url”: “http://my-host-server/document/files/2c8cb759-80c5-4610-96c1-67f4171bc97d.docx” # 通过nginx暴露路径访问
}

请问是哪里配置不对或使用不当吗?请告知,感谢!

I‘m using 7.2 version docker Onlyoffice on Linux.

There occurred a error when I using postman take a post request to http://documentServer/ConvertService.ashx

The errorCode is -3, I cant convert a word to pdf use the example on your official website.

Here‘s my parameter:
curl --location --request POST ‘http://my-server/ConvertService.ashx’ --header ‘Content-Type: application/json’ --data-raw ‘{“async”: true, “filetype”: “doc”, “key”: “1a603ae9763258d89deb”, “outputtype”: “pdf”, “url”: “http://my-url/document/files/14e7f86f-770f-4817-a5da-8cdca58ad751.doc”}’

Here’s the err.log
[2023-06-02T08:48:01.786] [ERROR] [localhost] [conv_c76d901baa6e6f89c3e1_pdf] [userId] nodeJS - ExitCode (code=80;signal=null;error:-80)
[2023-06-02T08:55:27.027] [WARN] [localhost] [docId] [userId] nodeJS - update cluster with 1 workers
[2023-06-02T08:55:27.042] [WARN] [localhost] [docId] [userId] nodeJS - worker 782748 started.
[2023-06-02T08:55:27.046] [WARN] [localhost] [docId] [userId] nodeJS - update cluster with 1 workers
[2023-06-02T08:57:50.217] [ERROR] [localhost] [conv_1a603ae9763258d89deb_pdf] [userId] nodeJS - stdout:
[2023-06-02T08:57:50.219] [ERROR] [localhost] [conv_1a603ae9763258d89deb_pdf] [userId] nodeJS - stderr:TypeError: Cannot read property ‘length’ of null
at a.zKe (:17356:295)
at b.WN (:17363:294)
at Object.WN (:13573:435)
at a.Ov (:13728:470)
at ue.Jtf (:20434:328)
at ue.Wf (:20434:126)
at qf.wo (:21666:229)
at Xe.l3c (:22272:119)
at Xe.wo (:22233:483)
at qf.wo (:21666:381)
Uncaught TypeError: Cannot read property ‘length’ of null
DoctRenderer:

Please help me!!!

Hello @Kamigawa
Does the issue reproduce with any file? Please provide us with test file, we will check it out. Additionally, please check out that Document server can get file from specified url. For example, copy and paste url to the file to browser tab to check out, if download starts.

The url to the file is working, I can download it from the browser. But I cant convert it to pdf from the server, test file is a normal docx file.
https://gitee.com/kamigaw/test-file/blob/master/test.docx

It seems that you use some sort of authorization to get this file. I’m not able to get the file by this link ( 你的访问受限!)
Please keep in mind, that Document server should have the ability to get a file without any authorization.

Sorry about that, this website like github but needs login. My actual usage is in an intranet, so I cant provide the real file. But that file which I need to convert is a normal docx file. And I can download it through url.

Hello @Kamigawa

Is Document Server located in this network and can reach the file?
You can check this by trying to download the file with your link on the machine where Document Server is installed. For example, on Linux based OS you can use wget <link> to check that.

Also, in test purposes download your file locally on your PC and try to convert it here:
https://www.onlyoffice.com/online-document-converter.aspx

Thank you for your help!