- Refactored BurnPdfCommandHandler to use new extension methods for cleaner annotation handling. - Introduced ITextStyle interface to generalize font styling for text annotations. - Updated PDFBurnerParams to implement ITextStyle for consistent font settings reuse. - Added MathematExtensions for coordinate and unit conversion (ToInches, ToPointF). - Added GdPictureExtensions to encapsulate annotation-related logic (form fields, images, ink). - Improved readability and maintainability by removing redundant helper methods.
40 lines
870 B
C#
40 lines
870 B
C#
using System.Drawing;
|
|
|
|
namespace EnvelopeGenerator.Application.Common.Extensions;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public static class MathematExtensions
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="points"></param>
|
|
/// <returns></returns>
|
|
public static PointF ToPointF(this List<float> points)
|
|
{
|
|
var pointsInch = points.Select(ToInches).ToList();
|
|
return new PointF(pointsInch[0], pointsInch[1]);
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="value"></param>
|
|
/// <returns></returns>
|
|
public static double ToInches(this double value)
|
|
{
|
|
return value / 72.0;
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="value"></param>
|
|
/// <returns></returns>
|
|
public static float ToInches(this float value)
|
|
{
|
|
return value / 72f;
|
|
}
|
|
} |