Does the pdf viewer have control over visibility of OCG/layers? I very much need this functionality.
Thanks,
Jim
//the function of Spire.PDF(Spire.Pdf.dll, this dll is also included in Spire.PdfViewer package)
PdfDocument doc = new PdfDocument(@"F:\Layer.pdf");
foreach (PdfLayer layer in doc.Layers)
{
if (layer.Name == "red line")
{
//control the visibility
layer.Visibility = PdfVisibility.Off;
}
}
MemoryStream stream = new MemoryStream();
doc.SaveToStream(stream,FileFormat.PDF);
this.pdfViewer1.LoadFromStream(stream);