public DxfToSvgConverterOptions(ConverterDxfRect dxfSource, ConverterSvgRect svgDestination, string svgId = null, IEnumerable <string> layers = null, AttributeGeneratorFunc attributeGenerator = null) { DxfSource = dxfSource; SvgDestination = svgDestination; SvgId = svgId; Layers = layers; AttributesGenerator = attributeGenerator; }
/// <summary> /// Creates a PDF destination rectangle from the given DXF rectangle and keeps the aspect ratio. /// Optionally, a <paramref name="margin"/> can be defined. /// </summary> /// <param name="srcRect">The DXF source rectangle.</param> /// <param name="maxWidth">The maximum width of the PDF output including <paramref name="margin"/>.</param> /// <param name="maxHeight">The maximum height of the PDF output including <paramref name="margin"/>.</param> /// <param name="margin">[optional] The margin.</param> /// <returns>The PDF destination rectangle.</returns> public static ConverterPdfRect KeepAspectRatio(ConverterDxfRect srcRect, PdfMeasurement maxWidth, PdfMeasurement maxHeight, PdfMeasurement margin = default(PdfMeasurement)) { double maxWidthPts = maxWidth.AsPoints(); double maxHeightPts = maxHeight.AsPoints(); double marginPts = margin.AsPoints(); double scaleX = (maxWidthPts - 2 * marginPts) / srcRect.Width; double scaleY = (maxHeightPts - 2 * marginPts) / srcRect.Height; double scale = Math.Min(scaleX, scaleY); PdfMeasurement left = margin; PdfMeasurement right = PdfMeasurement.Points(marginPts + scale * srcRect.Width); PdfMeasurement bottom = margin; PdfMeasurement top = PdfMeasurement.Points(marginPts + scale * srcRect.Height); return(new ConverterPdfRect(left, right, bottom, top)); }
public DxfToSvgConverterOptions(ConverterDxfRect dxfSource, ConverterSvgRect svgDestination, string svgId = null) { DxfSource = dxfSource; SvgDestination = svgDestination; SvgId = svgId; }
public DxfToSvgConverterOptions(ConverterDxfRect dxfRect, ConverterSvgRect svgRect, string svgId = null) { DxfRect = dxfRect; SvgRect = svgRect; SvgId = svgId; }
public DxfToPdfConverterOptions(PdfMeasurement pageWidth, PdfMeasurement pageHeight, ConverterDxfRect dxfSource, ConverterPdfRect pdfDestination) { PageWidth = pageWidth; PageHeight = pageHeight; Scale = 1d; this.DxfRect = dxfSource ?? throw new ArgumentNullException(nameof(dxfSource)); this.PdfRect = pdfDestination ?? throw new ArgumentNullException(nameof(pdfDestination)); }