Create a pdf with layers from several tiffs files

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Kad
Posts: 5
Joined: 2019-05-03T04:10:42-07:00
Authentication code: 1152

Create a pdf with layers from several tiffs files

Post by Kad »

Hello,

Sorry for my english but I am french.
I want to create a pdf with layers from tiffs files.
For example, I have 3 tiffs files and I would like to have a pdf file with 3 layers.
Is it possible?

Thanks.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Create a pdf with layers from several tiffs files

Post by snibgo »

IM can create a PDF with one image per page, like this:

Code: Select all

magick in1.tiff in2.tiff in3.tiff out.pdf
snibgo's IM pages: im.snibgo.com
Kad
Posts: 5
Joined: 2019-05-03T04:10:42-07:00
Authentication code: 1152

Re: Create a pdf with layers from several tiffs files

Post by Kad »

Thank you for your reply.
But I want to have a pdf with layers and not pages.
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: Create a pdf with layers from several tiffs files

Post by 246246 »

PDF can include layer, Optional Content Groups, since version 1.5. The pdf imagemagick generates have a header of 1.3, so it's easy to guess imagemagick has no feature to create it.

Many PDF product claims that can do, but I only found few open source that can create PDF layer.
If you are willing to program it in Java, Apache PDFBox would do it using appendFormAsLayer and importPageAsForm method in LayerUtility class. https://pdfbox.apache.org/docs/2.0.13/j ... ility.html
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Create a pdf with layers from several tiffs files

Post by fmw42 »

Imagemagick can not currently create layered PDFs to my knowledge. Imagemagick is coded in C, only as far as I know. If you want an enhancement, you can request it on the Developers forum and it will be put into the queue
Kad
Posts: 5
Joined: 2019-05-03T04:10:42-07:00
Authentication code: 1152

Re: Create a pdf with layers from several tiffs files

Post by Kad »

Thank you for your answers.
I am not an expert java but I will still inform me.
What is the generated version of the pdf in imagemagick 7?
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: Create a pdf with layers from several tiffs files

Post by 246246 »

Kad wrote: 2019-05-09T03:48:36-07:00 What is the generated version of the pdf in imagemagick 7?
My previous answer for version is wrong. It seems it depends on input:

Code: Select all

$ magick wizard: tiff:- | magick - PDF:- | head -1
%PDF-1.7 
$ magick wizard: png:- | magick - PDF:- | head -1
%PDF-1.3 
I do not understand how the version is selected. Need to check the source code if it is really necessary. (Even if IM sometimes create PDF of version 1.7, it cannot create layer.)

If you need Java sample code using PDFBox, I will send the simple sample code.
Kad
Posts: 5
Joined: 2019-05-03T04:10:42-07:00
Authentication code: 1152

Re: Create a pdf with layers from several tiffs files

Post by Kad »

Okay.
Yes I want if you do not mind.
Thank you.
Post Reply