Skip to content

Commit 4fed859

Browse files
committed
支持选择是否切边
1 parent 2c4a334 commit 4fed859

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

PDFQFZ/Form1.Designer.cs

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PDFQFZ/Form1.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ public partial class Form1 : Form
2222
DataTable dtPos = new DataTable();//PDF各文件印章位置表
2323
DataTable dtYz = new DataTable();//PDF列表
2424
string sourcePath = "",outputPath = "",imgPath = "",previewPath = "",signText = "", password="";
25-
int wjType = 1, qfzType = 0, yzType = 0, djType = 0, qmType = 0, wzType = 3, size = 40, rotation = 0, opacity = 100, wz = 50, yzr = 10, maximg = 250,maxfgs = 20;
25+
int wjType = 1, qfzType = 0, yzType = 0, djType = 0, qmType = 0, wzType = 3, qbflag = 0, size = 40, rotation = 0, opacity = 100, wz = 50, yzr = 10, maximg = 250, maxfgs = 20;
2626
Bitmap imgYz = null;
2727
X509Certificate2 cert = null;//证书
28+
float xzbl = 1f;
2829

2930

3031

@@ -55,6 +56,7 @@ private void Form1_Load(object sender, EventArgs e)
5556
comboDJ.SelectedIndex = djType;
5657
comboQmtype.SelectedIndex = qmType;
5758
comboBoxWZ.SelectedIndex = wzType;
59+
comboBoxQB.SelectedIndex = qbflag;
5860
fw = this.Width;
5961
fh = this.Height;
6062
dtYz.Columns.Add("Name", typeof(string));
@@ -100,6 +102,7 @@ private void button1_Click(object sender, EventArgs e)
100102
djType = comboDJ.SelectedIndex;
101103
qmType = comboQmtype.SelectedIndex;
102104
wzType = comboBoxWZ.SelectedIndex;
105+
qbflag = comboBoxQB.SelectedIndex;
103106

104107
if (qfzType == 1&& yzType == 0 && qmType == 0)
105108
{
@@ -209,7 +212,8 @@ private void pdfGz()
209212

210213
if (rotation != 0)
211214
{
212-
imgYz = RotateImg(imgYz, rotation);
215+
bool qb = qbflag==0?true: false;
216+
imgYz = RotateImg(imgYz, rotation, qb);
213217
}
214218
if (opacity < 100)
215219
{
@@ -329,6 +333,7 @@ public Bitmap RotateImg(System.Drawing.Image b, int angle,bool original = true)
329333
W = w;
330334
}
331335

336+
xzbl = 1f * W / w;
332337

333338
//目标位图
334339
Bitmap dsImage = new Bitmap(W, H);
@@ -393,7 +398,7 @@ private static Bitmap[] subImages(Bitmap img, int n)//图片分割
393398
//PDF盖章
394399
private bool PDFWatermark(string inputfilepath, string outputfilepath)
395400
{
396-
float sfbl = 100f * size * 2.842f / imgYz.Height;
401+
float sfbl = 100f * size * xzbl * 2.842f / imgYz.Height;
397402

398403
//PdfGState state = new PdfGState();
399404
//state.FillOpacity = 0.01f*opacity;//印章图片不透明度

0 commit comments

Comments
 (0)