File conversion

How to create a byte stream to byte stream conversion of docx to pdf in headless mode?The convert to CLI command converts the file to specified format is there any way to capture the byte array of those files before conversion of docx file to pdf file?

I think your question is not at all related with LO database frontend, Base. So, please, retag it accordingly. writer or something else?

Also, reopen your question (click on below it, then on the “pencil” icon) to improve its description.

What do you want to capture? The DOCX binary contents (without its conversion to LO internal format)? I am afraid this is not possible, anyway not in LO. A DOCX is a zip-compressed file containing several folders and files. Consequently either you consider the raw byte stream (and as a compressed stream, it soes not make sense if you want to access contents) or the uncompressed one (but you must then take into account the structure to “selectively” access the various parts, in fact decoding the DOCX format).

Explain your final goal. Mention your OS name and LO version. Depending on your OS there may exist or not utilities to dive into DOCX but I doubt it. The best tool to access a DOCX is M$ Word.

I just basically want to convert docx format to pdf format i’ll be getting a docx as a raw bytestream and i need to convert it as raw pdf byte stream and i don’t want to capture and docx binary contents.Since Iam new to this discussion forum and in using libreoffice as well…So pls don’t get me wrong if i couldn’t clearly ask

Before going to CLI, have you checked in GUI mode on a sample file you get the expected result? Your document will go through a DOCX → ODF conversion first before being exported to PDF. Depending on the formatting technique, artefacts may pop up.

You still didn’t mention your OS name and LO version. I am not versed in LO CLI mode, I can only give general guidelines. But technical information (OS name and LO version) is necessary to suggest the command. I can only hint at Linux since this is my OS.

LO version is 24.2,OS is Ubuntu 20.04

Try something like

soffice --convert-to pdf your_document.docx

If you want to name your output file:

soffice --convert-to pdf your_document.docx --outdir dest_dir filename.pdf


As I already mentioned, I am not versed in CLI. This information was gathered from soffice --help

PDF CLI Parameters
linked from Starting LibreOffice Software With Parameters

There is no way to pass and obtain the document data as byte streams. Only files.

In theory, there is an API to pass the data as an InputStream, and receive as OutputStream. But in reality, I expect that API to be not used much, so might be full of bugs. And that’s not a built-in CLI.

Then , Is there any other way other than using CLI?

I wrote:

Maybe it was unclear. I meant:

  • It is impossible to pass document data as byte streams in command line. Only files.
  • It is impossible to obtain document data as byte streams in command line. Only files.