Skip to content

Commit 8c270ca

Browse files
committed
PNG格式的印章不处理背景透明,避免印章质量变差
1 parent 2024f3f commit 8c270ca

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

PDFQFZ/Form1.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,13 @@ private void pdfGz()
373373
}
374374

375375
imgYz = new Bitmap(imgPath);
376-
//默认把印章的白色部分重置为透明
377-
imgYz = SetWhiteToTransparent(imgYz);
376+
//判断印章图片是否PNG格式
377+
if (!imgYz.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Png))
378+
{
379+
//如果不是PNG格式,则把白色部分设置为透明
380+
imgYz = SetWhiteToTransparent(imgYz);
381+
}
382+
378383
//再判断是否需要调整整体的透明度
379384
if (opacity < 100)
380385
{

PDFQFZ/PDFQFZ.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@
7474
<StartupObject>PDFQFZ.Program</StartupObject>
7575
</PropertyGroup>
7676
<ItemGroup>
77-
<Reference Include="O2S.Components.PDFRender4NET, Version=4.5.1.2, Culture=neutral, processorArchitecture=MSIL">
78-
<SpecificVersion>False</SpecificVersion>
79-
<HintPath>F:\Downloads\O2S.Components.PDFRender4NET.dll</HintPath>
77+
<Reference Include="O2S.Components.PDFRender4NET">
78+
<HintPath>..\..\..\..\..\Downloads\O2S.Components.PDFRender4NET.dll</HintPath>
8079
</Reference>
8180
<Reference Include="System" />
8281
<Reference Include="System.Data" />

0 commit comments

Comments
 (0)