コード例 #1
0
        private void NodeProcess(PdfDictionary struc, PdfIndirectReference reference)
        {
            PdfObject obj = struc.Get(PdfName.K);

            if (obj != null && obj.IsArray())
            {
                PdfArray ar = (PdfArray)obj;
                for (int k = 0; k < ar.Size; ++k)
                {
                    PdfDictionary dictionary = ar.GetAsDict(k);
                    if (dictionary == null)
                    {
                        continue;
                    }
                    if (!PdfName.STRUCTELEM.Equals(dictionary.Get(PdfName.TYPE)))
                    {
                        continue;
                    }
                    if (ar.GetPdfObject(k) is PdfStructureElement)
                    {
                        PdfStructureElement e = (PdfStructureElement)dictionary;
                        ar.Set(k, e.Reference);
                        NodeProcess(e, e.Reference);
                    }
                }
            }
            if (reference != null)
            {
                writer.AddToBody(struc, reference);
            }
        }
コード例 #2
0
            virtual public PdfAnnotation CreateAnnotation(PdfWriter writer)
            {
                PdfAnnotation annotation = writer.CreateAnnotation(new Rectangle(llx, lly, urx, ury), null);

                if (newPage != 0)
                {
                    PdfIndirectReference refi = writer.GetPageReference(newPage);
                    destination.Set(0, refi);
                }
                if (destination != null)
                {
                    annotation.Put(PdfName.DEST, destination);
                }
                foreach (PdfName key in parameters.Keys)
                {
                    annotation.hashMap[key] = parameters[key];
                }
                return(annotation);
            }