通过 headless-wps 把 doc 转成 pdf,再通过上传 base64 解决了 word 转 pdf,字体和样式都没有问题。
但 pdf 文件是通过 onlyoffice 预览的,没有办法直接打印,只能先下载再打印。有没有办法通过浏览器直接打开呢?
请问 headless-wps 的具体使用方法是怎样的,我研究了一天没搞懂,有使用手册或者参考资料么,谢谢
借助 GPT 学习了一下项目文件,可以正常使用了,不过我遇到了字体不一致的问题,手动向镜像中添加了字体,目前可以正常用。
请问 headless-wps 的具体使用方法是怎样的,我研究了一天没搞懂,有使用手册或者参考资料么,谢谢
我的做法是写一个 js 脚本监听
const http = require('http');
const { exec } = require('child_process');
var URL = require('url');const hostname = '192.168.1.230';
const port = 3000;const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World');var arg = URL.parse(req.url).query; //方法一 arg => aa=001&bb=002
var arg = URL.parse(req.url, true).query; //方法二 arg => { aa: '001', bb: '002' }
console.log(arg.aaa);//返回 001console.log('C:\Users\XCADEY\Downloads\Chrome\Chrome\chrome.exe --new-window ' + encodeURI('http://192.168.1.229:8080/#/shipping/') + encodeURI(arg.aaa));//返回 001
exec('C:\Users\XCADEY\Downloads\Chrome\Chrome\chrome.exe --new-window ' + encodeURI('http://192.168.1.229:8080/#/shipping/') + encodeURI(arg.aaa), (err, stdout, stderr) => {
if(err) {''
console.log(err);
return;
}
console.log(stdout: ${stdout});
console.log(stderr: ${stderr});
})});
server.listen(port, hostname, () => {
console.log(Server running at http://${hostname}:${port}/);
});
感谢!好像只能用这个办法了 👍
我的做法是写一个 js 脚本监听
const http = require('http');
const { exec } = require('child_process');
var URL = require('url');
const hostname = '192.168.1.230';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World');
var arg = URL.parse(req.url).query; //方法一 arg => aa=001&bb=002
var arg = URL.parse(req.url, true).query; //方法二 arg => { aa: '001', bb: '002' }
console.log(arg.aaa);//返回 001
console.log('C:\Users\XCADEY\Downloads\Chrome\Chrome\chrome.exe --new-window ' + encodeURI('http://192.168.1.229:8080/#/shipping/') + encodeURI(arg.aaa));//返回 001
exec('C:\Users\XCADEY\Downloads\Chrome\Chrome\chrome.exe --new-window ' + encodeURI('http://192.168.1.229:8080/#/shipping/') + encodeURI(arg.aaa), (err, stdout, stderr) => {
if(err) {''
console.log(err);
return;
}
console.log(stdout: ${stdout});
console.log(stderr: ${stderr});
})
});
server.listen(port, hostname, () => {
console.log(Server running at http://${hostname}:${port}/);
});