public void LayoutAPage(PageBase pg, bool first)
        {
            this.PushGroupHeader(pg, first);
            this.PushGroupFooter(pg, first);

            Style style = pg.GetAppliedStyle();

            if (null != style)
            {
                this.Context.StyleStack.Push(style);
            }

            Style full = this.Context.StyleStack.GetFullStyle(pg);

            PDFArtefactRegistrationSet artefacts = pg.RegisterLayoutArtefacts(this.Context, full);

            using (IPDFLayoutEngine engine = pg.GetEngine(this, this.Context, full))
            {
                if (this.Context.ShouldLogVerbose)
                {
                    this.Context.TraceLog.Begin(TraceLevel.Message, "Page Group Layout", "Starting the layout of page " + pg.ID);
                }

                engine.Layout(this.Context, full);

                if (this.Context.ShouldLogVerbose)
                {
                    this.Context.TraceLog.End(TraceLevel.Message, "Page Group Layout", "Completed the layout of page " + pg.ID + " and now on page index " + this.Context.DocumentLayout.CurrentPageIndex.ToString());
                }
                else if (this.Context.ShouldLogMessage)
                {
                    this.Context.TraceLog.Add(TraceLevel.Message, "Page Group Layout", "Completed the layout of page " + pg.ID + " and now on page index " + this.Context.DocumentLayout.CurrentPageIndex.ToString());
                }
            }

            if (null != artefacts)
            {
                pg.CloseLayoutArtefacts(this.Context, artefacts, full);
            }

            if (null != style)
            {
                this.Context.StyleStack.Pop();
            }
        }
Ejemplo n.º 2
0
        protected void LayoutPageWithStyle(PageBase pg, Style full)
        {
            PDFArtefactRegistrationSet artefacts = pg.RegisterLayoutArtefacts(this.Context, full);

            using (IPDFLayoutEngine engine = pg.GetEngine(this, this.Context, full))
            {
                if (this.Context.TraceLog.ShouldLog(TraceLevel.Message))
                {
                    this.Context.TraceLog.Begin(TraceLevel.Message, "Document Layout", "Starting the layout of page " + pg.ID);
                }

                engine.Layout(this.Context, full);

                if (this.Context.TraceLog.ShouldLog(TraceLevel.Message))
                {
                    this.Context.TraceLog.End(TraceLevel.Message, "Document Layout", "Completed the layout of page " + pg.ID + " and now on page index " + this.DocumentLayout.CurrentPageIndex.ToString());
                }
            }

            if (null != artefacts)
            {
                pg.CloseLayoutArtefacts(this.Context, artefacts, full);
            }
        }
Ejemplo n.º 3
0
        protected virtual void LayoutAdditions(Style docStyle)
        {
            if (this.Document.HasAdditions)
            {
                foreach (IPDFComponent comp in this.Document.Additions)
                {
                    if (comp is Component)
                    {
                        Component full = comp as Component;
                        PDFArtefactRegistrationSet artefacts = full.RegisterLayoutArtefacts(this.Context, docStyle);
                        if (full is IPDFViewPortComponent)
                        {
                            using (IPDFLayoutEngine engine = ((IPDFViewPortComponent)full).GetEngine(this, this.Context, docStyle))
                                engine.Layout(this.Context, docStyle);
                        }

                        if (null != artefacts)
                        {
                            full.CloseLayoutArtefacts(this.Context, artefacts, docStyle);
                        }
                    }
                }
            }
        }