protected override void DoLayoutChildren() { PDFPositionOptions position = this.FullStyle.CreatePostionOptions(); PDFLayoutXObject canvas = null; if (position.ViewPort.HasValue) { canvas = this.ApplyViewPort(position, position.ViewPort.Value); } base.DoLayoutChildren(); if (null != canvas) { canvas.Close(); this.CloseCurrentLine(); canvas.OutPutName = (PDFName)this.Context.Document.GetIncrementID(PDFObjectTypes.CanvasXObject); var rsrc = new PDFCanvasResource(this.Component as Canvas, canvas, position.ViewPort.Value); var ratio = this.FullStyle.GetValue(SVGAspectRatio.AspectRatioStyleKey, SVGAspectRatio.Default); var size = new PDFSize(canvas.Width, canvas.Height); canvas.Matrix = CalculateMatrix(size, position.ViewPort.Value, ratio); canvas.ClipRect = new PDFRect(position.X.HasValue ? position.X.Value : PDFUnit.Zero, position.Y.HasValue ? position.Y.Value : PDFUnit.Zero, canvas.Width, canvas.Height); this.Context.DocumentLayout.CurrentPage.PageOwner.Register(rsrc); this.Context.Document.EnsureResource(rsrc.ResourceType, rsrc.ResourceKey, rsrc); } }
protected override void DoLayoutComponent() { PDFPositionOptions pos = this.FullStyle.CreatePostionOptions(); PDFLayoutXObject xObject = this.CreateAndAddInput(pos); _addedProxyText = false; if (string.IsNullOrEmpty(this.Field.Value)) { this.Field.Value = "Proxy Text"; _addedProxyText = true; } base.DoLayoutComponent(); xObject.Close(); if (pos.PositionMode == Drawing.PositionMode.Block) { this.CloseCurrentLine(); } this.LayoutPage = this.Context.DocumentLayout.CurrentPage; IArtefactCollection annots; if (!this.LayoutPage.Artefacts.TryGetCollection(PDFArtefactTypes.Annotations, out annots)) { annots = new PDFAnnotationCollection(PDFArtefactTypes.Annotations); this.LayoutPage.Artefacts.Add(annots); } this.LayoutPage = this.Context.DocumentLayout.CurrentPage; annots.Register(this.Field.Widget); this.Field.Widget.SetAppearance(FormFieldAppearanceState.Normal, xObject, this.LayoutPage, this.FullStyle); this.Field.Widget.SetAppearance(FormFieldAppearanceState.Down, xObject, this.LayoutPage, this.FullStyle); this.Field.Widget.SetAppearance(FormFieldAppearanceState.Over, xObject, this.LayoutPage, this.FullStyle); }