Frequently Asked Question:
Merge Optional Content Groups (OCGs)
Is it possible to merge OCGs?
I need to remove OCGs in existing PDF files and then merge all files to a single file. The resulting file should have no "layers" (all OCGs needs to be merged before or during the file merging).
It's not currently possible to merge Optional Content Groups, however, if you simply use the DeleteOptionalContentGroup to delete the OCGs then the content that was on the page will remain there -- it will not be deleted, only the optional content group "shells" will be deleted.
This in effect results in all of the content being merged onto the one level and the document no longer has any layers / OCGs.