|
@@ -9,19 +9,19 @@
|
|
|
<div class="cmenu-item" style="padding-top: 20vh;">
|
|
|
<el-row :gutter="40">
|
|
|
<el-col :span="8">
|
|
|
- <div class="citem-nav" @click="menuIndex = '1'">
|
|
|
+ <div class="citem-nav" @click="selectMenuIndex('1')">
|
|
|
<img src="../assets/image/w-img.png" class="citem-img" />
|
|
|
<p class="citem-name">图片水印</p>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <div class="citem-nav" @click="menuIndex = '2'">
|
|
|
+ <div class="citem-nav" @click="selectMenuIndex('2')">
|
|
|
<img src="../assets/image/w-pdf.png" class="citem-img" />
|
|
|
<p class="citem-name">PDF水印</p>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <div class="citem-nav" @click="menuIndex = '3'">
|
|
|
+ <div class="citem-nav" @click="selectMenuIndex('3')">
|
|
|
<img src="../assets/image/w-video.png" class="citem-img" />
|
|
|
<p class="citem-name">视频水印</p>
|
|
|
</div>
|
|
@@ -205,7 +205,7 @@
|
|
|
<el-upload :style="{display: 'inline-block'}" action="/" :before-upload="getFontPath" accept=".ttf,.ttc">
|
|
|
<vxe-button icon="vxe-icon-add" circle size="mini" title="导入自定义字体"></vxe-button>
|
|
|
</el-upload>
|
|
|
- <vxe-button type="text" status="info" icon="vxe-icon-info-circle-fill" @click="$message({message:'文字为中文时,请选择中文字体!', type:'warning'})"></vxe-button>
|
|
|
+ <vxe-button type="text" status="info" icon="vxe-icon-info-circle-fill" @click="$message({message:'文字为中文时请选择中文字体;PDF水印自定义字体仅支持ttf格式', type:'warning'})"></vxe-button>
|
|
|
</div>
|
|
|
<div class="handle-item">
|
|
|
<label class="handle-label">水印位置:</label>
|
|
@@ -314,15 +314,15 @@
|
|
|
</div>
|
|
|
<div class="handle-item">
|
|
|
<label class="handle-label">缩放比例:</label>
|
|
|
- <el-input-number size="mini" style="width: 158px;" v-model="item.scaling" @change="handleImg" :step="1" :min="1" :max="200"></el-input-number>%
|
|
|
+ <el-input-number size="mini" style="width: 158px;" v-model="item.scaling" @change="handleImg" :step="1" :min="1" :max="200"></el-input-number> %
|
|
|
</div>
|
|
|
<div class="handle-item">
|
|
|
<label class="handle-label">不透明度:</label>
|
|
|
- <el-input-number size="mini" style="width: 158px;" v-model="item.watermarkImgOpactiy" @change="handleImg" :step="1" :min="1" :max="100"></el-input-number>%
|
|
|
+ <el-input-number size="mini" style="width: 158px;" v-model="item.watermarkImgOpactiy" @change="handleImg" :step="1" :min="1" :max="100"></el-input-number> %
|
|
|
</div>
|
|
|
<div class="handle-item">
|
|
|
<label class="handle-label">旋转角度:</label>
|
|
|
- <el-input-number size="mini" v-model="item.rotate" @change="handleImg"></el-input-number>
|
|
|
+ <el-input-number size="mini" style="width: 158px;" v-model="item.rotate" @change="handleImg"></el-input-number>
|
|
|
</div>
|
|
|
|
|
|
<div class="handle-item">
|
|
@@ -564,6 +564,7 @@ export default {
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
this.watermarkImgList.splice(index, 1);
|
|
|
+ this.handleImg();
|
|
|
}).catch(() => {
|
|
|
});
|
|
|
},
|
|
@@ -637,6 +638,44 @@ export default {
|
|
|
spinLoad.close();
|
|
|
});
|
|
|
},
|
|
|
+ selectMenuIndex(index){
|
|
|
+ this.menuIndex = index;
|
|
|
+ if(index == '2'){
|
|
|
+ this.fonts[0].options = [
|
|
|
+ {
|
|
|
+ name:'仿宋',
|
|
|
+ path:'c:\\windows\\fonts\\simfang.ttf',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'楷体',
|
|
|
+ path:'c:\\windows\\fonts\\simkai.ttf',
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ }else{
|
|
|
+ this.fonts[0].options = [
|
|
|
+ {
|
|
|
+ name:'宋体',
|
|
|
+ path:'c:\\windows\\fonts\\simsun.ttc',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'仿宋',
|
|
|
+ path:'c:\\windows\\fonts\\simfang.ttf',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'楷体',
|
|
|
+ path:'c:\\windows\\fonts\\simkai.ttf',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'微软雅黑 常规',
|
|
|
+ path:'c:\\windows\\fonts\\msyh.ttc',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'微软雅黑 粗体',
|
|
|
+ path:'c:\\windows\\fonts\\msyhbd.ttc'
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ },
|
|
|
tabBefore(newName, oldName){
|
|
|
this.isChange = true;
|
|
|
},
|
|
@@ -644,6 +683,28 @@ export default {
|
|
|
tabChange(e){
|
|
|
if(this.isChange){
|
|
|
if(e.name == '1'){
|
|
|
+ this.fonts[0].options = [
|
|
|
+ {
|
|
|
+ name:'宋体',
|
|
|
+ path:'c:\\windows\\fonts\\simsun.ttc',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'仿宋',
|
|
|
+ path:'c:\\windows\\fonts\\simfang.ttf',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'楷体',
|
|
|
+ path:'c:\\windows\\fonts\\simkai.ttf',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'微软雅黑 常规',
|
|
|
+ path:'c:\\windows\\fonts\\msyh.ttc',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'微软雅黑 粗体',
|
|
|
+ path:'c:\\windows\\fonts\\msyhbd.ttc'
|
|
|
+ }
|
|
|
+ ];
|
|
|
if(this.imgList.length > 0){
|
|
|
setTimeout(() => {
|
|
|
this.$refs.imgTable.setCurrentRow(this.imgList[0]);
|
|
@@ -651,6 +712,19 @@ export default {
|
|
|
this.setDefaultImgInfo(this.imgList[0], 0);
|
|
|
}
|
|
|
}else if(e.name == '2'){
|
|
|
+ this.fonts[0].options = [
|
|
|
+ {
|
|
|
+ name:'仿宋',
|
|
|
+ path:'c:\\windows\\fonts\\simfang.ttf',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'楷体',
|
|
|
+ path:'c:\\windows\\fonts\\simkai.ttf',
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ if(this.handleData.fonts.indexOf('.ttf') == -1){
|
|
|
+ this.handleData.fonts = 'c:\\windows\\fonts\\simkai.ttf';
|
|
|
+ }
|
|
|
if(this.fileList.length > 0){
|
|
|
setTimeout(() => {
|
|
|
this.$refs.fileTable.setCurrentRow(this.fileList[0]);
|
|
@@ -658,6 +732,28 @@ export default {
|
|
|
this.setDefaultImgInfo(this.fileList[0], 0);
|
|
|
}
|
|
|
}else{
|
|
|
+ this.fonts[0].options = [
|
|
|
+ {
|
|
|
+ name:'宋体',
|
|
|
+ path:'c:\\windows\\fonts\\simsun.ttc',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'仿宋',
|
|
|
+ path:'c:\\windows\\fonts\\simfang.ttf',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'楷体',
|
|
|
+ path:'c:\\windows\\fonts\\simkai.ttf',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'微软雅黑 常规',
|
|
|
+ path:'c:\\windows\\fonts\\msyh.ttc',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'微软雅黑 粗体',
|
|
|
+ path:'c:\\windows\\fonts\\msyhbd.ttc'
|
|
|
+ }
|
|
|
+ ];
|
|
|
if(this.videoList.length > 0){
|
|
|
setTimeout(() => {
|
|
|
this.$refs.videoTable.setCurrentRow(this.videoList[0]);
|
|
@@ -1235,7 +1331,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
const rgbObj = this.getRgb();
|
|
|
- const position = this.getPosition(pdfInfo, customFont, imgSource, this.handleData.watermarkPosition);
|
|
|
+ const position = this.getPosition(pdfInfo, customFont, imgSource);
|
|
|
const positionObj = this.getXY(customFont,imgSource);
|
|
|
const pages = pdfDoc.getPages();
|
|
|
let percent = 0;
|
|
@@ -1331,7 +1427,6 @@ export default {
|
|
|
if(this.watermarkImgList.length > 0 && this.handleData.watermarkStyle == 3){
|
|
|
for(let i = 0; i < this.watermarkImgList.length; i++){
|
|
|
witem = this.watermarkImgList[i];
|
|
|
- console.log(witem)
|
|
|
if(witem.watermarkImgPath){
|
|
|
const buffer2 = await electronApi.fileStream(witem.watermarkImgPath);
|
|
|
if(witem.watermarkImgType == 'jpg'){
|
|
@@ -1342,7 +1437,7 @@ export default {
|
|
|
imgSource2 = await pdfDoc.embedPdf(buffer2);
|
|
|
}
|
|
|
|
|
|
- position2 = this.getPosition(pdfInfo, customFont, imgSource2, witem.watermarkPosition);
|
|
|
+ position2 = this.getPosition(pdfInfo, customFont, imgSource2, witem);
|
|
|
positionObj2 = this.getXY(customFont, imgSource2, witem);
|
|
|
|
|
|
item.drawImage(imgSource2, {
|
|
@@ -1399,8 +1494,12 @@ export default {
|
|
|
})
|
|
|
});
|
|
|
},
|
|
|
- getPosition(pdfInfo, customFont, imgSource, watermarkPosition){
|
|
|
- let positionObj = this.getXY(customFont,imgSource);
|
|
|
+ getPosition(pdfInfo, customFont, imgSource, info){
|
|
|
+ let watermarkPosition = this.handleData.watermarkPosition;
|
|
|
+ if(info){
|
|
|
+ watermarkPosition = info.watermarkPosition;
|
|
|
+ }
|
|
|
+ let positionObj = this.getXY(customFont,imgSource, info);
|
|
|
let xFix = positionObj.x;
|
|
|
let yFix = positionObj.y;
|
|
|
let diffHeight = positionObj.diffHeight;
|