Code Monkey home page Code Monkey logo

xfdf-merger's Introduction

XFDF annotation merging tool

Summary

This repository contains an experimental command-line tool to merge XFDF annotations into a PDF document. It's specifically geared towards annotations used for document review and errata processing.

The merge tool will process annotations of the following types:

  • Caret
  • Text
  • Highlight
  • Squiggly
  • Underline
  • StrikeOut
  • Stamp
  • FreeText

The positioning of the annotations in the final document can be manipulated to a degree. Concretely, the tool supports

  • shifting the page numbers to which the annotations are applied;
  • scaling the annotations' coordinates by a constant factor;
  • translating the annotations' coordinates by a constant vector.

Building

The project builds with Maven. After cloning, run the following command:

mvn package

If the build finishes successfully, the target folder should contain two .jar files: xfdf-merge-<VERSION>.jar and xfdf-merge-<VERSION>-jar-with-dependencies.jar. Both are executable JAR files, but the latter includes all relevant dependencies.

Usage

After building, the merge tool can be invoked as follows:

./xfdfmerge.sh input.pdf input.xfdf output.pdf [transform]

Alternatively:

java -jar target/xfdf-merge-<VERSION>-jar-with-dependencies.jar input.pdf input.xfdf output.pdf [transform]

Parameters:

  • input.pdf: the input PDF document;
  • input.xfdf: the XFDF document containing the annotations to apply;
  • output.pdf: the output PDF document (will be overwritten);
  • transform: an optional transformation string (see below).

The optional transformation string takes the form PGNUMSHIFT/XSHIFT/YSHIFT/SCALE. If a transformation string is supplied, all parts must be present. They are processed as follows:

  • PGNUMSHIFT: constant integer added to the page numbers in the XFDF file before applying annotations;
  • XSHIFT,YSHIFT,SCALE: geometric transformation parameters applied to annotations before rendering.

More precisely, the following affine transformation is applied to all annotation coordinates: (x, y) -> (SCALE * x + XSHIFT, SCALE * y + YSHIFT). In other words, the effective default value of transform is 0/0/0/1.

Disclaimer

This is an experimental tool, not an iText product. It is provided to the community under the terms of the AGPL (see LICENSE) on an as-is basis.

Versioning

Pursuant to the disclaimer in the previous section, there are no stability guarantees between different versions or builds. However, since the release script ensures that the build date is always embedded into the build version number, you can always tell which build is the most recent.

xfdf-merger's People

Contributors

matthiasvalvekens avatar michaeldemey avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.