A CLI tool for Windows and Linux to add a cover page, header and footer to a PDF document.
Report Bug
·
Request Feature
·
Contribute
·
Sponsor project
This is a simple .NET command line (CLI) tool for Windows and Linux which helps adding a cover page, a header and a footer to an existing PDF document.
The tool uses the iText7 library for PDF processing which is licensed under AGPL for non-commercial use. Hence, this tool is also published under the AGPL license.
The command line interface is very simple as shown in the following picture. Here are also a few example command lines.
# Don't forget to make the file executable under Linux, e.g.
sudo chmod +x ./AddPdfEnvelope-linux-x64
./AddPdfEnvelope-linux-x64 --help
./AddPdfEnvelope-linux-x64 -f ../../../Test.pdf -o ../../../Test-result.pdf -y
The content of the added cover page, the header and the footer are configurable via appsettings.json
file. Here is an example:
{
"PdfEnvelope": {
"CoverPage": {
"Topic": "Product Name",
"Subtopic": "Version 2022",
"Title": "Feature Name",
"Subtitle": "Architecture Specification",
"Organization": "Department",
"Version": "Revision 0.1 (for review)",
"Author": "Author: Surname, Given name",
"Date": "Date: {date:dd.MM.yyyy}",
"Disclaimer": "This printed copy is not subject to any change control.",
"ShowSignatureArea": true
},
"PageHeader": {
"TextLeft1": "Product Name, Version 2022",
"TextLeft2": "Architecture Specification",
"TextCenter1": "",
"TextCenter2": "",
"TextRight1": "",
"TextRight2": "Feature Name, Revision 0.1",
"DrawLine": true,
"ExcludeCoverPage": true
},
"PageFooter": {
"TextLeft1": "",
"TextLeft2": "Department",
"TextCenter1": "© My Company {date:yyyy}. All rights reserved.",
"TextCenter2": "Restricted (for internal use only).",
"TextRight1": "",
"TextRight2": "Page {pageNum} of {numOfPages}",
"DrawLine": true,
"ExcludeCoverPage": false
},
"PageNumberOffset": -1,
"RemoveAnnotationsOtherThanLinks": true
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning"
}
}
}
The result looks like that:
- Latest .NET SDK
-
Download the self-contained single-file executables from the releases section
-
Copy it to a location where you can easily call it and rename it as desired (e.g. to
AddPdfEnvelope
) -
Open a command prompt or PowerShell and type
AddPdfEnvelope --help
- Clone the repo
git clone https://github.com/thgossler/AddPdfEnvelope.git
- Build
dotnet build
- Run without arguments to get help
dotnet run
Alternatively, you can open the folder in VS Code or the solution (.sln file) in the Microsoft Visual Studio IDE and press F5.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star 😉 Thanks!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the AGPL License. See LICENSE
for more information.