Pregunta

¿Es posible eliminar u ocultar una capa de un PDF usando ABCPDF u otro marco?

No hay solución correcta

Otros consejos

El siguiente ejemplo de C# muestra cómo se puede eliminar la capa 2 de la página 1:

Doc theDoc = new Doc();
theDoc.Read("source.pdf");
int thePages = theDoc.GetInfoInt(theDoc.Root, "Pages");
int thePage = theDoc.GetInfoInt(thePages, "Page 1");
int theLayer = theDoc.GetInfoInt(thePage, "Content 2");
theDoc.Delete(theLayer);

O tal vez estabas buscando el Aplanar() ¿función?

ABCPDF contiene un proyecto de ejemplo llamado OCGLAYERS. Este proyecto le muestra cómo identificar y redactar todos los elementos en una capa.

Por ejemplo:

        Properties props = Properties.FromDoc(_doc, false);
        Page page = (Page)_doc.ObjectSoup[_doc.Page];
        Reader reader = Reader.FromPage(props, page);
        List<OptionalContent.Layer> layers = reader.GetLayers();
        foreach (OptionalContent.Layer layer in layers) {
            if (layer.Visible == false) {
                if (reader == null)
                    reader = Reader.FromPage(props, page);
                Reader.Redact(ref reader, layer);
            }
        }
        UpdateLayers();
        UpdatePreview();
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top