In my project, I need to merge several pdf documents. Each document contains only one page with several optional content groups (OCG). Many OCGs are not activated and are not visible in the pdf viewer application.
After merging this pdf with PDFMergerUtility, I get merged PDF files. In this pdf, except for the first page which is correct, in all other pages, all the ocg are visible. The previously disabled ocg becomes visible.
I don't know now if I'm using PDFMergerUtility correctly or if it's a bug, do you know, how to merge several pdf in a single file with the correct display ocg in java?
Is it possible to completely delete an OCG in pdf format?
Edit : I currently use pdfbox-app-2.0.6, I will try with 2.0.7.
I use this pdf with all OCG disable : simple pdf layer exemple and I try to merge with a copy of himself. Sorry my other pdf are confidentiel.
This was fixed in issue PDFBOX-3973 and will be part of release 2.0.14 in a few weeks / months. It is available as a snapshot until release.
In the merged file both OCGs will coexist.