2025-11-08 16:38:36 +01:00
|
|
|
|
namespace ElectronNET.API.Entities;
|
|
|
|
|
|
|
|
|
|
|
|
public class PageSize
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly string _value;
|
|
|
|
|
|
|
2025-11-22 02:16:10 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Represents the page size for printing/PDF.
|
|
|
|
|
|
/// Matches Electron semantics: either a named size (e.g. 'A4', 'Letter', 'Legal', 'Tabloid', 'Ledger', etc.)
|
|
|
|
|
|
/// or a custom size specified by Height and Width in inches.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>Up-to-date with Electron API 39.2</remarks>
|
2025-11-08 16:38:36 +01:00
|
|
|
|
public PageSize()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private PageSize(string value) : this() => _value = value;
|
|
|
|
|
|
|
2025-11-22 02:16:10 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets or sets the custom page height in inches (when using object form instead of a named size).
|
|
|
|
|
|
/// </summary>
|
2025-11-08 16:38:36 +01:00
|
|
|
|
public double Height { get; set; }
|
|
|
|
|
|
|
2025-11-22 02:16:10 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets or sets the custom page width in inches (when using object form instead of a named size).
|
|
|
|
|
|
/// </summary>
|
2025-11-08 16:38:36 +01:00
|
|
|
|
public double Width { get; set; }
|
|
|
|
|
|
|
2025-11-22 02:16:10 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Implicit conversion to string to represent named page sizes (e.g. 'A4', 'Letter').
|
|
|
|
|
|
/// </summary>
|
2025-11-08 16:38:36 +01:00
|
|
|
|
public static implicit operator string(PageSize pageSize) => pageSize?._value;
|
|
|
|
|
|
|
2025-11-22 02:16:10 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Implicit conversion from string to represent named page sizes (e.g. 'A4', 'Letter').
|
|
|
|
|
|
/// </summary>
|
2025-11-08 16:38:36 +01:00
|
|
|
|
public static implicit operator PageSize(string value) => new(value);
|
2025-11-15 08:05:31 +01:00
|
|
|
|
}
|