Esempio n. 1
0
        protected virtual PDFObjectRef DoWritePage(PDFRenderContext context, PDFWriter writer, PDFObjectRef parent)
        {
            PDFObjectRef pg = writer.BeginPage(context.PageIndex);

            this.PageObjectRef = pg;
            writer.BeginDictionary();
            writer.WriteDictionaryNameEntry("Type", "Page");
            writer.WriteDictionaryObjectRefEntry("Parent", parent);
            writer.BeginDictionaryEntry("MediaBox");
            writer.WriteArrayRealEntries(0.0, 0.0, this.Size.Width.ToPoints().Value, this.Size.Height.ToPoints().Value);
            writer.EndDictionaryEntry();
            if (this.FullStyle.IsValueDefined(StyleKeys.PageAngle))
            {
                int value = this.FullStyle.GetValue(StyleKeys.PageAngle, 0);
                writer.WriteDictionaryNumberEntry("Rotate", value);
            }

            context.PageSize = this.Size;
            context.Offset   = new PDFPoint();
            context.Space    = context.PageSize;

            if (context.ShouldLogVerbose)
            {
                context.TraceLog.Add(TraceLevel.Verbose, "Layout Page", "Rendering the contents of page : " + this.PageIndex);
            }

            PDFObjectRef content = this.OutputContent(context, writer);

            if (content != null)
            {
                writer.WriteDictionaryObjectRefEntry("Contents", content);
            }

            if (context.ShouldLogVerbose)
            {
                context.TraceLog.Add(TraceLevel.Verbose, "Layout Page", "Rendering the resources of page : " + this.PageIndex);
            }

            //PDFObjectRef[] annots = this.DoWriteAnnotations(context, writer);
            //if (null != annots && annots.Length > 0)
            //{
            //    writer.BeginDictionaryEntry("Annots");
            //    writer.WriteArrayRefEntries(true, annots);
            //    writer.EndDictionaryEntry();
            //}

            PDFObjectRef ress = this.DoWriteResource(context, writer);

            if (ress != null)
            {
                writer.WriteDictionaryObjectRefEntry("Resources", ress);
            }

            DoWriteArtefacts(context, writer);
            writer.EndDictionary();
            writer.EndPage(context.PageIndex);

            return(pg);
        }