Skip to content Skip to sidebar Skip to footer

Remove Pdf Layer(s) From Pdf Using Pypdf2

Is the subject possible? I've looked over the documentation and cannot determine with certainty if it is. I have a PDF with a layer list that looks like the picture. I'd like to ta

Solution 1:

According to this issue (open as of 21 sept 2015), optional content groups (which are called layers in Acrobat) are not yet supported in PyPDF2.

Solution 2:

See the answer to this question for approaches on how to do this for the specific case that motivated this question - removing the orthoimage from a USGS topo map.

Solution 3:

You can exclude one or more PDF layers and convert to TIFF in one go using gdal_translate with the flag --config GDAL_PDF_LAYERS_OFF. See this page for an example.

I have applied this specifically for manipulating USGS topo maps which come as geospatial PDFs.

Post a Comment for "Remove Pdf Layer(s) From Pdf Using Pypdf2"