pdfattach
Embed files into a PDF document
TLDR
Add a new attachment to an existing PDF file
Replace attachment with same name if it exists
Display help
Display version
SYNOPSIS
pdfattach [options] PDF-file
PARAMETERS
-create
Creates a new PDF and attaches the specified file.
-list
Lists the attachments in the PDF file.
-save
Saves the specified attachment to a file.
-saveall
Saves all attachments to files.
-delete
Deletes the named attachments from the PDF file.
-o
Overwrite output file if it exists. Requires ghostscript installed.
-enc
Set the encoding to use for text files. Defaults to UTF-8.
-owner-password
Specify the owner password to the PDF file.
-upw
Specify the owner password to the PDF file.
-user-password
Specify the user password to the PDF file.
-pwd
Specify the user password to the PDF file.
-v
Print copyright and version information.
-h
Print usage information.
-help
Print usage information.
-?
Print usage information.
DESCRIPTION
The pdfattach
command is a utility included in the Poppler PDF rendering library. It allows you to embed files (any file type) directly into a PDF document. This can be useful for bundling supplementary materials like spreadsheets, documents, images, or other related resources along with the main PDF.
The command essentially adds these files as attachments that can be accessed and extracted by PDF viewers that support the attachment feature.
The process is achieved by taking an existing PDF file and modifying it to include the specified attachments. It's a common tool for creating self-contained documents that provide a single point of access for related resources, simplifying distribution and organization. Note that the tool does not provide editing abilities.
CAVEATS
Not all PDF viewers support embedded files or handle them in the same way. Testing the generated PDF with various viewers is recommended. The tool modifies the original file in place unless saving the attachements. Make sure to back up important PDFs before modifying them using pdfattach
.
RETURN CODES
pdfattach
returns an exit code of 0 if the command was successful. An exit code greater than zero indicates an error.
EXAMPLES
- List attachments:
pdfattach -list mydocument.pdf
- Attach a file:
pdfattach -create data.csv mydocument.pdf
- Save a specific attachment:
pdfattach -save attachment_name mydocument.pdf
HISTORY
pdfattach
is part of the Poppler library, a free software utility library for rendering Portable Document Format (PDF) documents. Poppler was initially based on Xpdf, but has since become an independent project. The development was driven by the need for a robust, open-source PDF rendering and manipulation solution. pdfattach
usage has grown along with the increasing popularity of PDF as a standard document format, especially for bundling related resources in a single, easily distributable file.
SEE ALSO
pdftk(1), pdfseparate(1), pdfunite(1), pdfinfo(1)