tar -cvf output.tar --transform='s,.*/,,' ./path/to/file/file1.txt ./file2.pdf ..
use this transform flag with the following value to remove the leading directories inside the result tar:
./path/to/file/file1.txt
./file2.pdf
---->
file1.txt
file2.pdf