How to manage footer while converting html to docx file using libreoffice command? - libreoffice

I am trying to covert my html template to docx and pdf file.I want to add fix footer for all pages. I am using libreoffice command for it.
sudo -u ${user} libreoffice --headless --convert-to docx:"MS Word 2007 XML" ${htmlfilePath} --outdir ${destinationPath}
Thank you

Related

Convert dvi to odt filetype

Is there a software or a linux command to convert .dvi filetype to a .odt filetype? As I understand, the .dvi file is a machine readable file format which is used to render a document.
I am using MXLinux 5.16.0.

How to generate HTML from a lcov file on Windows via WSL?

I am using Flutter to generate the lcov file and now I want to use WSL to generate the HTML file for reading the data. How can I achieve this?
First of all, after generating the lcov.info files on windows you must replace all \ characters for / because linux can't understand the backslashes.
Then you can simply invoke the linux command for lcov generation through any windows terminal via:
wsl genhtml coverage/lcov.info -o coverage/output/
You invoke this command inside the project you are working on.
The first parameter coverage/lcov.info is the path for the lcov file.
The second parameter -o coverage/output/ is the output folder where the html files will be placed.

Can I convert markdown file to emacs org file?

I can use org-md-export-to-markdown, make md to org.
but I want to convert markdown file to emacs org file, any tools ?
Here's the Pandoc command to convert from the command line:
pandoc -f markdown -t org -o newfile.org original-file.markdown
From This question on the Emacs Stack Exchange.

Libreoffice only convert from odt to pdf, not other formats [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 months ago.
The community reviewed whether to reopen this question 6 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
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 commands
libreoffice --headless --convert-to pdf test.html [Not working]
libreoffice --headless --convert-to odt test.html [Not working]
libreoffice --headless --convert-to pdf test.docx [Not working]
libreoffice --headless --convert-to pdf test.odt [Working]
Try closing all running instances of LibreOffice before executing the command. This was the root cause of my pain.
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.
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.
The following works
libreoffice --invisible -convert-to pdf myFile.html
libreoffice --invisible -convert-to docx myFile.odt
The option --invisible does not start up the GUI but gives some clues on the command line what is happening.
Tested on Linux Mint 13.
This worked for me on LibreOffice 4.2 / Linux:
soffice --headless --convert-to txt:Text /path_to/document_to_convert.odt
Credit: http://ask.libreoffice.org/en/question/14130/how-do-i-install-filters-for-the-soffice-command/
For me. The problem I had was that --headless does not work, AT ALL (just returns in 15 milli-seconds), if a local libreoffice process already has the document open.
Make sure you only do headless operations on a document that is NOT already open in LibreOffice.
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
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.
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)
I had to install the xvfb package (yum install xorg-x11-server-Xvfb), it is the xserver dummy.

Headless duck not quacking on MacOS

I'm trying to convert an ODT file to a PDF file with the following command:
/Applications/LibreOffice.app/Contents/MacOS/soffice.bin \
--headless --convert-to pdf file.odt
LibreOffice comes up momentarily and... that's it. file.odt exists and is readable. The current directory is writable. I was expecting file.pdf to be created but nope, nothing.
Any hints on how I might debug it?
Turns out, you cannot run LibreOffice headless if you are already running it... uh, "headful". Or you can, but it doesn't do anything.
Or as some might say, the duck won't quack.