Page 1 of 1

Create a pdf with layers from several tiffs files

Posted: 2019-05-03T04:18:13-07:00
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.

Re: Create a pdf with layers from several tiffs files

Posted: 2019-05-03T05:01:49-07:00
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

Re: Create a pdf with layers from several tiffs files

Posted: 2019-05-03T06:22:43-07:00
by Kad
Thank you for your reply.
But I want to have a pdf with layers and not pages.

Re: Create a pdf with layers from several tiffs files

Posted: 2019-05-05T02:49:42-07:00
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

Re: Create a pdf with layers from several tiffs files

Posted: 2019-05-05T10:35:02-07:00
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

Re: Create a pdf with layers from several tiffs files

Posted: 2019-05-09T03:48:36-07:00
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?

Re: Create a pdf with layers from several tiffs files

Posted: 2019-05-09T08:16:09-07:00
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.

Re: Create a pdf with layers from several tiffs files

Posted: 2019-05-10T08:16:33-07:00
by Kad
Okay.
Yes I want if you do not mind.
Thank you.