• Common Slider

    Common Slider

    Qoppa Software offers a suite of carefully designed and developed products to cover every aspect of PDF processes and document workflows.

PDF Processing API with Mule ESB and Mulesoft Anypoint

PDF Processing API Now Integrated with Mulesoft

New!! PDF Automation Server Rest API is now available in the Muesloft Exchange as a Mulesoft Asset on the AnyPoint Platform and can be downloaded as RAML or as Mule 4 Connector. It allows to access all of Qoppa’s PDF processing features including: Sign PDF, Merge PDF, Split PDF, Import Date into PDF, OCR PDF, Convert PDF to Images, Redact PDF, Optimize PDF, Watermark PDF, etc…
See PDF API on Mulesoft Anypoint Exchange

Using Qoppa’s Java PDF Library with Mule

The instructions below are useful to create your own Mule flow using Qoppa’s Java PDF libraries and jar files.

What is Mule?

Mule is a lightweight Enterprise Service Bus (ESB) platform that allows you to create a “pluggable” architecture for IT processes.

You can easily create complex “flows” using pre-packaged and external building blocks that define your business logic.  The Plain Old Java Object (POJO) example below shows how easy it is to set up Qoppa’s Java PDF Libraries as building blocks in your flows.

Install and set up Mule

  1. Download and install Mule Studio
  2. Download and extract Maven
    1. Set up environment variables for Maven
    2. On Windows, our user variables look like this:
      1-envpaths
  3. In Mule Studio, go to Window > Preferences > Mule Studio > Maven Settings
    1. Enable Maven support in Mule Studio, and
    2. Set the Maven Installation home directory to where you extracted Maven

 

Example using jPDFProcess

We will define a simple flow to demonstrate the capabilities of the PDF to TIFF Transformer:
This POJO (plain old java object) example extends AbstractMessageTransformer and converts a PDF document to a TIFF image in the overridden transformMessage method.

Setting up the project

  1. In Mule Studio, Create a new Mule project: File > New > Mule Project
  2. Name the project, then accept the default values on the remaining screens2-newproject
  3. Create a “lib” folder in the project
    1. Right click on the project name in the Package pane on the left, New > Folder
  4. Download and add the example jar files to the new lib folder
    1. jPDFProcess.jar
    2. jai_imageio.jar
    3. jai_codec.jar
  5. Add the libraries to the project’s Java Build Path
    1. Right click project name > Properties > Java Build Path > Libraries > Add JARs6-jarsinlib
  6. Create a new package for the project
    1. Right click src/main/java > New > Package
      7-newpkg
  7. Add a class to the new package
    1. Right click the package name > New > Class
    2. You can name it anything – the next step will overwrite it
  8. Replace the contents of the new class with PDFToTIFF.java and save the class

Deploy Locally for Testing

Mule provides a number of endpoints which can be used for input and output as well as transformers that can modify those inputs (or “messages”).  This flow uses a file end point to watch a folder.  When a .pdf file is added to the folder, it is transmitted as an input stream to our Java component.  jPDFProcess then converts the PDF document to a TIFF image and writes the TIFF image to a byte array.  This is transmitted to the flow’s file endpoint which writes the TIFF file to the specified directory as out.tiff.

  1. Paste the example XML into jPDFProcess for Mule.mflow
    1. Click on jPDFProcess for Mule.mflow in the left pane and go to the Configuration XML tab
    2. Paste the example XML into the window, create the input and output paths on your computer, and save the flow
      8-flowxml
    3. Switch to the Message Flow tab and review the flow. Flows can be customized with different inputs and outputs, depending on the project’s needs9-flow
  2. Run jPDFProcess for Mule.mflow
    1. Right click the flow > Run As > Mule Application
  3. Monitor the console – once you see the “Started” message, you can test the application.
    1. Wait for the console to output “Started app ‘jpdfprocess_for_mule'”10-console
    2. Drop a PDF into the “input” folder and it will be processed and moved to the “output” folder as out.tiff