Supprimer ou masquer la couche PDF à l'aide d'ABCPDF?
-
19-09-2019 - |
Question
Est-il possible de supprimer ou de masquer un calque d'un PDF utilisant ABCPDF ou un autre framework?
Pas de solution correcte
Autres conseils
L'exemple C # suivant montre comment la couche 2 de la page 1 peut être supprimée:
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 peut-être que vous cherchiez le Aplatir() fonction?
ABCPDF contient un exemple de projet appelé Ocglayers. Ce projet vous montre comment identifier et expliquer tous les éléments d'une couche.
Par exemple:
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();
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow