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....pdf as ap def lock_layer ( path_infile...path_infile , path_outfile ): with ap . Document ( path_infile ) as document...