| 版本 | 日期 | 内容 |
|---|---|---|
| 3.0.3 | 11.5.2025 | 对象attachedBar新增internal字段 |
| 3.0.3 | 9.16.2025 | 新增函数GetImageNameList,按排列顺序,用于获取已排版图片名 |
| 3.0.2 | 9.2.2025 | 对象attachImage新增pos字段 |
| 3.0.2 | 8.28.2025 | 对象imageSetting增加子对象attachImage,用于异形贴图 |
| 3.0.1 | 8.18.2025 | layout中新增serPath,用于存放排版基本信息文件的文件夹 |
| 3.0.1 | 7.23.2025 | layout中新增followPaperFiexd,表示切割定位符等跟随纸张大小固定 |
| 3.0.1 | 7.15.2025 | 新增函数SetDtpClientAddress,用于设置dtp界面中的客户端地址列表 |
| 2.2.4 | 5.16.2025 | 对象layout新增useHoles字段,删除字段 |
| 2.2.4 | 5.6.2025 |
|
| 2.2.3 | 4.24.2025 | 新增函数CloseConnect |
| 2.2.3 | 4.24.2025 | jobs增加子对象arrange,并且其中增加字段imageGroup |
| 2.2.3 | 4.23.2025 | cutter中新增indexPos,表示切割定位符序号 |
| 2.2.1 | 4.17.2025 | SetConnectParam参数可包含端口,例如192.168.a.b:x |
| 2.2.1 | 3.27.2025 | jobs对象中image的成员rotate支持更多角度 |
| 2.2.1 | 3.24.2025 | 对象layout字段imageShowMode增加含义,为4时表示只显示图元外框 |
| 2.2.1 | 3.13.2025 | jobs对象中加入cutterMark,定位符位置可以指定 |
| 2.2.1 | 3.13.2025 | jobs对象中加入paper替代 |
| 2.2.1 | 3.12.2025 | 对象layout增加字段pageGroup,表示每页排版是否成组 |
| 2.2.1 | 1.16.2025 | GetImagesPos函数新增参数coord,用于控制坐标轴方向(目前仅支持0和1) |
| 2.2.1 | 1.16.2025 | cutter中新增bkColor,用于描述切割定位符背景(目前仅支持圆形) |
| 2.2.1 | 11.12.2024 | job中新增jobs对象,配合algorithm等于255时使用(不使用排版算法) |
| 2.2.1 | 11.7.2024 | 对象imageName中新增symmetry,表示文件名轴对称 |
| 2.2.1 | 11.7.2024 | 对象image所属split对象中新增firstBlockSize,表示首块切割大小 |
| 2.1.1 | 10.12.2022 |
|
| 2.1.1 | 9.20.2024 | 对象groupSize中字段rule新增含义 |
| 2.1.1 | 8.22.2024 | 对象imageName增加字段nameExclude |
| 2.1.1 | 8.20.2024 | 对象oem字段align为3时其含义改变,不再镜像 |
| 2.1.1 | 7.24.2024 | 对象image增加字段custom,表示文件名可以自定义 |
| 2.1.1 | 6.4.2024 | 对象plotter增加字段pageFrame,指定板芯外框路径 |
| 2.1.1 | 5.17.2024 | 对象layout增加字段needOutermost、autoRemoveFrame |
| 2.1.1 | 5.8.2024 | 对象layout增加字段needCurve、convertCurveToLine |
| 2.1.1 | 4.29.2024 | 对象layout增加字段inRect,实现矩形排版生成图像轮廓 |
| 2.1.1 | 4.24.2024 | 对象layout增加字段cropLineRegular,用于指定生成规则切割线 |
| 2.1.1 | 4.12.2024 | cropMarking对象更新部分字段和标线定义 |
| 2.0.0 | 3.26.2024 | |
| 2.0.0 | 3.20.2024 | 对象groupMessageOutOfPaper增加字段env,用于指定语言 |
| 2.0.0 | 3.15.2024 |
|
| 2.0.0 | 3.7.2024 | 增加裁切标线对象cropMarking |
| 2.0.0 | 2.1.2024 | |
| 2.0.0 | 1.24.2024 | |
| 1.5.3 | 1.11.2024 | 扩充对象codeInfo中的contentSameAsPlt的有效集. |
| 1.5.3 | 12.12.2023 |
|
| 1.5.3 | 10.21.2023 | 对象oem字段align支持镜像分散两端靠齐 |
| 1.5.3 | 11.20.2023 | 对象codeInfo中的contentSameAsPlt类型改为int,表示版面路径(plt或者dxf)的文件名或者全路径名. |
| 1.5.3 | 11.3.2023 | 对象layout新增字段multiToSinglePageDeWeight,适用于拼单页后的二维码去重 |
| 1.5.3 | 11.2.2023 | |
| 1.5.3 | 11.1.2023 | 对象oem新增字段distanceX,二维码相对版芯内的水平位置 |
| 1.5.3 | 10.26.2023 | 对象split增加字段lineBreakSize |
| 1.5.3 | 10.17.2023 | 对象oem增加字段interval,表示码间间距 |
| 1.5.3 | 10.17.2023 | 将对象oem中的字段 |
| 1.5.3 | 10.16.2023 | 对象imageName字段 |
| 1.5.3 | 10.16.2023 | 对象oem增加字段contentSameAsPlt,表示码内容为plt路径 |
| 1.5.3 | 10.12.2023 | 对象imageName增加字段listSpaceNotBoth,表示图片名称列表距天地的距离是否不为listSpace |
| 1.5.3 | 9.28.2023 | 对象layout增加字段splitPagesToLayouteds,多页情况时生成多版面 |
| 1.5.3 | 8.15.2023 | 对象cutter新增字段用于凸形裁切
|
| 1.5.3 | 7.25.2023 | 对象imageSetting的子对象name新增字段qr表示图像附加二维码的内容,barInfo为空时,qr才具有意义 |
| 1.5.3 | 7.12.2023 | 新增接口LayoutReport |
| 1.5.3 | 7.3.2023 | 新增接口SetConnectParam |
| 1.5.3 | 4.17.2023 | 对象layout新增字段printPageHeaderTpfName, 默认不打印页头tpf名 |
| 1.5.3 | 8.16.2022 | |
| 1.5.3 | 6.17.2022 |
|
| 1.5.3 | 6.16.2022 | |
| 1.5.3 | 6.8.2022 |
|
| 1.5.3 | 6.1.2022 | 对象layout废弃字段 |
| 1.5.3 | 5.24.2022 |
|
| 1.5.3 | 5.18.2022 | |
| 1.5.3 | 4.13.2022 |
|
| 1.5.3 | 2.14.2022 |
|
| 1.5.3 | 1.25.2022 |
|
| 1.5.3 | 1.19.2022 |
|
| 1.5.3 | 1.4.2022 |
|
| 1.5.3 | 11.16.2021 | 对象image新增split数组,表示手动切图设置 |
| 1.5.3 | 10.25.2021 | 对象codeInfo新增arrange字段 |
| 1.5.3 | 10.20.2021 |
|
| 1.5.3 | 9.6.2021 | |
| 1.5.2 | 8.20.2021 | layout对象增加字段multiToSinglePage |
| 1.5.2 | 6.30.2021 |
|
| 1.5.1 | 5.21.2021 |
|
配置文件名为dtpPlugin.json, 用于设置一般参数。
配置文件dtpPlugin.json必须和dtpPlugin.dll都位于MainTop/DTP目录. 如果缺失,将采用默认值. 其中oem属性定义标准对象. 例子:
{
"oem": {
"head": true,
"tail": true,
"headPos": 5,
"tailPos": 5,
"barCodeUnitX": 8,
"barCodeUnitY": 8,
"codeX": -1,
"codeY": 25.4,
"showWarning": true,
"bringToFront": true,
"align": 1,
"interval": 2,
"distanceX": 0
}
}
| 字段 | 类型 | 说明 |
|---|---|---|
| head | bool | 是否打印头部码,默认为true. 在自动排版时,需要head=true和(qr&1)!=0才会打印头部码. |
| tail | bool | 是否打印尾部码,默认为true. 在自动排版时,需要tail=true和(qr&2)!=0才会打印尾部码. |
| headPos | float | 头部码距离纸边界的距离, 毫米为单位,默认5. |
| tailPos | float | 尾部码距离纸边界的距离, 毫米为单位,默认5. |
| barCodeUnitX | float | QR码大小横向控制量,默认4. |
| barCodeUnitY | float | QR码大小纵向控制量,默认4. |
| codeX | float | 码宽度,默认-1,小于0则自动计算. |
| codeY | float | 码高度,默认25.4. |
| showWarning | bool | 自动排版时如果纸张宽度过小,是否显示警告信息. |
| bringToFront | bool | 在发送了拼版作业后,是否把DTP移动到前台. |
| align | int | 码的靠齐方式:
|
| interval | float | 码间间距, 毫米为单位,默认2. |
| distanceX | float | 头部码或者尾部码横向偏移距离, 毫米为单位. |
客户程序使用sdkOem.dll和蒙泰DTP进行通信。sdkOem.dll位于客户程序路径下。
客户拥有64位的AppKey, 有些函数的执行需要签名,签名算法采用SHA256. sign不需要进行HexEncode, 直接输出32字节二进制数据即可。 salt是客户生成32字节随机数。
sdkOem.dll支持的API如下:
| 函数 | 功能 |
|---|---|
| CreateMainTopLayoutOemSdk | 创建Sdk对象 |
#ifndef Stdcall
#ifdef _WIN32
#ifdef __GNUC__
#define Stdcall __attribute__((stdcall))
#else
#define Stdcall __stdcall
#endif
#else
#define Stdcall
#endif
#endif
#pragma pack(4)
enum MainTopLayoutResult
{
MAINTOP_LAYOUT_RESULT_SUCEEDED, //成功
MAINTOP_LAYOUT_RESULT_WARNING, //成功发送到了蒙泰, 但是有如纸张宽度扩充等警告.
MAINTOP_LAYOUT_RESULT_FAILED, //失败
};
struct MainTopLayoutParam
{
const char *data; //json定义的job对象或PreLayout返回的字符串
unsigned int dataSize; //job长度
char salt[32]; //随机数
char sign[32]; //签名
};
typedef
void (Stdcall *Percent)(const char*, unsigned int);
class MainTopLayoutOemSdk
{
public:
virtual MainTopLayoutResult Stdcall Layout(const MainTopLayoutParam *p) = 0;
virtual const char* Stdcall PreLayout(const MainTopLayoutParam *p,
unsigned int *size) = 0;
virtual void Stdcall ReleasePreLayoutResult(const char *p) = 0;
virtual MainTopLayoutResult Stdcall Layouted(const MainTopLayoutParam *p) = 0;
virtual int Stdcall GetImageSizes(const MainTopLayoutParam *p, int *sizes) = 0;
virtual void Stdcall Close() = 0;
virtual void Stdcall SetParent(void *hwnd) = 0;
virtual bool Stdcall SetMaterialsInfo(const MainTopLayoutParam *p) = 0;
virtual int Stdcall GetImagesPos(char *jsonBuf, int coord) = 0;
virtual bool Stdcall SetImagesPos(const MainTopLayoutParam *param) = 0;
virtual bool Stdcall StartPrint(Percent) = 0;
virtual int Stdcall GetPrinterList(char *printerList) = 0;
virtual bool Stdcall ConfigPrinter(const MainTopLayoutParam *param) = 0;
virtual bool Stdcall ForbidLoadImage(const MainTopLayoutParam *param) = 0;
virtual bool Stdcall SetNotifyPath(const MainTopLayoutParam *param) = 0;
virtual void Stdcall SetConnectParam(char *Ip) = 0;
virtual MainTopLayoutResult Stdcall LayoutReport(const MainTopLayoutParam *p, char *jsonReport) = 0;
virtual int Stdcall StartPrintReport(char *jsonBuf, bool printAllLayouteds = false) = 0;
virtual bool Stdcall LoadLayoutFile(const MainTopLayoutParam *p) = 0;
virtual bool Stdcall CloseLayoutFile(const MainTopLayoutParam *param) = 0;
virtual bool Stdcall SetDtpCurrentDirectory(const MainTopLayoutParam *param) = 0;
virtual int Stdcall GetImageNameList(const MainTopLayoutParam *param, char *jsonBuf) = 0;
};
extern "C" MainTopLayoutOemSdk* Stdcall CreateMainTopLayoutOemSdk();
#pragma pack()
bool Stdcall Layout(const MainTopLayoutParam *p);
发送一组图片到DTP, 根据设定进行拼版。如果DTP没有打开,自动打开. 其中data为json编码的对象job. dataSize为字符串data的长度. 需要对数据进行签名。
| 参数名称 | 类型 | 说明 |
|---|---|---|
| group | group | 分组设置 |
| images | image数组 | 图片列表 |
| paper | paper | 纸张设定 |
| imageSetting | imageSetting | 图片有关的设置 |
| layout | layout | 排版相关设定. |
| cutter | cutter | 切割机设置 |
| oem | oem | 和配置相关的设置,可以缺失。如果存在,优先级将 > dtpPlugin.json中的设置. |
| split | split | 大图切分为小图的设置. |
| imageBorder | imageBorder | 可以缺失,图片边框设置. |
| confront | confront | 可以缺失,对裱设置. |
| paperHeaderFooter | paperHeaderFooter | 可以缺失,页眉页脚设置. |
| codeInfo | codeInfo数组 | 可以缺失,页面首尾QR/条码设置. |
| thumbnail | thumbnail | 可以缺失,生成排版图像. |
| imageHole | imageHole | 可以缺失,图像打孔设置. |
| pageEdge | pageEdge | 可以缺失,页面显示tpf名称. |
| cropMarking | cropMarking | 可以缺失,裁切定位标线 |
| plotter | plotter | 可以缺失,切割路径参数设定 |
| jobs | jobs | 已排列好的作业,并且只有在algorithm等于255时才生效,此时image无效. 可以缺失. |
| nineSetting | nineSetting | 九段定制设定 |
| 参数名称 | 类型 | 说明 |
|---|---|---|
| groupKeys | groupKey数组 | 定义了分组关键字.缺少将不启用关键字分组 |
| groupSizes | groupSize数组 | 启用的按照图片尺寸进行分版面的设置. 缺少或是长度<=1将不启用. 在启用groupSizes时,image对象不用特殊使用groupTag来进行描述, 会对发送来的所有作业起效. |
| groupMessage | groupMessageOutOfPaper | 版面外的信息显示, 主要是分版时使用. 可以缺失,表示不显示. |
| groupSeperations | groupSeperation | 对于版面内的分组分割设置. 可以缺失,表示没有额外分割设置. |
| 参数名称 | 类型 | 说明 |
|---|---|---|
| name | string | 分组名称, 比如"user", "material"等 |
| sameJob | bool | 不同的分组标签是否能在同一个版面上出现。
|
| 参数名称 | 类型 | 说明 |
|---|---|---|
| width | float | 纸张宽度, 以毫米为单位. 将覆盖paper.width设置. |
| height | float | 纸张高度. 以毫米为单位. 如果为0表示不限制纸张高度. <0表示使用paper.height设置. |
| rule | int | 过滤规则:
|
| range | float数组 | 过滤器. 如果有n项过滤选项,需要n*2个元素. 其中第一个为开始尺寸,后一个为结束尺寸.比如[0, 50, 100, 200, 400, 0]描述了3个过滤项: 小于50毫米的, 100到200毫米之间的, 大于400毫米的. pair中包含前不包含后, 即[start, end). 0是特殊值. 出现在start中,表示只有end有效. 出现在end中, 表示只有start有效. |
| 参数名称 | 类型 | 说明 |
|---|---|---|
| show | bool | 是否显示版面外信息 |
| env | int | 指定信息语言(缺省时跟随系统)
|
| 参数名称 | 类型 | 说明 |
|---|---|---|
| height | float | 间隔高度, 单位毫米 |
| color | string | 分割线颜色, 支持black, white, red, green, blue, cyan, magenta, yellow及自定义颜色. |
| colorValue | byte array | 3或4个元素的byte数组. 分别为RGBA. 使用预定义的颜色时,不指定此值. |
| widthLine | float | 分割线的宽度, 单位毫米. |
| flagLine | int | 分割线标记,可以为:
|
| message | bool | 是否显示文字信息. |
| multiLine | int | 版内分组文字样式
|
| 参数名称 | 类型 | 说明 |
|---|---|---|
| name | string | 图片名称 |
| barInfo | string | 标注qr码内容,可以为空. 使用时需定义attachedBar |
| groupTags | string数组 | 作业的分组标签值. 每个作业按顺序设置了所有的groupKeys中的值. |
| copies | int | 份数 |
| scale | float | 缩放. 1为原始的尺寸. |
| width | int | 图片原始宽度(scale之前). 可选参数, 单位毫米x10000. |
| height | int | 图片原始高度(scale之前). 可选参数, 单位毫米x10000. |
| reverse | bool | 是否使用对裱图, 默认为原图. |
| reverseName | string | 对裱图的名称. |
| split | split数组 | 手动切图设置,可忽略,数组大小应为2,表示横向和纵向. |
| holes | int数组 | 数组大小应为2, 表示横向和纵向打孔个数 |
| custom | string | 如果存在且非空,则会取代图片名称 |
| 参数名称 | 类型 | 说明 |
|---|---|---|
| equal | bool | 自动计算每块尺寸 |
| blocks | int | 指定切分块数,1表示不切分 |
| sizes | int数组 | 指定每块的尺寸,单位毫米x10000(equal为true时可忽略) |
| firstBlockSize | int | 指定首块横向宽度或纵向高度,单位毫米x1000,缺省或为0时无效. 当横向和纵向数组中都存在时,则仅横向生效. (不要同时在横向和纵向数组中设置有效值). |
| 参数名称 | 类型 | 说明 |
|---|---|---|
| paper | paper | 纸张 (其中intervalX和intervalY无效) |
| arrange | arrange | 排列设置 |
| cutterMark | cutterMark | 定位符位信息以及位置 |
| pages | page数组 | 每页图片的布局 |
| 参数名称 | 类型 | 说明 |
|---|---|---|
| imageGroup | int |
|
| 参数名称 | 类型 | 说明 |
|---|---|---|
| images | image数组 | 图片信息 |
| 参数名称 | 类型 | 说明 |
|---|---|---|
| name | string | 图片名称 |
| rect | float数组 | 图片位置(left, top, right, bottom) |
| rotate | int | 旋转角度支持以下值
|
| 参数名称 | 类型 | 说明 |
|---|---|---|
| type | int | 定位符的类型, 0:不输出定位符;1:十字;2:圆; |
| lock | bool | 定位符是否锁定 |
| colorValue | int | 颜色名称,支持:
|
| lineWidth | float | 定位符线宽, 单位毫米. |
| width | float | 定位符宽度, 单位毫米. |
| height | float | 定位符高度, 单位毫米. |
| pos | float数组 | 定位符位置(left, top成对出现, 例如[x1, y1, x2, y2, x3, y3 ......]) |
| 参数名称 | 类型 | 说明 |
|---|---|---|
| width | float | 纸张宽度, 毫米单位 |
| height | float | 纸张高度, 毫米单位. 0是特殊值,表示不限制纸张高度. |
| margin | float数组 | left, top, right, bottom 留空,毫米为单位. |
| intervalX | float | 图片直接的横向间距, 毫米为单位. |
| intervalY | float | 图片直接的纵向间距, 毫米为单位. |
| 参数名称 | 类型 | 说明 |
|---|---|---|
| name | imageName | 图片名称显示信息. |
| split | split | 大图切分为小图的设置. |
| border | imageBorder | 可以缺失,图片边框设置. |
| attachedBar | attachedBar | 图像标注附加QR码设置, 可以缺失. |
| attachImage | attachImage | 异形贴图 |
| 参数名称 | 类型 | 说明 |
|---|---|---|
| position | int | 图片名称显示位置. 支持:
|
| fontSize | float | 默认字体大小, 以磅为单位. |
| fontSizeMin | float | 最小字体大小, 以磅为单位. |
| interval | float | 图片名称到图片的距离. 毫米为单位. |
| multiple | int | 多份的情况下,图片名称的显示, 支持:
|
| internal | bool | 图片名称是否显示在图片内部. |
| fixedRotate | bool | 是否在图片旋转时,图片名字的位置不变,还是position指定的位置. 否则将随图片旋转。 |
| listHead | bool | 是否在纸张的头部显示图片名称列表 |
| listTail | bool | 是否在纸张尾部显示图片名称列表 |
| listSpaceVer | float | 图片名称列表距离图片纵向的距离(缺省时与listSpace值相同) |
| listFontSize | float | 图片名称列表的字体大小,以磅为单位. |
| listSpace | float | 距离纸张边界的距离, 单位毫米(当listSpaceVer存在时,仅指定水平方向) |
| listHeight | float | 名称列表的高度, 单位毫米 |
| color | string | 颜色名称. 支持black, white, red, green, blue, cyan, magenta, yellow及自定义颜色. |
| colorValue | byte array | 3或4个元素的byte数组. 分别为RGBA. 使用预定义的颜色时,不指定此值. |
| size | bool | 图片标注的尺寸 |
| dateTime | bool | 图片标注的日期时间 |
| custom | string | 图片标注的自定义 |
| reverse | bool | 图片标注文字反向 |
| qr | int | 用于表示barInfo的内容
|
| nameExclude | bool | 图片名称是否计算在内 |
| symmetry | bool | 文件名轴对称 |
| 参数名称 | 类型 | 说明 |
|---|---|---|
| same | bool | 等份裁切. |
| fixOverlap | bool | 固定重叠裁切,优先级小于等份裁切. |
| overlap | float | 大图切成小图后的重叠部分. 单位毫米. 大图切成小图后为了方便拼接,有时需要有一定的重叠. |
| type | int | 拼接标记, 0:不输出拼接标记;1:外角标 |
| size | float | 拼接标记的大小, 不包括distance部分. 毫米为单位 |
| distance | float | 拼接标记距离图片的距离. 毫米为单位. |
| color | string | 颜色名称. 支持black, white, red, green, blue, cyan, magenta, yellow及自定义颜色. |
| colorValue | byte array | 3或4个元素的byte数组. 分别为RGBA. 使用预定义的颜色时,不指定此值. |
| lineWidth | float | 定位符线宽, 单位毫米. |
| copyTogether | bool | 多份等份裁切后,每份在一起而非每块在一起. |
| pos | int | 拼接标记的位置. 支持0, 1. 0为左或上, 1为右或下. |
| line | bool | 是否输出拼接线, pos!=0时支持,默认为图像内首尾连接的线段. |
| lineBreakSize | float | 拼接线首尾断开后的线段的大小(非0并且line为true,优先级弱于多彩虚线). |
| cutLine | bool | 是否输出裁切线, pos !=0时支持 |
| lineShift | float | 拼接线相对正常位置的偏移. |
| coverageMode | bool | 是否使用拼接覆盖模式。覆盖模式下,标记的拼接对齐方式略有不同。 |
| dottedLineMultiColor | bool | 是否使用多彩虚线。 |
| dottedLineGap | float | 多彩虚线的间隔,单位毫米。 |
| 参数名称 | 类型 | 说明 |
|---|---|---|
| algorithm | int | 排版算法, 支持:
|
| alignHorz | int | 横向靠齐, 支持:
|
| smartInterval | bool | 智能间距. 即图片间距不包含图片名称部分。 |
| newpage | bool | 是否生成新版面. 如果为false, 则直接覆盖当前版面. |
| imageShowMode | int | 图片显示模式, 支持:
|
| autoWidth | bool | 是否自动缩小纸张宽度,防止纸张过宽. |
| generateCutter | int | 切割机文件生成方式:
|
| splitBigImage | bool | 是否自动切分大图. 使用split来控制切分设置. |
| imageSizePrecision | int | 图片尺寸的精度:
|
| adjustment | bool | 是否使用微调界面进行调整 |
| adjustmentShowImage | bool | 使用微调界面进行调整时是否显示图片内容. |
| tpfSavePath | string | 可以缺失,静默保存tpf全路径. |
| contourSavePath | string | 可以缺失,静默保存切割文件全路径. |
| userName | string | 可以缺失,需配合paperHeaderFooter对象使用. |
| onepage | bool | 排版到同一版面 |
| statInfo | bool | 显示图像统计信息 |
| multiToSinglePage | bool | 多页拼成单页 |
| allowFlip | bool | 允许旋转 |
| multiToSinglePageMargin | float | 可以缺失,多页拼成单页时页面间距 |
| tpfAutoSave | bool | 排版结束自动保存tpf,为true时需设置tpfSavePath |
| splitPagesToLayouteds | bool | 单个作业多页时拆分成多版面 |
| multiToSinglePageDeWeight | bool | 多页拼单页后,单页上的二维码去重 |
| cropLineRegular | bool | 生成规则切割线 |
| pageGroup | bool | 页面对象是否成组 |
| rotateLevel | int | 异形路径下的旋转级别,取值0-4,数值越高计算速度越慢. |
| blood | float | 异形路径下的出血设置. |
| dotScale | int | 异形路径下的节点规模,取值10-100,数值越高,精度增加速度降低. |
| backgroundColor | int | 异形路径下的图像底色识别
|
| backgroundTolerance | int | 异形路径下的颜色容差 |
| onlyOuter | bool | 异形路径下的只查找最外层轮廓,默认为true |
| inRect | bool | 矩形排版是否生成图像轮廓,默认为false |
| needCurve | bool | 支持贝塞尔曲线 |
| convertCurveToLine | bool | 曲线转直线 |
| autoRemoveFrame | bool | 自动移除图像的边框 |
| needOutermost | bool | 生成图像的矩形轮廓 |
| useHoles | bool | 使用孔洞排版,仅支持带透明图层的图像 |
| followPaperFiexd | bool | 切割定位符等跟随纸张大小固定而非内容 |
| serPath | string | 用于存放投影文件(排版信息文件)的文件夹 |
需配合generateCutter使用
| 参数名称 | 类型 | 说明 |
|---|---|---|
| path | string | 切割机文件保存的目录. |
| pltrange | bool | 生成切割机使用的plt文件时, 图片名称是否在切割范围内. |
| dxf | bool | 输出plt时使用dxf代替plt |
| type | int | 定位符的类型, 0:不输出定位符;1:十字;2:圆;3:内角标. |
| lock | bool | 定位符是否锁定 |
| color | string | 颜色名称. 支持black, white, red, green, blue, cyan, magenta, yellow及自定义颜色. |
| colorValue | byte array | 3或4个元素的byte数组. 分别为RGBA. 使用预定义的颜色时,不指定此值. |
| lineWidth | float | 定位符线宽, 单位毫米. |
| width | float | 定位符宽度, 单位毫米. |
| height | float | 定位符高度, 单位毫米. |
| leftMargin | float | 左留空, 单位毫米. |
| topMargin | float | 上留空, 单位毫米. |
| rightMargin | float | 右留空, 单位毫米. |
| bottomMargin | float | 下留空, 单位毫米. |
| useVertGap | bool | 是否使用纵向间距在版面的左右增加定位符. |
| vertGap | float | useVertGap时的纵向间距. |
| vertGapSubRight | bool | useVertGap时是否右侧减少定位符. |
| vertGapSubNum | int | useVertGap时减少定位符的个数. |
| useDirectionMark | bool | 是否启用方向定位符. |
| directionMarkShift | float | 方向定位符偏移. |
| directionMarkTail | bool | 方向定位符是否输出在尾部. |
| sameAsTpf | int |
|
| imageBorderMargin | float | 图像路径与本身的边距(外扩内缩),单位毫米. |
| multiToSinglePageSub | bool | 多页拼成单页时,是否减少页面拼接处的定位符个数. |
| pltConvexName | bool | 凸形裁切文件名(pltrange为true时才生效) |
| pltConvexDashLine | bool | 凸形裁切文件名时是否使用虚裁 |
| dashLineSpace | float | 虚裁线段间距 |
| bkColor | string | 同color |
| indexPos | int | 切割定位符序号位置
|
| 参数名称 | 类型 | 说明 |
|---|---|---|
| same | bool | 等份裁切. |
| overlap | float | 大图切成小图后的重叠部分. 单位毫米. 大图切成小图后为了方便拼接,有时需要有一定的重叠. |
| type | int | 拼接标记, 0:不输出拼接标记;1:外角标 |
| size | float | 拼接标记的大小, 不包括distance部分. 毫米为单位 |
| distance | float | 拼接标记距离图片的距离. 毫米为单位. |
| color | string | 颜色名称. 支持black, white, red, green, blue, cyan, magenta, yellow及自定义颜色. |
| colorValue | byte array | 3或4个元素的byte数组. 分别为RGBA. 使用预定义的颜色时,不指定此值. |
| lineWidth | float | 定位符线宽, 单位毫米. |
| copyTogether | bool | 多份等份裁切后,每份在一起而非每块在一起. |
| pos | int | 拼接标记的位置. 支持0, 1. 0为左或上, 1为右或下. |
| line | bool | 是否输出拼接线, pos!=0时支持 |
| cutLine | bool | 是否输出裁切线, pos !=0时支持 |
| lineShift | float | 拼接线相对正常位置的偏移. |
| coverageMode | bool | 是否使用拼接覆盖模式。覆盖模式下,标记的拼接对齐方式略有不同。 |
图片边框设置, 可以缺失, 表示不设置边框.
| 参数名称 | 类型 | 说明 |
|---|---|---|
| width | float | 线宽, 毫米为单位. |
| space | float | 边框距离图片的距离, 毫米为单位. |
| color | string | 颜色名称. 支持black, white, red, green, blue, cyan, magenta, yellow及自定义颜色. |
| colorValue | byte array | 3或4个元素的byte数组. 分别为RGBA. 使用预定义的颜色时,不指定此值. |
| includeName | bool | 包括图片名称 |
对裱设置, 可以缺失.
| 参数名称 | 类型 | 说明 |
|---|---|---|
| mirrors | int | (mirrors&1)!=0才会输出横向对裱页面;(mirrors&2)!=0才会输出纵向对裱页面. |
| intervalX | float | 横向对裱页面与原页面间距, 毫米为单位. |
| intervalY | float | 纵向对裱页面与原页面间距, 毫米为单位. |
| samePage | bool | 对裱后的页面与原页面输出成一个页面. |
页眉页脚设置, 可以缺失.
| 参数名称 | 类型 | 说明 |
|---|---|---|
| pageHeaderSpace | float | 页眉与图像的间距,毫米为单位. |
| pageFooterSpace | float | 页脚与图像的间距,毫米为单位. |
| pageHeaderInfo | string | 页眉的显示内容. |
| pageFooterInfo | string | 页尾的显示内容. |
| useHeader | bool | 显示页眉. |
| useFooter | bool | 显示页脚. |
| pageHeaderFooterFontSize | float | 页眉页脚显示内容的字体大小,磅为单位。默认0. |
| useHeaderFooterCutLine | bool | 页眉页脚与图像之间的裁切线,裁切线设置同groupSeperation |
| noneOfMaterial | bool | 不再提示物料剩余. |
页面首尾QR/条码设置,可以缺失。每个codeInfo对象的位置由pos字段决定。以下字段只需指定一次:
| 参数名称 | 类型 | 说明 |
|---|---|---|
| type | int | 多个对象只需指定一次
|
| childType | int | 只对条码有效:
|
| pos | int | 控制输出QR/条码:
|
| info | string | 码内容 |
| moreInfo | string | 码底部文字,缺失默认使用info内容 |
| text | bool | 是否在码底部显示文字 |
| arrange | int | 只需要指定一次
|
| textOffsetY | double | 码底部文字与上方码的距离 |
| contentSameAsPlt | int | 码内容与切割路径名(contourSavePath或tpf)相同,即使info存在也会被替代
|
图像标注附加QR码设置, 可以缺失.
| 参数名称 | 类型 | 说明 |
|---|---|---|
| type | int | QR码为2. |
| w | float | 宽度, 毫米为单位. |
| h | float | 高度, 毫米为单位. |
| x | float | 横向间距, 毫米为单位. |
| y | float | 纵向间距, 毫米为单位. |
| internal | bool | 附加码是否在图片内部 |
异形贴图信息, 可以缺失.
| 参数名称 | 类型 | 说明 |
|---|---|---|
| name | string | 贴图名称. |
| width | float | 宽度, 毫米为单位. |
| height | float | 高度, 毫米为单位. |
| pos | int |
|
生成排版图像, 可以缺失.
| 参数名称 | 类型 | 说明 |
|---|---|---|
| show | int | 图像生成显示
|
| type | int | 图像格式
|
| path | string | 图像文件保存的目录,缺失默认保存在蒙泰安装目录. |
| dpi | int | 图像精度,默认72dpi. |
| compress | int | 是否压缩图像
|
| colorSpace | int | 颜色空间
|
图像打孔设置, 可以缺失
| 参数名称 | 类型 | 说明 |
|---|---|---|
| type | int | 默认0, 不显示. 当前需设任意非零值. |
| color | string | 标记颜色, 支持black, white, red, green, blue, cyan, magenta, yellow及自定义颜色. |
| colorValue | byte array | 3或4个元素的byte数组. 分别为RGBA. 使用预定义的颜色时,不指定此值. |
| height | float | 标记高度, 单位毫米. |
| width | float | 标记宽度, 单位毫米. |
| lineWidth | float | 标记线宽, 单位毫米. |
| horzMargin | float | 标记横向偏移, 单位毫米. |
| vertMargin | float | 标记纵向偏移, 单位毫米. |
页面显示tpf名称, 可以缺失.
| 参数名称 | 类型 | 说明 |
|---|---|---|
| tpf | bool | 是否显示tpf名称. |
| fontSize | float | 字体大小,磅为单位. |
裁切定位标线,可以缺失。
| 参数名称 | 类型 | 说明 |
|---|---|---|
| mode | int | 定位标线模式:
|
表格中"-"表示无效,所有距离的的单位均为毫米.
| 参数名称 | 类型 | YF裁切线 | CF裁切线 |
|---|---|---|---|
| color | string | 颜色, 支持black, white, red, green, blue, cyan, magenta, yellow. | |
| linePos | int | - | 定位标线位置
|
| lineWidth | float | - | 定位标线宽 |
| lineHeight | float | 线高也即线宽 | 定位标线高 |
| lineGap | float | 线间距 | - |
| hvGap | float | 横纵标线上下间距 | - |
| gapToImage | float | 线距图 | 定位标线距图距离 |
| downOffset | float | - | 定位标线向下偏移距离 |
| blood | float | - | 定位标线出血(右侧) |
| layoutVertLinePos | int | - | 整版竖直标线位置
|
| layoutVertLineWidth | float | - | 整版竖直标线宽度 |
| layoutVertLineGapToImage | float | - | 整版竖直标线距图距离 |
| splitPos | int | - | 分段标线位置
|
| splitLength | float | - | 分段长度 . |
| splitGap | float | - | 分段段落之间间距.(分段标线位于段落中间) |
| splitLineW | float | - | 分段标线宽度. |
| splitLineH | float | - | 分段标线高度. |
| splitGapToImage | float | - | 分段标线距图距离. |
| splitDownOffset | float | - | 分段标线相对偏移距离. |
切割路径生成参数设定, 可以缺失.
| 参数名称 | 类型 | 说明 |
|---|---|---|
| dashLineSpace | float | 虚裁线段间距,单位毫米. |
| color | string | 生成的路径颜色(默认黑色). 目前只支持black, red, green, blue, magenta, yellow. |
| coordPattern | int | 生成的路径所基于的坐标轴方向(默认0,Y轴正向).
|
| pageFrame | int | 1:生成的路径中含板芯外框 |
| 参数名称 | 类型 | 说明 |
|---|---|---|
| industryType | int | 生产类型
|
| pos | int | 加线位置
|
| widthColorBlock | float数组 | 数组大小2, 裁切色块宽度 |
| heightColorBlock | float数组 | 数组大小2, 裁切色块高度 |
| minPageHeight | float | 裁切最小高度 |
| maxPageHeight | float | 裁切最大高度 |
| offsetCutLine | float数组 | 数组大小为2, 分别表示上下偏移 |
| gapOffsetCutLine | float | 加上偏移 |
| gapMaxPageHeight | float | 版面间距 |
| distanceCutLine | float数组 | 数组大小为8, 额外的偏移设定 |
| widthCutLine | float | 覆板线宽度 |
| gapColorBlockWithImage | float | 裁切色块与图像间距 |
| gapCutLineWithImage | float | 覆板线与图像间距 |
| gapColorBlockWithLine | float | 裁切色块距离覆板线 |
| align | int | 靠齐方式
|
| rotateAfterLayout | bool | 排版完成旋转180度 |
| posOffsetCutLine | int | 裁切色块位置
|
const char* Stdcall PreLayout(const MainTopLayoutParam *p);
参数同Layout, 同样需要签名.
利用蒙泰进行预排版,排版的结果不会在蒙泰中呈现,会通过size返回json字符串的大小, 返回值返回json编码的拼版结果. 如果image对象的width,height没有传入, 使用dtp获取尺寸,此时一定要保证dtp空闲,即不能正在处理打印等任务.
返回对象的详细解释不属于本SDK内容。正常用法是立即发送Layouted消息,然后使用ReleasePreLayoutResult释放空间。
如果需要对多个结果进行比较,也不需要全部解析。部分重要属性说明:
| 参数名称 | 类型 | 说明 |
|---|---|---|
| papers | paperLayouted数组 | 使用的纸张,虽然是个数组,当前只有一个元素. |
| jobs | jobLayouted数组 | 版面数组. 排版后的版面列表. |
其中paperLayouted包含了纸张宽度,高度等信息,是进行排版的参数。
jobLayouted定义了排版后的版面
| 参数名称 | 类型 | 说明 |
|---|---|---|
| width | float | 实际版面宽度 |
| height | float | 实际版面高度 |
| heightLastPage | float | 如果非单页输出, 最后一页的高度 |
| imageSplited | bool | 是否有图片被分割了 |
| pages | pageLayouted数组 | 定义了排版后的每一页。数组长度即是页数. |
void Stdcall ReleasePreLayoutResult(const char *p);
释放PreLayout返回的字符串所占空间.
bool Stdcall Layouted(const MainTopLayoutParam *p);
使用PreLayout的结果直接发送到蒙泰DTP生成页面. 需要签名.
data是PreLayout返回的数据. dataSize是PreLayout返回的长度.
void Stdcall Close();
销毁Sdk对象.
int Stdcall GetImageSizes(const MainTopLayoutParam *p, int *sizes);
属于辅助函数,正常使用时可以完全不使用它.
data为图片名称数组, sizes为客户分配的空间,必须为图片个数*2个. 返回得到的图片尺寸个数. 传出的尺寸为1/10000毫米为单位. 当传出的对应于某个图片的尺寸为[0, 0]时表示出错,无法得到其尺寸.
当失败时,返回值小于实际的图片个数.
bool Stdcall SetMaterialsInfo(const MainTopLayoutParam *p);
设置物料信息,暂只支持物料长度,需要签名。
data为物料长度, 以米为单位,类型为double。
bool Stdcall SetNotifyPath(const MainTopLayoutParam *p);
设置打印通知写入的目录名称,需要签名。
data为指定目录名称, 使用utf-8编码;dataSize是目录字符串长度。
int Stdcall GetImagesPos(char *jsonBuf, int coord);
获取版面图像坐标信息,返回字节数。
coord为1时表示取蒙泰坐标系Y轴反方向。
获取的jsonBuf格式如下:
{
"imagePos": [
{"name":"D:\\PP_李四-1.24-225x169mm-3-girl.JPG",
"uid": "719c090",
"pt":[6.3500,353.7468,232.1277,353.7468,232.1277,527.7737,6.3500,527.7737]
},
{"name":"D:\\PP_Zhangsan-1.24-225x169mm-3-girl.JPG",
"uid": "719bfd0",
"pt":[6.3500,179.4134,232.1277,179.4134,232.1277,353.4403,6.3500,353.4403]
},
{"name":"D:\\Plain_李四-1.24-225x169mm-3-girl.JPG",
"uid": "719bf10",
"pt":[6.3500,5.0800,232.1277,5.0800,232.1277,179.1069,6.3500,179.1069]
}
]
}
"pt"对象表示图像的位置信息,分别代表:左上,右上,右下,左下的x,y坐标值。这里仅支持修改左上的坐标。
bool Stdcall SetImagesPos(const MainTopLayoutParam *param);
设置版面图像坐标信息,data为json字符串,格式需与GetImagesPos返回保存一致。
typedef void (Stdcall *Percent)(const char *dataJson, unsigned int dataSize);
bool Stdcall StartPrint(Percent);
启动蒙泰打印功能,Percent为回调函数类型,由SDK使用方提供,用于获取RIP实时进度。。
Percent定义如下:
其中data为json字符串,dataSize为json字符串大小。
| 参数名称 | 类型 | 说明 |
|---|---|---|
| taskId | string | 表示本次打印得ID串 |
| progress | int | RIP实时进度 |
| type | int | 获取RIP进度时,值总是0 |
int Stdcall GetPrinterList(char *jsonBuf);
获取当前的打印机驱动列表,目前仅支持自定义安装蒙泰驱动。
返回字节数,jsonBuf类型如下
{
"printerList":[
{"driver":"YongLi 4c32","ports":["YongLi_Port","FILE:","RAW_127.0.0.1","RAW_192.168.7.122"],"sel":"YongLi_Port"},
{"driver":"xlfep32 Printer","ports":["print","FILE:","RAW_127.0.0.1","RAW_192.168.7.122"],"sel":"print"}],
"sel":"YongLi 4c32"
}
printerList为打印驱动列表:其中driver表示驱动,ports表示端口列表;sel为当前设置。
bool Stdcall ConfigPrinter(const MainTopLayoutParam *param)
设置打印设备。data为json字符串,size为串大小。具体字段如下:
{
"driver": 0,
"port": 0
}
driver表示驱动索引,port为端口索引,均以0开始,具体范围请参照GetPrinterList返回结果。
bool Stdcall SetConnectParam(const MainTopLayoutParam *param)
可在dtpPlugin.json中查看或者更改监听地址。
在排版之前,需要设定好目标机器的ip地址(可包含端口,如果不包含则使用默认端口),只需要设置一次。
若不设置或者连接失败,则不支持网络通信。
data为指定ip地址, 使用utf-8编码;dataSize为ip长度。
返回值为ture表示目标机器的蒙泰程序和服务已经启动,才能正常通信。
void Stdcall CloseConnect()
用于断开网络连接(仅网络版本有效)
MainTopLayoutResult Stdcall LayoutReport(const MainTopLayoutParam *p, char *jsonReport)
和Layout类似,仅仅多出一个jsonReport,用于获取不支持的图片信息。
获取的jsonReport格式如下:
{
"failedPictures": [
{"name":"D:\\failed1.JPG",
"copies": 1
},
{"name":"D:\\failed1.JPG",
"copies": 2
]
}
bool Stdcall LoadLayoutFile(const MainTopLayoutParam *p);
加载TPF文件到蒙泰文档。
bool Stdcall CloseLayoutFile(const MainTopLayoutParam *p);
关闭TPF文档。
bool Stdcall SetDtpCurrentDirectory(const MainTopLayoutParam *p);
设定图像所在位置的目录,便于以相对路径取图。
bool Stdcall SetDtpClientAddress(const MainTopLayoutParam *p);
参数为client对象的数组,用于设置客户端地址列表,格式如下:
{
"client": [a.b.c.d:p1,
a.b.e.f:p2,
a.b.g.h:p3,
...
}
int Stdcall GetImageNameList(const MainTopLayoutParam *p, char *jsonBuf);
此处参数p暂时无意义,可为空。
获取版面图像名列表,返回字节数。
获取的jsonBuf格式如下(多页情况):
{
"page": [
{
"nameList": ["E:\\file\\picture\\a.jpg",
"E:\\file\\picture\\b.jpg"
]
},
{
"nameList": ["E:\\file\\picture\\c.jpg"]
},
{
"nameList": ["E:\\file\\picture\\d.jpg",
"E:\\file\\picture\\a.jpg",
"E:\\file\\picture\\f.jpg"
]
}
]
}