package com.qmth.boot.tools.models;

/**
 * 通用纸张大小
 */
public enum PaperSize {

    A3("A3", 420, 297),
    A4("A4", 210, 297),
    B4("B4", 353, 250),
    B5("B5", 176, 250),
    K8("8K", 370, 255),
    K16("16K", 185, 255);

    private String code;

    private int width;

    private int height;

    PaperSize(String code, int width, int height) {
        this.code = code;
        this.width = width;
        this.height = height;
    }

    public String getCode() {
        return code;
    }

    public int getWidth() {
        return width;
    }

    public int getHeight() {
        return height;
    }

    public static PaperSize findByCode(String code) {
        for (PaperSize ps : PaperSize.values()) {
            if (ps.getCode().equalsIgnoreCase(code)) {
                return ps;
            }
        }
        return null;
    }
}
