3

Is there a free software or open source solution to write a JPEG2000-compressed PDF file, specifically a PDF/A-2 aka ISO 19005-2?

Producing a PDF 1.1 file with lossless compression or JPEG compression is easy, for instance with libtiff's tiff2pdf. Even imagemagick can do it, if you can work around memory usage issues; and imagemagick in theory can use JPEG2000/JP2 format, if the appropriate delegate is installed.

However for JPEG2000 I didn't find good solution. I think kakadu and luratech are some common ones, but they are proprietary. Internet Archive uses kakadu to produce jp2 files and luratech to produce PDF files, but I don't think they produce PDF/A-2 JPEG2000-compressed files.

Also, do FLOSS and commonly found PDF readers easily support said PDF/A-2 format?

  • 1
    Also interesting: softwarerecs.stackexchange.com/questions/18161/… – Nemo Oct 5 '15 at 15:59
  • this tool softwarerecs.stackexchange.com/a/26102 supports JPEG2k too, so you can encode to JPEG2k with separate images with imagemagick for example, and then combine them into pdf by using it. direct link: gitlab.mister-muffin.de/josch/img2pdf – Sarge Borsch Jul 6 '17 at 18:22
  • However, JPEG2000 isn't a very good format for lossy compression, in fact it loses to modern JPEG encoders, so if you aimed specifically for lossy mode, then maybe using an efficient JPEG encoder (mozjpeg) would do just fine. – Sarge Borsch Jul 6 '17 at 18:25
  • @SargeBorsch maybe, but my usecase is to "package" some existing JPEG2000 files as PDF without decoding/re-encoding them. – Nemo Jul 10 '17 at 16:40
  • the first suggestion can do it – Sarge Borsch Jul 10 '17 at 17:31
2

Creating PDF/A-2 including JPEG-2000

iText is a PDF library available in Java and C# that allows you to create PDFs that comply to the PDF/A-2 format. You can find some examples here.

Note that you need the core iText library as well as the pdfa library as an addon to the core library. iText core supports JPEG2000 images.

iText is released under the AGPLv3. The AGPL is a free software license, which means that iText is free software. This doesn't mean that you can use iText for free. You can only use iText without purchasing a commercial license if your software is also released under the AGPLv3 (or the GPLv3; you can't release your software under any other license).

Viewing PDF/A

PDF/A-2 is built on top of ISO-32000-1. It's a subset that involves some obligations (e.g. the obligation to embed fonts, the obligation to provide color profiles,...) and restrictions (e.g. Javascript is forbidden, encryption is forbidden,...). These obligations and restrictions are meant to make sure that any PDF viewer will present the document in a reliable way.

None of these obligations or restrictions prevent a viewer that can present a regular PDF (ISO-32000-1) to present a PDF/A document. So in answer to your additional question: any PDF viewer that pretends that it supports ISO-32000-1 automatically also supports ISO-19005-2.

Update

iText is a developer's library. This means that you need to write code to create a PDF document. We have a Java version (iText), a C# version (iTextSharp) and an Android / GAE version (iTextG). There is no GUI (it's a library) and a CLI would be difficult: usually PDFs are created to publish data from a database. How would you connect to a database, perform a query, organize the results of that query through something as simple as a CLI?

Why would we need to combine iText and tiff2pdf? iText supports conversion from TIFF to PDF. Why would we need to combine iText and ImageMagick? iText supports the most common image formats and image manipulation can easily be done through standard Java or C# functionality.

I'm not sure if I understand your question about TIFF. TIFF is a dying format. It is also a pain: the TIFF standard has been interpreted in so many different ways that every one seems to create its own flavor of TIFF. If you look at iText's changelogs, you see that we've been providing fixes to support "dirty" TIFFs in many releases over the last 15 years.

What readers claim they support ISO-32000-1? That's a difficult question. Some may say they support ISO-32000-1, but "forget" that JPEG-2000 is part of that specification.

JPEG-2000 isn't a requirement for PDF/A. As a matter of fact, support for JPEG-2000 was one of the new things that was introduced in PDF/A-2 (it wasn't present in PDF/A-1). You can perfectly create a PDF/A-2 file that doesn't contain a JPEG-2000 image. But maybe I'm misinterpreting your question. You probably meant that viewer who fully support ISO-32000-1 (and ISO-19005-2) are required to support JPEG-2000. That's true and I have no idea which viewers can decode JPEG-2000.

  • Interesting, nice that an iText developer found my question so quickly! AGPL is a great license, I'm happy when I'm forced to comply with it. Is there any CLI or GUI yet? Would you sell licenses for inclusion as delegate of ImageMagick (or tiff2pdf), or would you make and sell such a combined package? Re YATP, is there a good list of gotchas/recommendations to make good interoperable TIFFs (maybe another question)? Re compatibility, what readers say they support ISO-32000-1 then (maybe another question). If JPEG2000 wasn't a requirement for PDF/A, I suspect many aren't able to decode it. – Nemo Oct 8 '15 at 7:21
  • I'll update my answer. – Bruno Lowagie Oct 8 '15 at 7:28
  • Thank you. Most of our culture's digitised history is stored in TIFF format, like it or not. || Do you think it's feasible to generate PDFs from TIFF originals on the fly, e.g. on a book viewer or image server like iipimage.sourceforge.net ? || Indeed, I meant that because PDF/A documents can't use JPEG2000, and in general JPEG2000 isn't used much, many probably ignored it. I split the question to softwarerecs.stackexchange.com/questions/25497/… – Nemo Oct 8 '15 at 11:10
  • You could use iText to convert the TIFF to PDF on the fly on a device. However: is that really what you want to do? Book viewers usually have limited CPU and memory. Serving PDF instead of TIFF could be better and it could be done on the fly, but you could also do it the way The New York Times has done it in 2007, see this testimonial. – Bruno Lowagie Oct 8 '15 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.