How to convert multiple .odt files to a PDF file plus merging them

To create a single PDF from multiple LibreOffice Writer documents in Ubuntu 22.04, you can use the command line tool “libreoffice” to convert the documents.

Open the terminal in Ubuntu(Ctrl+alt+t) . Navigate to the directory where the documents are located using the “cd” command.

Use the following command to convert all .odt files in the directory to .pdf:

libreoffice --headless --convert-to pdf *.odt

This will convert all .odt files in the directory to .pdf and save them in the same directory. Alternatively, you can also use the command-line tool “unoconv” to convert the documents.

unoconv -f pdf *.odt

In order to merge all PDFs into one, you can use the command “gs” (Ghostscript)

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=merged.pdf file1.pdf file2.pdf ...

Please note that this command will overwrite the file merged.pdf if it already exists, so make sure to use a different file name if necessary.

To merge the multiple PDFs created by the command “libreoffice —headless —convert-to pdf *.odt” into a single PDF, you can use the command line tool “pdfunite” which is part of the “poppler-utils” package.

Open the terminal in Ubuntu.

Navigate to the directory where the PDFs are located using the “cd” command.

Use the following command to merge all PDFs in the directory into a single file:

pdfunite file1.pdf file2.pdf file3.pdf ... merged.pdf

This command will take all the pdf files in the directory and merge them into a single pdf file named “merged.pdf” Alternatively, you can also use the command-line tool “gs” (Ghostscript)

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=merged.pdf file1.pdf file2.pdf ...

Please note that this command will overwrite the file merged.pdf if it already exists, so make sure to use a different file name if necessary.

Additionally, you can also use other tools like pdftk, qpdf, pdfjam to merge multiple pdfs into one.