Spire.PDFViewer is a powerful PDF Viewer component for .NET. It allows developers to load PDF document from stream, file and byte array.

Wed Sep 13, 2017 10:08 pm

Does the pdf viewer have control over visibility of OCG/layers? I very much need this functionality.

Thanks,
Jim

jcramer
 
Posts: 1
Joined: Wed Sep 13, 2017 10:01 pm

Thu Sep 14, 2017 3:44 am

Dear Jim,

Thanks for your inquiry.
Sorry that Spire.PDFViewer doesn't support controlling the visibility of OCG/layers.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Sat Jan 05, 2019 8:18 am

Hi Jim,

Hope you are doing well.
Regarding your issue, there is a workaround at present. Please first use the function of Spire.PDF then set the visibility of the layer and load it via Spire.PDFViewer. Please download the latest Spire.PDFViewer Pack Version:4.1, or install it via NuGet: https://www.nuget.org/packages/Spire.PDFViewer/4.1.0
Code: Select all
            //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);



Best wishes,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Jan 11, 2019 3:04 am

Dear Jim,

Greetings from E-iceblue.
Did you try the code and the hotfix? Has your issue been resolved?

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.PDFViewer

cron