Pergunta

É possível remover ou ocultar uma camada de um PDF usando ABCPDF ou outra estrutura?

Nenhuma solução correta

Outras dicas

O exemplo C# a seguir mostra como a camada 2 da página 1 pode ser excluída:

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);

Ou talvez você estivesse procurando o Achaten () função?

O ABCPDF contém um projeto de exemplo chamado OCGlayers. Este projeto mostra como identificar e redigir todos os itens em uma camada.

Por exemplo:

        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 em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top