Libreoffice convert-to not working

前端 未结 10 546
孤城傲影
孤城傲影 2020-12-09 17:13

I\'m trying to convert documents from html,txt to pdf,odt and vice versa.. But only odt to pdf seems to work.. No other file formats are converted

Here are my comman

相关标签:
10条回答
  • 2020-12-09 17:28

    I had to install the xvfb package (yum install xorg-x11-server-Xvfb), it is the xserver dummy.

    0 讨论(0)
  • 2020-12-09 17:30

    On Windows I encountered the following problem: I tried to convert all DOC files to PDF using the following command:

    soffice --invisible --convert-to pdf *.doc
    

    It failed without any error message. But it worked when I put a filename of one of the files instead of *.doc. So apparently it was a problem with resolving wildcard in *.doc. What I did is execute exactly the same command as above but from Git Bash instead of normal command prompt (cmd.exe). It worked. What is more: in Git Bash it displayed progress information and informative messages!

    So my advice is: if you're running soffice.exe on Windows and don't get any output, run the command from Git Bash (you can get Git Bash by installing Git for Windows)

    0 讨论(0)
  • 2020-12-09 17:32

    This is a known issue in LibreOffice that was fixed in version 5.3.0. Before this fix when an instance of LibreOffice is running --convert-to or any other command would silently terminate without doing anything.

    If your version is older than that you could consider the solution suggested by Frank Yin here. That is close all open LibreOffice documents before running the conversion.

    If you cannot close all open LibreOffice documents to run the conversion, or if you find it inconvenient, you could try a solution suggested in the comments to the original bug.

    If you have LibreOffice version before 4.5 run

    soffice -env:UserInstallation=file:///$HOME/.libreoffice-headless/ \
    --headless --convert-to pdf test.docx
    

    If you are running LibreOffice version between 4.5 and 5.3 run

    soffice -env:UserInstallation=file:///$HOME/.libreoffice-headless/ \
    --convert-to pdf test.docx
    

    Here $HOME/.libreoffice-headless is a new profile directory different from your main LibreOffice profile.

    0 讨论(0)
  • 2020-12-09 17:32

    For me, the following two packages were the minimum needed to get headless docx to pdf conversion working on CentOS 7 :

    yum install libreoffice-headless  libreoffice-writer
    
    0 讨论(0)
  • 2020-12-09 17:35

    The real problem is that the libreoffice/soffice command line doesn't provide any error message or debugging information, so it's all guesswork. If you are up to it, then try strace for hints.

    In my case (Linux), I didn't have the correct packages installed - for example, to convert spreadsheets, libreoffice-calc is needed (duh), and also libreoffice-headless (double-duh). But the command line won't tell you that - it just hangs, or runs and doesn't do anything.

    0 讨论(0)
  • 2020-12-09 17:36

    One of the problems that I encountered with libreoffice was the problem with empty spaces. After I slugged the name ("test-document.docx" instead of test "documnet.docx") it worked perfectly. From version 4.2.8.2 - 5.3.

    0 讨论(0)
提交回复
热议问题