Skip to content

Commit

Permalink
支持选择是否切边
Browse files Browse the repository at this point in the history
  • Loading branch information
flytkgl committed Sep 9, 2023
1 parent 2c4a334 commit 4fed859
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
17 changes: 16 additions & 1 deletion PDFQFZ/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions PDFQFZ/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ public partial class Form1 : Form
DataTable dtPos = new DataTable();//PDF各文件印章位置表
DataTable dtYz = new DataTable();//PDF列表
string sourcePath = "",outputPath = "",imgPath = "",previewPath = "",signText = "", password="";
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;
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;
Bitmap imgYz = null;
X509Certificate2 cert = null;//证书
float xzbl = 1f;



Expand Down Expand Up @@ -55,6 +56,7 @@ private void Form1_Load(object sender, EventArgs e)
comboDJ.SelectedIndex = djType;
comboQmtype.SelectedIndex = qmType;
comboBoxWZ.SelectedIndex = wzType;
comboBoxQB.SelectedIndex = qbflag;
fw = this.Width;
fh = this.Height;
dtYz.Columns.Add("Name", typeof(string));
Expand Down Expand Up @@ -100,6 +102,7 @@ private void button1_Click(object sender, EventArgs e)
djType = comboDJ.SelectedIndex;
qmType = comboQmtype.SelectedIndex;
wzType = comboBoxWZ.SelectedIndex;
qbflag = comboBoxQB.SelectedIndex;

if (qfzType == 1&& yzType == 0 && qmType == 0)
{
Expand Down Expand Up @@ -209,7 +212,8 @@ private void pdfGz()

if (rotation != 0)
{
imgYz = RotateImg(imgYz, rotation);
bool qb = qbflag==0?true: false;
imgYz = RotateImg(imgYz, rotation, qb);
}
if (opacity < 100)
{
Expand Down Expand Up @@ -329,6 +333,7 @@ public Bitmap RotateImg(System.Drawing.Image b, int angle,bool original = true)
W = w;
}

xzbl = 1f * W / w;

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

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

0 comments on commit 4fed859

Please sign in to comment.