Mcpdf fixes PDFtk's unicode issues, so you can write Łódź into your forms. Mcpdf aims to become a drop-in replacement for PDFtk.
It is essentially a command line interface to the iText PDF library with a PDFtk compatible syntax.
Make sure you have installed a Java Runtime Environment such as OpenJDK.
Download the latest standalone version of Mcpdf (jar-with-dependencies).
For the sake of brevity, we will refer to this file as
mcpdf.jar. So you should either rename the file or create a symlink:
ln -s mcpdf-0.2.4-jar-with-dependencies.jar mcpdf.jar
Test it via:
java -jar mcpdf.jar
The goal of Mcpdf is to become a drop-in replacement for PDFtk, so you could take any working PDFtk command and replace
java -jar mcpdf.jar. That's all there is to it.
Note that not all PDFtk operations are implemented at the moment. Just the following subset is supported.
Please create an issue tracker entry if you see something missing that you need. Don't forget to provide the exact PDFtk command that you would like to see in Mcpdf.
Fill in form data
Fill in form data from
FORM.pdf and write the result to
java -jar mcpdf.jar FORM.pdf fill_form - output - < DATA.xfdf > OUTPUT.pdf
Fill in form data and flatten the document to prevent further editing:
java -jar mcpdf.jar FORM.pdf fill_form - output - flatten < DATA.xfdf > OUTPUT.pdf
Add stamp and/or background
BACKGROUND.pdf as a background for
INPUT.pdf and output to
java -jar mcpdf.jar INPUT.pdf background BACKGROUND.pdf output - > OUTPUT.pdf
Similarly, you can use the stamp functionality to add
STAMP.pdf as a stamp (i.e. foreground) for
INPUT.pdf and output into
OUTPUT.pdf. This works just like background, except that it places
STAMP.pdf in front of
INPUT.pdf instead of behind it:
java -jar mcpdf.jar INPUT.pdf stamp STAMP.pdf output - > OUTPUT.pdf
Combine with Another Library Version
Download the plain JAR file (
mcpdf-0.2.4.jar) instead of the jar-with-dependencies.
Download the version of the iText PDF library you want to use (
Run both in combination:
java -cp itextpdf-X.Y.Z.jar:mcpdf-0.2.4.jar aero.m_click.mcpdf.Main
Build from Source
Download the latest Mcpdf source and change into that folder:
git clone https://github.com/m-click/mcpdf.git cd mcpdf
Build the plain JAR file as well as the jar-with-dependencies:
This will download the correct version of the iText PDF library and all required Maven modules automatically.
You will find the JAR files in the
<settings> <servers> <server> <id>sonatype-nexus-snapshots</id> <username>...</username> <password>...</password> </server> <server> <id>sonatype-nexus-staging</id> <username>...</username> <password>...</password> </server> </servers> </settings>
VERSION=`sed -n 's/^ <version>\([^-]*\).*/\1/p' pom.xml` sed -i "s,mcpdf\([-/]\)[0-9.]*[0-9],mcpdf\1$VERSION,g" README.md git commit -m "Prepare documentation for release mcpdf-$VERSION" README.md
Create a new release and upload it to the OSSRH staging area:
mvn release:clean release:prepare release:perform
[Follow the OSSRH release instructions](http://central.sonatype.org/pages/releasing-the-deployment.html][Follow the OSSRH release instructions), that is:
- Open https://oss.sonatype.org/
- Select topmost item
Refresha few times
- Watch it appear at the Central Repository
Push to GitHub: