Exemplo n.º 1
0
        /// <summary>
        /// Gets the order of the layers in which they will be displayed in the layer view panel,
        /// including nesting.
        /// </summary>
        private static void GetOCGOrder(PdfArray order, PdfLayer layer)
        {
            if (!layer.IsOnPanel())
            {
                return;
            }
            if (layer.GetTitle() == null)
            {
                order.Add(layer.GetPdfObject().GetIndirectReference());
            }
            IList <PdfLayer> children = layer.GetChildren();

            if (children == null)
            {
                return;
            }
            PdfArray kids = new PdfArray();

            if (layer.GetTitle() != null)
            {
                kids.Add(new PdfString(layer.GetTitle(), PdfEncodings.UNICODE_BIG));
            }
            foreach (PdfLayer child in children)
            {
                GetOCGOrder(kids, child);
            }
            if (kids.Size() > 0)
            {
                order.Add(kids);
            }
        }