Skip to content
/ mcpdf Public
forked from m-click/mcpdf

Mcpdf is a drop-in replacement for PDFtk. It fixes PDFtk's unicode issues when filling in PDF forms, and is essentially a command line interface for the iText PDF library with a PDFtk compatible syntax.

Notifications You must be signed in to change notification settings

tspr/mcpdf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Mcpdf

Mcpdf is a drop-in replacement for PDFtk.

It fixes PDFtk’s unicode issues when filling in PDF forms, and is essentially a command line interface to the iText PDF library with a PDFtk compatible syntax.

Getting Started

  1. Make sure you have installed a Java Runtime Environment such as OpenJDK.
  2. Download the latest standalone version of Mcpdf (jar-with-dependencies).
  3. For the sake of brevity, we’ll refer to this file as mcpdf.jar. So you should either rename the file or create a symlink:
    ln -s mcpdf-0.2.3-jar-with-dependencies.jar mcpdf.jar
        
  4. Test it via:
    java -jar mcpdf.jar
        

Usage

Mcpdf is a drop-in replacement for PDFtk. Take a working PDFtk command and replace pdftk with java -jar mcpdf.jar. That’s all there is to it.

For example, the following command fills in form data from DATA.xfdf into FORM.pdf and writes the result to RESULT.pdf. It also flattens the document to prevent further editing:

java -jar mcpdf.jar FORM.pdf fill_form - output - flatten < DATA.xfdf > RESULT.pdf

This corresponds exactly to the usual PDFtk command:

pdftk FORM.pdf fill_form - output - flatten < DATA.xfdf > RESULT.pdf

Note that not all PDFtk operations are implemented at the moment.

Please create an issue tracker entry if you see something missing.

Advanced Topics

Combine with Another Library Version

  1. Download the plain JAR file (mcpdf-0.2.3.jar) instead of the jar-with-dependencies.
  2. Download the version of the iText PDF library you want to use (itextpdf-X.Y.Z.jar).
  3. Run both in combination:
    java -cp itextpdf-X.Y.Z.jar:mcpdf-0.2.3.jar aero.m_click.mcpdf.Main
        

Build from Source

  1. Make sure you have installed Maven and Git.
  2. Download the latest Mcpdf source and change into that folder:
    git clone https://github.com/m-click/mcpdf.git
    cd mcpdf
        
  3. Build the plain JAR file as well as the jar-with-dependencies:
    mvn package
        

    This will download the correct version of the iText PDF library and all required Maven modules automatically.

  4. You’ll find the JAR files in the target subfolder.

Deploy Releases

Mcpdf uses the Sonatype OSSRH (OSS Repository Hosting Service). The project creation ticket was OSSRH-8759.

  1. Create ~/.m2/settings.xml:
    <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>
        
  2. Prepare documentation:
    VERSION=`sed -n 's/^  <version>\([^-]*\).*/\1/p' pom.xml`
    sed -i "s,mcpdf\([-/]\)[0-9.]*[0-9],mcpdf\1$VERSION,g" README.org
    git commit -m "Prepare documentation for release mcpdf-$VERSION" README.org
        
  3. Create a new release and upload it to the OSSRH staging area:
    mvn release:clean release:prepare release:perform
        
  4. Follow the OSSRH release instructions, that is:
  5. Push to GitHub:
    git push
        

About

Mcpdf is a drop-in replacement for PDFtk. It fixes PDFtk's unicode issues when filling in PDF forms, and is essentially a command line interface for the iText PDF library with a PDFtk compatible syntax.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%