Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Multipage Tiff extraction

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
As per this thread https://coderanch.com/t/683495/java/framework-build-tools , I've started building my first java program for prod.

I'm using Maven to build it and the first step is to export all the images from a multi page tiff to a single pdf.

One of the biggest headscratches for me is to know what library to choose. If I use the suggestion from my first google hit it's possible I'll start to work on some deprecated library that noone else is using so I wanna try to pick them with care.

After getting the suggestion here in my other thread, and confirming with some googling, PDFBox is my choise for PDF-generation. When it comes to Tiff-processing, JAI looks promising, and I found some example code here: https://pdn.pega.com/community/product-support/question/multi-page-tiff-image-splitting-individual-jpeg-files .

Are these libs alright?
And my second question - how do I go about making a single java file out of this that I can deploy rather than having loads of class-files in there (going to run this from cron every day).
Thanks!
 
Carl Anton
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just found Apache Imaging ( http://commons.apache.org/proper/commons-imaging/formatsupport.html ). Should I prefer this one ?
 
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I cannot really add to this too much, but have you heard about iText?
https://sourceforge.net/projects/itext/files/

Here is sample code that takes the images out of a PDF
http://developers.itextpdf.com/examples/content-extraction-and-redaction-itext5/extracting-objects-pdf
And I know that it can create PDFs and it is being kept up to date or has been worked on within the last few months.
Aside from that if you Google for
itext convert multipage tiff to pdf
you get some samples which may do what you want to.

Disclaimer:
I have not used iText for Java, but I have it for C# in an ASP.NET application for creating PDFs with barcodes.
iText is was first created for/in Java and then most/all of the functionally was ported to Dot Net.
 
Saloon Keeper
Posts: 7181
166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I said there, PDFBox is a good library, IMO.

I would avoid JAI, as it's been dead for a long time now. ImageJ is a very capable, actively developed image processing library- that would be my first choice for image tasks.

For this particular task, though, it probably suffices to use Java's built-in javax.imageio.ImageIO class, as outlined in https://stackoverflow.com/a/41038987. You'll just need to TIFF-enable ImageIO, which is done by adding the jar file from https://github.com/jai-imageio/jai-imageio-core
 
Carl Anton
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks! Unfortunately Itext isn't free any longer in a proprietary environment.
 
Tim Moores
Saloon Keeper
Posts: 7181
166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

have you heard about iText?


iText is a good library, but one needs to be careful which version to use. Only version 2 is licensed under the LGPL und thus easily usable without paying license fees. The newer versions 5 and 7 are licensed under the Affero GPL, which makes them hard to use if you don't plan on opening up your source code (unless you pay the license fee, of course).

Edited: I now see you already know about that.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic