Exemplo n.º 1
0
        public override void OnSaveEvent(IndirectObject indirectObject, PDFObjects pdfObjects)
        {
            var entries = new Dictionary <string, PdfObject>()
            {
                { "Count", new IntegerObject(Count) }
            };

            if (Parent == null)
            {
                entries.Add("Type", new NameObject("Outlines"));
            }
            if (Parent != null)
            {
                entries.Add("Parent", Parent.IndirectReferenceObject(pdfObjects));
                entries.Add("Dest", new ArrayObject(new List <PdfObject>()
                {
                    Page.IndirectReferenceObject(pdfObjects),
                    new NameObject("XYZ"),
                    GetRealOrNullObject(X),
                    GetRealOrNullObject(Y),
                    GetRealOrNullObject(Zoom)
                }));
            }
            if (First != null)
            {
                entries.Add("First", First.IndirectReferenceObject(pdfObjects));
            }
            if (Last != null)
            {
                entries.Add("Last", Last.IndirectReferenceObject(pdfObjects));
            }
            if (Prev != null)
            {
                entries.Add("Prev", Prev.IndirectReferenceObject(pdfObjects));
            }
            if (Next != null)
            {
                entries.Add("Next", Next.IndirectReferenceObject(pdfObjects));
            }
            if (Title != null)
            {
                entries.Add("Title", new StringObject(Title));
            }

            indirectObject.SetChild(new DictionaryObject(entries));
        }