Sha*_*non 3 pdf headless libreoffice
当我使用具有以下内容的html文档(' SimplePage.html ')时
<!DOCTYPE html>
<html>
<title>Page Title</title>
<body>
This is just a simple Hello World
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Libreoffice(在Windows 7上为LibreOffice_5.1.2)会生成一个pdf文件,该文件的第一页为空白,然后不写全文-而是仅显示“ 一个简单的Hello World ”
我正在使用以下命令行
soffice.exe --headless --convert-to pdf SimplePage.html
Run Code Online (Sandbox Code Playgroud)
当我不是在无头模式下进行转换时(打开Libreoffice writer并使用“导出”,则生成的pdf是正确的。因此,我认为使用的HTML并不是问题。有人知道这个问题的原因和解决方案吗?
小智 5
您应该尝试扭转:
soffice.exe --headless --norestore --writer --convert-to pdf YOURFILE
Run Code Online (Sandbox Code Playgroud)
它对我有用,重点是添加 --writer option