public void Bounds_Test() { PDFGraphicsPath target = new PDFGraphicsPath(); Assert.IsTrue(target.Paths.Count == 1); Assert.IsTrue(target.HasCurrentPath); PDFPoint pos = new PDFPoint(10, 10); target.MoveTo(pos); PDFPoint end = new PDFPoint(100, 100); PDFPoint handleStart = new PDFPoint(0, 50); PDFPoint handleEnd = new PDFPoint(50, 100); target.CubicCurveForWithHandleEnd(end, handleEnd); end = end.Offset(pos); handleEnd = handleEnd.Offset(pos); handleStart = handleStart.Offset(pos); PDFRect bounds = target.Bounds; Assert.AreEqual(bounds.X, PDFUnit.Zero); Assert.AreEqual(bounds.Y, PDFUnit.Zero); Assert.AreEqual(bounds.Width, end.X); Assert.AreEqual(bounds.Height, end.Y); }
// // methods // #region public void InitSize(PDFRect total ...) /// <summary> /// Initializes all the sizes in a PDFLayoutComponentRun. /// It is not nescessary, as each property can be set individually, /// but this makes sure everything has been provided /// </summary> /// <param name="total"></param> /// <param name="border"></param> /// <param name="content"></param> /// <param name="margins"></param> /// <param name="padding"></param> /// <param name="options"></param> public void InitSize(PDFRect total, PDFRect border, PDFRect content, PDFPositionOptions options) { this.TotalBounds = total; this.BorderRect = border; this.ContentRect = content; this.PositionOptions = options; }
protected virtual void CreateBlockRegions(PDFLayoutBlock containerBlock, PDFPositionOptions position, PDFColumnOptions columnOptions) { PDFRect unused = containerBlock.CurrentRegion.UnusedBounds; PDFUnit yoffset = containerBlock.CurrentRegion.Height; PDFRect total = new PDFRect(PDFUnit.Zero, yoffset, unused.Width, unused.Height); if (position.Width.HasValue) { total.Width = position.Width.Value; } //ADDED for min/max sizes. Include the margins as we are making this the available width. else if (position.MaximumWidth.HasValue) { total.Width = position.MaximumWidth.Value + position.Margins.Left + position.Margins.Right; } if (position.Height.HasValue) { total.Height = position.Height.Value; } //ADDED for min/max sizes. Include the margins as we are making this the available height. else if (position.MaximumHeight.HasValue) { total.Height = position.MaximumHeight.Value + position.Margins.Top + position.Margins.Bottom; } CurrentBlock.InitRegions(total, position, columnOptions, this.Context); }
public void Clone_Test() { PDFRect target = new PDFRect(10, 20, 30, 40); PDFRect expected = new PDFRect(10, 20, 30, 40); PDFRect actual; actual = target.Clone(); Assert.AreEqual(expected, actual); }
public void SetArrangement(PDFRenderContext context, Style style, PDFRect contentBounds) { PDFComponentMultiArrangement arrange = new PDFComponentMultiArrangement(); arrange.PageIndex = context.PageIndex; arrange.RenderBounds = contentBounds; arrange.FullStyle = style; this.SetArrangement(arrange); }
public static void SetControlBounds(FormFieldControl fieldControl, PDFRect bounds, int docResolution) { double pdfResolutionFactor = docResolution / 72.0; LeadRect rect = new LeadRect( (int)(bounds.Left * pdfResolutionFactor), (int)(bounds.Top * pdfResolutionFactor), (int)(bounds.Width * pdfResolutionFactor), (int)(bounds.Height * pdfResolutionFactor)); fieldControl.FiedlBounds = rect; }
/// <summary> /// Implements the base classes abstract method to build a path. /// </summary> /// <param name="available"></param> /// <param name="fullstyle"></param> /// <returns></returns> protected override PDFGraphicsPath CreatePath(PDFSize available, Style fullstyle) { PDFRect rect = this.GetPrescribedBounds(available, fullstyle); PDFPoint[] points = this.GetPoints(rect, fullstyle); PDFGraphicsPath path = new PDFGraphicsPath(); this.BuildPath(path, points, fullstyle, true); return(path); }
public void PDFRectConstructor_Test2() { double x = 10F; // TODO: Initialize to an appropriate value double y = 20F; // TODO: Initialize to an appropriate value double width = 30F; // TODO: Initialize to an appropriate value double height = 40F; // TODO: Initialize to an appropriate value PDFRect target = new PDFRect(x, y, width, height); Assert.AreEqual(x, target.X.PointsValue); Assert.AreEqual(y, target.Y.PointsValue); Assert.AreEqual(width, target.Width.PointsValue); Assert.AreEqual(height, target.Height.PointsValue); }