Linux command line LibreOffice headless first page is blank (only white)

I use linux

the command libreoffice --headless --convert-to pdf "/path/to/document.txt"

usually, it’s all good, but certain documents gets the first page blank

here a sample of the original file

is there an option in the linux command line I can add to prevent this blank page ?

it starts like this

<?xml version="1.0" encoding="utf-8"?>
<!-- Mit XMLSpy v2015 sp2 (x64) ( von Thomas Liebich (AEC3 Deutschland GmbH) bearbeitet -->
<xs:schema xmlns:mvd="" xmlns:xs="" targetNamespace="" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.1.d strict">

A naive question: why do you want to convert a .txt file to PDF? There is no formatting in a plain text file, therefore no risk of missing font, faulty page layout, etc.

By loading your text file into Writer, you implicitly create formatting and layout through the default template, at least with Default Paragraph Style and Default Page Style. The resulting PDF file is bigger than the .txt version. If your goal is to send the file in such a way it can’t be modified (and there are many workarounds to circumvent this for such a simple file), there are certainly better methods.

It’s not about formatting.

I’m building a web platform where users can have a multimedia library, I want a jpg preview of any kind of files they upload… I can convert more than 700+ file types using a combination of ffmpeg, cvlc, ImagMagick, xnconvert, gm, python, assimp, libreoffice, fontforge, etc…

In this web platform, I also add email management, so having a preview of attached files is just nicer…

It’s libreoffice (rarerly but it happens from time to time) that can generate the first page blank.

I just want a way to prevent the first blank page