コード例 #1
0
        public PDFLayoutInlineBegin AddInlineRunStart(IPDFLayoutEngine engine, IPDFComponent component, PDFPositionOptions options, Style full)
        {
            PDFLayoutInlineBegin begin = new PDFLayoutInlineBegin(this, component, options, full);

            this.Runs.Add(begin);
            return(begin);
        }
コード例 #2
0
        public PDFTraceLogLayoutDocument(Document doc, IPDFLayoutEngine engine, PDFFile originalfile)
            : base(doc, engine)
        {
            this._originalFile = originalfile;

            if (null != this._originalFile)
            {
                PDFFileIndirectObject catRef = originalfile.DocumentCatalogRef;
                if (null == catRef)
                {
                    throw new NullReferenceException("Document catalog could not be found in the original source document");
                }

                this._existCatalog  = originalfile.DocumentCatalog;
                this._existPageTree = originalfile.PageTree;

                if (null != this._existPageTree)
                {
                    this._existPageRefs = this.GetAllPages(this._existPageTree, originalfile);
                }
                else
                {
                    this._existPageRefs = new PDFObjectRef[] { }
                };
            }
        }
コード例 #3
0
        public PDFLayoutInlineEnd AddInlineRunEnd(IPDFLayoutEngine engine, IPDFComponent component, PDFLayoutInlineBegin start, PDFPositionOptions options)
        {
            PDFLayoutInlineEnd end = new PDFLayoutInlineEnd(this, start, component, options);

            this.Runs.Add(end);
            return(end);
        }
コード例 #4
0
        public PDFLayoutMarkedContentBegin AddMarkedContentStart(IPDFLayoutEngine engine, IPDFComponent component, PDFMarkedContentType type)
        {
            PDFLayoutMarkedContentBegin begin = new PDFLayoutMarkedContentBegin(this, component, type);

            this.Runs.Add(begin);
            return(begin);
        }
コード例 #5
0
        public PDFLayoutXObject AddXObjectRun(IPDFLayoutEngine engine, IPDFComponent component, PDFLayoutRegion container, PDFPositionOptions options, Style full)
        {
            PDFLayoutXObject xobject = new PDFLayoutXObject(this, container, options, component);

            this.Runs.Add(xobject);
            return(xobject);
        }
コード例 #6
0
        protected virtual PDFLayoutPage CreateNewPageInstance(PageBase owner, IPDFLayoutEngine engine, Style full, OverflowAction action, int pageIndex)
        {
            PDFLayoutPage pg = new PDFLayoutPage(this, owner, engine, full, action);

            pg.PageIndex = pageIndex;
            return(pg);
        }
コード例 #7
0
        public PDFLayoutMarkedContentEnd AddMarkedContentEnd(IPDFLayoutEngine engine, PDFLayoutMarkedContentBegin start)
        {
            PDFLayoutMarkedContentEnd end = new PDFLayoutMarkedContentEnd(start);

            this.Runs.Add(end);
            return(end);
        }
コード例 #8
0
        //
        // ctor(s)
        //

        #region public PDFLayoutDocument(PDFDocument doc)

        /// <summary>
        /// Creates a new PDFLayoutDocument
        /// </summary>
        public PDFLayoutDocument(Document doc, IPDFLayoutEngine engine)
            : base(null, doc, engine, new Style())
        {
            AllPages               = new PDFLayoutPageCollection();
            CurrentPageIndex       = -1;
            this.DocumentComponent = doc;
            this._renderopts       = doc.RenderOptions;
            this.ValidateRenderOptions();
        }
コード例 #9
0
        public LayoutEngineText(IPDFTextComponent component, IPDFLayoutEngine parent)
        {
            if (null == component)
            {
                throw new ArgumentNullException("component");
            }
            this._txt = component;
            this._par = parent;

            TextLayoutEngineCount++;
        }
コード例 #10
0
        /// <summary>
        /// Begins a new page of the requested size and with the specified bounds. This will then be the current page
        /// </summary>
        /// <param name="size">The actual size of the page</param>
        /// <param name="full">The full style of the page</param>
        /// <returns></returns>
        public PDFLayoutPage BeginNewPage(PageBase owner, IPDFLayoutEngine engine, Style full, OverflowAction action)
        {
            int           pgIndex = this.AllPages.Count;
            PDFLayoutPage pg      = CreateNewPageInstance(owner, engine, full, action, pgIndex);

            this.CurrentPageIndex = pg.PageIndex;
            this.CurrentPage      = pg;
            this.AllPages.Add(pg);

            return(pg);
        }
コード例 #11
0
        public LayoutEnginePageGroup(PageGroup group, IPDFLayoutEngine parent, PDFLayoutContext context, Style full)
        {
            if (null == group)
            {
                throw new ArgumentNullException("group");
            }

            this._group         = group;
            this._parent        = parent;
            this._context       = context;
            this._full          = full;
            this.ContinueLayout = true;
        }
コード例 #12
0
        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();
            }
        }
コード例 #13
0
        /// <summary>
        /// Returns a new un-initialized block that is appended to the current open block
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="fullstyle"></param>
        /// <returns></returns>
        public PDFLayoutBlock BeginNewBlock(IPDFComponent owner, IPDFLayoutEngine engine, Style fullstyle, PositionMode mode)
        {
            if (this.IsClosed)
            {
                throw new InvalidOperationException(Errors.CannotLayoutAPageThatHasBeenClosed);
            }

            PDFLayoutBlock last = this.LastOpenBlock();

            if (null == last)
            {
                throw new InvalidOperationException(Errors.NoOpenBlocksToAppendTo);
            }
            else
            {
                return(last.BeginNewBlock(owner, engine, fullstyle, mode));
            }
        }
コード例 #14
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);
                        }
                    }
                }
            }
        }
コード例 #15
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);
            }
        }
コード例 #16
0
 protected virtual IPDFLayoutEngine CreateLayoutEngine(IPDFLayoutEngine parent, PDFLayoutContext context, Style style)
 {
     return(new Layout.LayoutEnginePanel(this, parent));
 }
コード例 #17
0
        //
        // .ctor
        //

        #region public LayoutEngineList(PDFList list, IPDFLayoutEngine parent)

        public LayoutEngineList(List list, IPDFLayoutEngine parent)
            : base(list, parent)
        {
            _list = list;
        }
コード例 #18
0
        //
        // interface implementation
        //

        #region IPDFViewPortComponent Members
        /// <summary>
        /// Implements the layout engine so that it can return the default panel layout engine
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="context"></param>
        /// <param name="style"></param>
        /// <returns></returns>
        public IPDFLayoutEngine GetEngine(IPDFLayoutEngine parent, PDFLayoutContext context, Style style)
        {
            return(new Layout.LayoutEnginePanel(this, parent));
        }
コード例 #19
0
 IPDFLayoutEngine IPDFViewPortComponent.GetEngine(IPDFLayoutEngine parent, PDFLayoutContext context, Style style)
 {
     return(this.CreateLayoutEngine(parent, context, style));
 }
コード例 #20
0
        //
        // .ctor(s)
        //

        #region protected PDFLayoutContainerItem(PDFLayoutItem parent, IPDFComponent owner, IPDFLayoutEngine engine, PDFStyle full)

        /// <summary>
        /// Creates a new PDFLayoutContainerItem with the specified parent, owner and style
        /// </summary>
        /// <param name="parent">The parent container of this item</param>
        /// <param name="owner">The component owner of this item</param>
        /// <param name="full">The style applied to this item based on it's container owner</param>
        protected PDFLayoutContainerItem(PDFLayoutItem parent, IPDFComponent owner, IPDFLayoutEngine engine, Style full)
            : base(parent, owner)
        {
            this.FullStyle = full;
            this.Engine    = engine;
        }
コード例 #21
0
        //
        // methods
        //

        #region IPDFViewPortComponent Members

        /// <summary>
        /// Implements the IPDFViewPort to return the PDFTableLayoutEngine
        /// </summary>
        /// <param name="parent">The invoking layout engine</param>
        /// <param name="context">The current layout context</param>
        /// <param name="fullstyle">The full style of the table</param>
        /// <returns>The required engine</returns>
        IPDFLayoutEngine IPDFViewPortComponent.GetEngine(IPDFLayoutEngine parent, PDFLayoutContext context, Style fullstyle)
        {
            return(new Layout.LayoutEngineTable(this, parent));
        }
コード例 #22
0
 protected override IPDFLayoutEngine CreateLayoutEngine(IPDFLayoutEngine parent, PDFLayoutContext context, Style style)
 {
     return(new Layout.LayoutEngineCanvas(this, parent));
 }
コード例 #23
0
 public LayoutEngineCanvas(ContainerComponent component, IPDFLayoutEngine parent)
     : base(component, parent)
 {
 }
コード例 #24
0
 internal LayoutEngineSection(Section section, IPDFLayoutEngine parent)
     : base(section, parent)
 {
     _section = section;
 }
コード例 #25
0
 public LayoutEngineInput(FormInputField container, IPDFLayoutEngine parent) : base(container, parent)
 {
     this.Field = container;
 }
コード例 #26
0
 public override IPDFLayoutEngine GetEngine(IPDFLayoutEngine parent, PDFLayoutContext context)
 {
     return(new PDFTraceLogLayoutEngineDocument(this, this.OriginalSourceFile, parent, context));
 }
コード例 #27
0
        //
        // ctor(s)
        //

        #region public PDFLayoutPage(PDFLayoutDocument doc, PDFSize size, PDFPage page, PDFStyle full)

        /// <summary>
        /// Creates a new instance of the PDFLayoutPage.
        /// </summary>
        /// <param name="doc">The document layout this page belongs to</param>
        /// <param name="page">The page definition this layout is part of </param>
        /// <param name="full">The full style for the page</param>
        /// <remarks>The PDFLayout page has one block. The TopBlock.
        /// This contains all the regions and content for the page.</remarks>
        public PDFLayoutPage(PDFLayoutDocument doc, PageBase page, IPDFLayoutEngine engine, Style full, OverflowAction overflow)
            : base(doc, page, engine, full)
        {
            this.OverflowAction = overflow;
        }
コード例 #28
0
        //
        // methods
        //

        #region public override IPDFLayoutEngine GetEngine(IPDFLayoutEngine parent, PDFLayoutContext context, Styles.PDFStyle style)

        /// <summary>
        /// Override the base implementation to return a PageGroupLayoutEngine
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="context"></param>
        /// <param name="style"></param>
        /// <returns></returns>
        public override IPDFLayoutEngine GetEngine(IPDFLayoutEngine parent, PDFLayoutContext context, Styles.Style style)
        {
            return(new Layout.LayoutEnginePageGroup(this, parent, context, style));
        }
コード例 #29
0
 protected override IPDFLayoutEngine CreateLayoutEngine(IPDFLayoutEngine parent, PDFLayoutContext context, Style style)
 {
     return(new Layout.LayoutEngineInput(this, parent));
     //base.CreateLayoutEngine(parent, context, style);
 }
コード例 #30
0
        //
        // ctor(s)
        //

        #region internal DocumentLayoutEngine(PDFDocument doc, IPDFLayoutEngine parent, PDFLayoutContext context)

        /// <summary>
        /// Creates a new instance of the document layout engine which can arrange all the pages and the components for this document into a PDFDocumentLayout
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="parent"></param>
        /// <param name="context"></param>
        protected internal LayoutEngineDocument(Document doc, IPDFLayoutEngine parent, PDFLayoutContext context)
            : base(doc, parent)
        {
        }