Search code examples
pdflibreofficeheadless

Libreoffice converting HTML to PDF on command line produces empty page


When I am using a html document ('SimplePage.html') with the following content

<!DOCTYPE html> 
<html>
  <title>Page Title</title>
  <body>
    This is just a simple Hello World
  </body>
</html>

Libreoffice (LibreOffice_5.1.2 on Windows 7) produces an pdf having the first page blank and then writing not the full text - instead only "a simple Hello World" is shown

I am using the following command line

soffice.exe --headless --convert-to pdf SimplePage.html

When I do the conversion not in headless mode (opening Libreoffice writer and the using "Export" the generated pdf is correct. Therefore I think it's not a problem of the used HTML. Does anyone know the reason and a solution to this problem?


Solution

  • You should try writhing this:

    soffice.exe --headless --norestore --writer --convert-to pdf YOURFILE
    

    it worked for me, the point was to add --writer option