Credit: Rob Schultz/IDG There are a number of ways that you can create PDFs on a Linux system. You can use an application like LibreOffice or OpenOffice, or you can take advantage of any of a number of commands that can generate PDFs from text files or from a group of other file formats. There are also a number of ways that you can merge a group of PDFs into a single PDF file. Why PDFs? PDF is often the preferred format for files that you need to share with others or archive. This is because PDF is an open file format, which makes sharing these files between diverse systems and devices possible. Using LibreOffice or OpenOffice Both LibreOffice and OpenOffice can export files as PDFs. You can open an existing document or create a new document and export it as a PDF. OpenOffice’s Export as PDF… and LibreOffice’s Export As => Export as PDF… will do what is required to convert your file. Generating PDFs from text files There are also a number of ways that you can create PDFs from text files. The commands below convert a text file to Postscript using vim and then turn the Postscript file into a PDF. $ vim testfile.txt -c "hardcopy > testfile.ps | q" $ ps2pdf testfile.ps The resulting files might look something like these: $ ls -l testfile* -rw-rw-r-- 1 shs shs 7928 Feb 24 12:46 testfile.pdf -rw-rw-r-- 1 shs shs 5864 Feb 24 12:45 testfile.ps -rw-rw-r-- 1 shs shs 60 Feb 23 17:26 testfile.txt Generating PDFs from html Another option for generating PDFs is to convert html files. You can open an html file in either LibreOffice or OpenOffice and then export it as a PDF. After opening an html file in OpenOffice, select File and, under that, Export… and select PDF with the Save as type: option to generate the PDF file. After opening an html file in LibreOffice, save it in PDF format by using the Export As and Export as PDF… options. Joining PDFs into a single file One of the easiest ways to join a number of PDFs into a single file is to use the pdftk command. You can read more about using this command on an Ubuntu system at linuxhint.com. A pdftk command to join a number of PDFs into a single file might look like this: $ pdftk recipe-1.pdf recipe-2.pdf recipe-3.pdf recipe-4.pdf recipe-5.pdf cat output recipes.pdf You can use a wildcard if your files follow a regular pattern like this: $ pdftk recipe-*.pdf cat output recipes.pdf pdfunite Another command that works like pdftl that you can use is the pdfunite tool. As with pdftk, you can either list all of the files on your command line or using a wildcard if the file names follow a reliable pattern. $ pdfunite recipe-1.pdf recipe-2.pdf recipe-3.pdf recipe-4.pdf recipe-5.pdf cat output recipes.pdf $ pdfunite recipe-*.pdf recipes.pdf Wrap-up Using a word processor application on your Linux system or any of a number of commands, some of which you might have to install, you can easily work with, create or merge PDF files. Related content how-to How to find files on Linux There are many options you can use to find files on Linux, including searching by file name (or partial name), age, owner, group, size, type and inode number. By Sandra Henry Stocker Jun 24, 2024 8 mins Linux opinion Linux in your car: Red Hat’s milestone collaboration with exida With contributions from Red Hat and critical collaborators, the safety and security of automotive vehicles has reached a new level of reliability. By Sandra Henry Stocker Jun 17, 2024 5 mins Linux how-to How to print from the Linux command line: double-sided, landscape and more There's a lot more to printing from the Linux command line than the lp command. Check out some of the many available options. By Sandra Henry Stocker Jun 11, 2024 6 mins Linux how-to Converting between uppercase and lowercase on the Linux command line Converting text between uppercase and lowercase can be very tedious, especially when you want to avoid inadvertent misspellings. Fortunately, Linux provides a handful of commands that can make the job very easy. By Sandra Henry Stocker Jun 07, 2024 5 mins Linux PODCASTS VIDEOS RESOURCES EVENTS NEWSLETTERS Newsletter Promo Module Test Description for newsletter promo module. Please enter a valid email address Subscribe