Create a single pdf from multiple text, images or pdf files

If you're willing to use a terminal, you can use ImageMagick. Install it with

sudo apt install imagemagick

then you can do:

convert image1.jpg image2.png text.txt PDFfile.pdf outputFileName.pdf

It worked for me, but the problem is it converts the text.txt file into an image, so you can't highlight the text in the resulting pdf.


Install pdftk

sudo apt-get install pdftk

Pdftk

If PDF is electronic paper, then pdftk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. Pdftk is a simple tool for doing everyday things with PDF documents.

You can create pdf files from text or images with Libre Office then to stitch these togeter with other pdf files

pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf

It can also

  • Split PDF Pages into a New Document

  • Rotate PDF Pages or Documents

and a lot more besides

More details here: Ubuntu Geek: List of PDF Editing tools


Try PDF Chain:

PDF Chain is a graphical user interface for the PDF Toolkit (PDFtk). The GUI supports all common features of the command line tool in a comfortable way.

enter image description here

You can install it either from the default repos, or get the latest and greatest from PDF Chain PPA.

sudo apt-get install pdfchain

Or PDF Mod:

PDF Mod is a simple application for modifying PDF documents.

You can reorder, rotate, and remove pages, export images from a document, edit the title, subject, author, and keywords, and combine documents via drag and drop.

sudo apt-get install pdfmod

enter image description here


See also:

  • How to copy from a pdf to another pdf in ubuntu/linux

For multiple files inside a directory and its subdirectories with different extensions I couldn't find a neat answer, so here it is

convert -quality 85 `find -type f -name '*.png' -or -name '*.jpg' | sort -V` output.pdf

I used command substitution to pass the selected items returned by find command as an argument to convert command. Unfortunately sort -n didn't sort my files correctly so I tried -V option and it did the trick. Also make sure the name of your files and directories are in natural sort order in advance. For example dir1, dir2, dir3 not dir1, dir_2, dir3.