35 lines
948 B
Java
35 lines
948 B
Java
|
package com.dpkj.modules.print.service;
|
|||
|
|
|||
|
import com.alibaba.fastjson.JSONObject;
|
|||
|
|
|||
|
/**
|
|||
|
* 打印服务接口
|
|||
|
*
|
|||
|
* @author <a href="https://gitee.com/shi-chongli">石头人</a>
|
|||
|
* @version 1.0
|
|||
|
* @since 2025-02-08 10:35:27
|
|||
|
*/
|
|||
|
public interface PrintService {
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* 生成小票图片
|
|||
|
*
|
|||
|
* @param data json数据,用来填充模板
|
|||
|
* @param template 模板(html字符串或者模板名称)
|
|||
|
* @param width 图片宽度
|
|||
|
* @param height 图片高度
|
|||
|
* @param saveDir 图片的保存路径,如果为空,那么不进行图片的保存
|
|||
|
*/
|
|||
|
Object printImage(JSONObject data, String template, int width, int height, String saveDir);
|
|||
|
|
|||
|
/**
|
|||
|
* 默认实现,给定一个默认可用的图片保存路径
|
|||
|
*/
|
|||
|
default Object printImage(JSONObject data, String template, int width, int height) {
|
|||
|
return printImage(data, template, width, height, "D:\\images");
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|