Пример #1
0
        public virtual PDFObjectRef OutputToPDF(PDFRenderContext context, PDFWriter writer)
        {
            PDFGraphics graphics = context.Graphics;
            Style       full     = null;

            PDFComponentArrangement arrange = this.GetFirstArrangement();

            if (null != arrange)
            {
                full = arrange.FullStyle;
            }

            if (null == full)
            {
                full = context.FullStyle;
            }

            PDFImageXObject img = this.GetImageObject(context, full);

            if (img != null)
            {
                PDFPoint pos = context.Offset;


                PDFSize imgsize = context.Space;

                //the pictures are drawn from their bottom left corner, so take off the height.
                //if (context.DrawingOrigin == DrawingOrigin.TopLeft)
                //    pos.Y = pos.Y + imgsize.Height;

                graphics.SaveGraphicsState();

                StyleValue <double> op;
                if (full.TryGetValue(StyleKeys.FillOpacityKey, out op))
                {
                    if (op.Value(full) < 1.0)
                    {
                        graphics.SetFillOpacity(op.Value(full));
                    }
                }
                PDFObjectRef imgref = img.EnsureRendered(context, writer);
                graphics.PaintImageRef(img, imgsize, pos);

                graphics.RestoreGraphicsState();
                return(imgref);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// Once layout is comlete then we can replace the text that was used when not rendering
        /// with the text that was.
        /// </summary>
        internal override void RegisterLayoutComplete(PDFLayoutContext context)
        {
            base.RegisterLayoutComplete(context);

            PDFComponentArrangement arrange = this.GetFirstArrangement();

            if (null != arrange)
            {
                this._renderpageindex = arrange.PageIndex;
                this._fullstyle       = arrange.FullStyle;
                this._pgstyle         = context.DocumentLayout.CurrentPage.FullStyle;
            }

            if (null != this._doc && null != this._numberProxy)
            {
                string text = this.GetDisplayText(this._renderpageindex, this._fullstyle, true);
                this._numberProxy.Text = text;
            }
        }
Пример #3
0
        /// <summary>
        /// Sets an arrangement for this component
        /// </summary>
        /// <param name="arrange"></param>
        protected virtual void SetArrangement(PDFComponentArrangement arrange)
        {
            if (arrange is PDFComponentMultiArrangement)
            {
                if (_arrange == null)
                {
                    _arrange = arrange;
                    //this.EnsureAllChildrenAreOnThisPage(arrange);
                }

                else if (_arrange != null && _arrange is PDFComponentMultiArrangement)
                {
                    ((PDFComponentMultiArrangement)_arrange).AppendArrangement((PDFComponentMultiArrangement)arrange);
                }
                else
                {
                    throw RecordAndRaise.InvalidCast(Errors.CannotConvertObjectToType, typeof(PDFComponentArrangement), typeof(PDFComponentMultiArrangement));
                }
            }
            else
            {
                _arrange = arrange;
            }
        }
Пример #4
0
 protected override void SetArrangement(PDFComponentArrangement arrange)
 {
     base.SetArrangement(arrange);
 }
Пример #5
0
 /// <summary>
 /// Clears all arrangements (rendering information) for this component
 /// </summary>
 public virtual void ClearArrangement()
 {
     _arrange = null;
 }