pdf 根据规则添加文本

主类

public class TextInfo {
    private float x;
    private float y;
    private String content;
    private int fontSize;
    private String fontName;
    private float[] colorArr;
    private int rotate;


    public float getX() {
        return x;
    }

    public void setX(float x) {
        this.x = x;
    }

    public float getY() {
        return y;
    }

    public void setY(float y) {
        this.y = y;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getFontSize() {
        return fontSize;
    }

    public void setFontSize(int fontSize) {
        this.fontSize = fontSize;
    }

    public String getFontName() {
        return fontName;
    }

    public void setFontName(String fontName) {
        this.fontName = fontName;
    }

    public float[] getColorArr() {
        return colorArr;
    }

    public void setColorArr(float[] colorArr) {
        this.colorArr = colorArr;
    }

    public int getRotate() {
        return rotate;
    }

    public void setRotate(int rotate) {
        this.rotate = rotate;
    }
}

TextInfo

public class TextInfo {
    private float x;
    private float y;
    private String content;
    private int fontSize;
    private String fontName;
    private float[] colorArr;
    private int rotate;


    public float getX() {
        return x;
    }

    public void setX(float x) {
        this.x = x;
    }

    public float getY() {
        return y;
    }

    public void setY(float y) {
        this.y = y;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getFontSize() {
        return fontSize;
    }

    public void setFontSize(int fontSize) {
        this.fontSize = fontSize;
    }

    public String getFontName() {
        return fontName;
    }

    public void setFontName(String fontName) {
        this.fontName = fontName;
    }

    public float[] getColorArr() {
        return colorArr;
    }

    public void setColorArr(float[] colorArr) {
        this.colorArr = colorArr;
    }

    public int getRotate() {
        return rotate;
    }

    public void setRotate(int rotate) {
        this.rotate = rotate;
    }
}

MyTime

import java.util.Calendar;

public class MyTime {
    private String year; //2020
    private String year2;//20
    private String month;//03
    private String date;//10
    private String monthDate;//0310
    private String hour;
    private String minute;
    private String second;
    private String nyr;
    private String allTime;


    public MyTime() {
        setAll(getBeforeDay(Calendar.getInstance(),0));
    }
    public MyTime(int i){
        setAll(getBeforeDay(Calendar.getInstance(),i));
    }
    public MyTime(String time){
        this.year = time.substring(0,4);
        this.year2 = time.substring(2,4);
        this.month = time.substring(4,6);
        this.date = time.substring(6,8);
        this.hour = time.substring(8,10);
        this.monthDate = ""+this.month+this.date;
        this.nyr = this.month+"/"+this.date+"&nbsp"+this.hour+":00";
        this.allTime = ""+this.year+this.monthDate+this.hour;

    }
    public void setAll(Calendar c){
        this.year = ""+c.get(Calendar.YEAR);
        this.year2 = year.substring(2,4);
        this.month = "00"+(c.get(Calendar.MONTH)+1);
        this.month = this.month.substring(this.month.length()-2);
        this.date = "00"+c.get(Calendar.DATE);
        this.date = this.date.substring(this.date.length()-2);
        this.hour = "00"+c.get(Calendar.HOUR_OF_DAY);
        this.hour = this.hour.substring(this.hour.length()-2);
        this.minute = "00"+c.get(Calendar.MINUTE);
        this.minute = this.minute.substring(this.minute.length()-2);
        this.second = ""+c.get(Calendar.SECOND);
        this.monthDate = ""+this.month+this.date;
        this.nyr = this.month+"/"+this.date+"&nbsp"+this.hour+":00";
        this.allTime = ""+this.year+this.monthDate+this.hour;



    }
    public  Calendar setCalendar(int year,int month,int date){
        Calendar cl = Calendar.getInstance();
        cl.set(year, month-1, date);
        return cl;
    }
    public   Calendar getBeforeDay(Calendar cl,int i){
        //使用roll方法进行向前回滚
        //cl.roll(Calendar.DATE, -1);
        //使用set方法直接进行设置
        int day = cl.get(Calendar.DATE);
        cl.set(Calendar.DATE, day+i);
        return cl;
    }

    public String getNyr() {
        return nyr;
    }

    public void setNyr(String nyr) {
        this.nyr = nyr;
    }

    public String getYear() {
        return year;
    }

    public void setYear(String year) {
        this.year = year;
    }

    public String getYear2() {
        return year2;
    }

    public void setYear2(String year2) {
        this.year2 = year2;
    }

    public String getMonth() {
        return month;
    }

    public void setMonth(String month) {
        this.month = month;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getMonthDate() {
        return monthDate;
    }

    public void setMonthDate(String monthDate) {
        this.monthDate = monthDate;
    }

    public String getHour() {
        return hour;
    }

    public void setHour(String hour) {
        this.hour = hour;
    }

    public String getMinute() {
        return minute;
    }

    public void setMinute(String minute) {
        this.minute = minute;
    }

    public String getSecond() {
        return second;
    }

    public void setSecond(String second) {
        this.second = second;
    }

    public String getAllTime() {
        return allTime;
    }

    public void setAllTime(String allTime) {
        this.allTime = allTime;
    }

    @Override
    public String toString() {
        return "MyTime{" +
                "year='" + year + '\'' +
                ", year2='" + year2 + '\'' +
                ", month='" + month + '\'' +
                ", date='" + date + '\'' +
                ", monthDate='" + monthDate + '\'' +
                ", hour='" + hour + '\'' +
                ", minute='" + minute + '\'' +
                ", second='" + second + '\'' +
                '}';
    }
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值