Effortlessly Merge Signed PDF Payslips on Linux Without Bloating File Size
As an employer, managing your employees' payslips can be a challenge, particularly when you have multiple digitally signed PDF payslips for each employee. In such cases, merging all the signed payslips into a single document can save you time and energy. This article will guide you through merging signed PDF payslips on Linux while retaining the signatures and keeping the file size minimal.
Tools Required
To merge PDF files in Linux, you can use the pdfunite command-line utility. This tool comes pre-installed on many Linux distributions, such as Ubuntu. To install it on other distributions, use your package manager. For instance, on Fedora:
sudo dnf install pdftk
Alternatively, you can use pdfjoin or pdftools.
Merging PDF Files with pdfunite
To merge PDF files using pdfunite, follow these steps:
pdfunite input1.pdf input2.pdf output.pdf
Replace input1.pdf and input2.pdf with the payslip filenames and output.pdf with the desired name for the merged file. You can add more payslips by continuing the pattern:
pdfunite input1.pdf input2.pdf input3.pdf ... output.pdf
Preserving Signatures
Unfortunately, directly merging signed PDFs may result in lost signatures due to the nature of digital signatures. To retain digital signatures, use the following method:
Concatenate the files using
pdfuniteas shown above, without the signed payslip files.Import the signed payslips as attachments using a tool such as
pdfmodorxournalpp.
Reducing File Size
After merging all payslips, the file size may be larger than expected due to embedded fonts or other redundant information. To optimize the file size, use a utility like pdfopt:
pdfopt output.pdf optimized_output.pdf
Or use a popular command-line tool such as gs (Ghostscript) to further reduce the file size:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dEmbedAllFonts=true -o optimized_output.pdf input.pdf
- Merge unsigned payslips with
pdfuniteor similar. - Import signed payslips using a tool like
pdfmodorxournalpp. - Optimize file size using
pdfoptorgs(Ghostscript).
References
-
Books: none.
-
Articles: