This article explains how to lock a PDF layer, extract PDF layer elements, flatten a layered PDF, and merge all layers insIde a PDF into one....oup_id) — merge using a custom optional content group ID (see...new_layer_name , optional_group_id = None ): with ap . Document...