Skip to content

Commit 3dd32e3

Browse files
committed
[RELEASE] iText 7 pdfSweep - 2.0.7
https://github.com/itext/i7n-pdfsweep/releases/tag/2.0.7 * release_branch_DEVSIX-5154: [RELEASE] pdfSweep 2.0.7 Adjust cleanup project to use new csproj file tooling Add test for TextPosition Fix NPE in TextPositioning Add constructor of PdfDocument to try-with-resources Update port-hash after release [AFTER RELEASE] pdfSweep 2.0.6
2 parents 0c739fe + bda3216 commit 3dd32e3

File tree

12 files changed

+223
-266
lines changed

12 files changed

+223
-266
lines changed

doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
3232
# title of most generated pages and in a few other places.
3333
# The default value is: My Project.
3434

35-
PROJECT_NAME = "pdfSweep 2.0.6 API"
35+
PROJECT_NAME = "pdfSweep 2.0.7 API"
3636

3737
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
3838
# could be handy for archiving the generated documentation or if some version

itext.tests/itext.cleanup.tests/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
[assembly: Guid("647c862e-d837-4901-8e7b-68f5f8bf8f34")]
1717

18-
[assembly: AssemblyVersion("2.0.6.0")]
19-
[assembly: AssemblyFileVersion("2.0.6.0")]
20-
[assembly: AssemblyInformationalVersion("2.0.6")]
18+
[assembly: AssemblyVersion("2.0.7.0")]
19+
[assembly: AssemblyFileVersion("2.0.7.0")]
20+
[assembly: AssemblyInformationalVersion("2.0.7")]
2121

2222
[assembly: NUnit.Framework.Timeout(300000)]
Lines changed: 47 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,49 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0" DefaultTargets="Build">
3-
<Import Project="$(SolutionDir)\packages\itext7.pdftest.7.1.15\build\itext7.pdftest.props" Condition="Exists('$(SolutionDir)\packages\itext7.pdftest.7.1.15\build\itext7.pdftest.props')" />
4-
<PropertyGroup>
5-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
<ProductVersion>8.0.30703</ProductVersion>
8-
<SchemaVersion>2.0</SchemaVersion>
9-
<ProjectGuid>{A23889C9-FB5D-41DD-883F-7C1D78FA0D7D}</ProjectGuid>
10-
<OutputType>Library</OutputType>
11-
<AppDesignerFolder>Properties</AppDesignerFolder>
12-
<AssemblyName>itext.cleanup.tests</AssemblyName>
13-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
14-
<FileAlignment>512</FileAlignment>
15-
</PropertyGroup>
16-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17-
<DebugSymbols>true</DebugSymbols>
18-
<DebugType>full</DebugType>
19-
<Optimize>false</Optimize>
20-
<OutputPath>bin\Debug\</OutputPath>
21-
<DefineConstants>DEBUG;TRACE</DefineConstants>
22-
<ErrorReport>prompt</ErrorReport>
23-
<WarningLevel>4</WarningLevel>
24-
<NoWarn>CS1591;CS1570;CS1572;CS1573;CS1574;CS1580;CS1584;CS1658</NoWarn>
25-
</PropertyGroup>
26-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27-
<DebugType>pdbonly</DebugType>
28-
<Optimize>true</Optimize>
29-
<OutputPath>bin\Release\</OutputPath>
30-
<DefineConstants>TRACE</DefineConstants>
31-
<ErrorReport>prompt</ErrorReport>
32-
<WarningLevel>4</WarningLevel>
33-
<NoWarn>CS1591;CS1570;CS1572;CS1573;CS1574;CS1580;CS1584;CS1658</NoWarn>
34-
</PropertyGroup>
35-
<PropertyGroup>
36-
<SignAssembly>true</SignAssembly>
37-
</PropertyGroup>
38-
<PropertyGroup>
39-
<AssemblyOriginatorKeyFile>itext.snk</AssemblyOriginatorKeyFile>
40-
</PropertyGroup>
41-
<ItemGroup>
42-
<Reference Include="nunit.framework, Version=3.7.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
43-
<HintPath>$(SolutionDir)\packages\NUnit.3.7.1\lib\net45\nunit.framework.dll</HintPath>
44-
<Private>True</Private>
45-
</Reference>
46-
<Reference Include="System" />
47-
<Reference Include="System.Core" />
48-
</ItemGroup>
49-
<ItemGroup>
50-
<Compile Include="Properties\AssemblyInfo.cs" />
51-
<Compile Include="itext\pdfcleanup\**\*.cs" />
52-
</ItemGroup>
53-
<ItemGroup>
54-
<None Include="itext.snk" />
55-
<None Include="packages.config" />
56-
</ItemGroup>
57-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
58-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
59-
Other similar extension points exist, see Microsoft.Common.targets.
60-
<Target Name="BeforeBuild">
61-
</Target>
62-
<Target Name="AfterBuild">
63-
</Target>
64-
-->
65-
<ItemGroup>
66-
<ProjectReference Include="..\..\..\itextcore\itext\itext.io\itext.io.csproj" Condition="Exists('..\..\..\itextcore\itext\itext.io\itext.io.csproj')">
67-
<Project>{CEE5E7E1-1BF0-4BE1-9941-903262CE2F83}</Project>
68-
<Name>itext.io</Name>
69-
</ProjectReference>
70-
<Reference Include="itext.io, Version=7.1.15.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca" Condition="!Exists('..\..\..\itextcore\itext\itext.io\itext.io.csproj')">
71-
<HintPath>$(SolutionDir)\packages\itext7.7.1.15\lib\net45\itext.io.dll</HintPath>
72-
</Reference>
73-
<ProjectReference Include="..\..\..\itextcore\itext\itext.kernel\itext.kernel.csproj" Condition="Exists('..\..\..\itextcore\itext\itext.kernel\itext.kernel.csproj')">
74-
<Project>{4E7819E8-7555-4E2E-9A01-D8718A2CFDDA}</Project>
75-
<Name>itext.kernel</Name>
76-
</ProjectReference>
77-
<Reference Include="BouncyCastle.Crypto, Version=1.8.9.0, Culture=neutral, PublicKeyToken=0e99375e54769942" Condition="!Exists('..\..\..\itextcore\itext\itext.kernel\itext.kernel.csproj')">
78-
<HintPath>$(SolutionDir)\packages\Portable.BouncyCastle.1.8.9\lib\net40\BouncyCastle.Crypto.dll</HintPath>
79-
</Reference>
80-
<Reference Include="itext.kernel, Version=7.1.15.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca" Condition="!Exists('..\..\..\itextcore\itext\itext.kernel\itext.kernel.csproj')">
81-
<HintPath>$(SolutionDir)\packages\itext7.7.1.15\lib\net45\itext.kernel.dll</HintPath>
82-
</Reference>
83-
<ProjectReference Include="..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.csproj" Condition="Exists('..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.csproj')">
84-
<Project>{F9880DC4-F015-4413-AF86-66D0E9512774}</Project>
85-
<Name>itext.pdftest</Name>
86-
</ProjectReference>
87-
<Reference Include="itext.pdftest, Version=7.1.15.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca" Condition="!Exists('..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.csproj')">
88-
<HintPath>$(SolutionDir)\packages\itext7.pdftest.7.1.15\lib\net45\itext.pdftest.dll</HintPath>
89-
</Reference>
90-
<ProjectReference Include="..\..\itext\itext.cleanup\itext.cleanup.csproj">
91-
<Project>{2F9B8138-96D5-4DF7-A011-61FE24900987}</Project>
92-
<Name>itext.cleanup</Name>
93-
</ProjectReference>
94-
</ItemGroup>
2+
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
3+
<PropertyGroup Label="Configuration">
4+
<SignAssembly>True</SignAssembly>
5+
<DelaySign>False</DelaySign>
6+
<RootNamespace></RootNamespace>
7+
</PropertyGroup>
8+
<PropertyGroup>
9+
<TargetFrameworks>net45</TargetFrameworks>
10+
</PropertyGroup>
11+
<PropertyGroup>
12+
<OutputType>library</OutputType>
13+
<IsTestProject>true</IsTestProject>
14+
</PropertyGroup>
15+
<PropertyGroup>
16+
<AssemblyOriginatorKeyFile>itext.snk</AssemblyOriginatorKeyFile>
17+
</PropertyGroup>
18+
<PropertyGroup>
19+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
20+
<ApplicationIcon />
21+
<OutputTypeEx>library</OutputTypeEx>
22+
<StartupObject />
23+
<AssemblyName>itext.cleanup.tests</AssemblyName>
24+
</PropertyGroup>
25+
<ItemGroup>
26+
<PackageReference Include="TeamCity.VSTest.TestAdapter" Version="1.0.0" />
27+
<PackageReference Include="NUnit" Version="3.7.1" />
28+
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0" />
29+
</ItemGroup>
30+
<ItemGroup>
31+
<None Include="itext.snk" />
32+
<None Include="packages.config" />
33+
</ItemGroup>
34+
<PropertyGroup>
35+
<NoWarn>1701;1702;1591;1570;1572;1573;1574;1580;1584;1658</NoWarn>
36+
</PropertyGroup>
37+
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
38+
<Reference Include="System" />
39+
<Reference Include="System.Core" />
40+
</ItemGroup>
41+
<ItemGroup>
42+
<ProjectReference Include="..\..\..\itextcore\itext\itext.io\itext.io.netstandard.csproj" Condition="Exists('..\..\..\itextcore\itext\itext.io\itext.io.netstandard.csproj')" />
43+
<PackageReference Include="itext7" Version="7.1.16" Condition="!Exists('..\..\..\itextcore\itext\itext.io\itext.io.netstandard.csproj')" />
44+
<ProjectReference Include="..\..\..\itextcore\itext\itext.kernel\itext.kernel.netstandard.csproj" Condition="Exists('..\..\..\itextcore\itext\itext.kernel\itext.kernel.netstandard.csproj')" />
45+
<ProjectReference Include="..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.netstandard.csproj" Condition="Exists('..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.netstandard.csproj')" />
46+
<PackageReference Include="itext7.pdftest" Version="7.1.16" Condition="!Exists('..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.netstandard.csproj')" />
47+
<ProjectReference Include="..\..\itext\itext.cleanup\itext.cleanup.csproj" />
48+
</ItemGroup>
9549
</Project>
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2021 iText Group NV
4+
Authors: iText Software.
5+
6+
This program is offered under a commercial and under the AGPL license.
7+
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below.
8+
9+
AGPL licensing:
10+
This program is free software: you can redistribute it and/or modify
11+
it under the terms of the GNU Affero General Public License as published by
12+
the Free Software Foundation, either version 3 of the License, or
13+
(at your option) any later version.
14+
15+
This program is distributed in the hope that it will be useful,
16+
but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
GNU Affero General Public License for more details.
19+
20+
You should have received a copy of the GNU Affero General Public License
21+
along with this program. If not, see <https://www.gnu.org/licenses/>.
22+
*/
23+
using System;
24+
using System.Collections.Generic;
25+
using System.IO;
26+
using iText.IO.Font.Constants;
27+
using iText.Kernel.Font;
28+
using iText.Kernel.Pdf;
29+
using iText.Kernel.Pdf.Canvas;
30+
using iText.Test;
31+
32+
namespace iText.PdfCleanup {
33+
public class TextPositioningTest : ExtendedITextTest {
34+
public const float EPS = 0.0001F;
35+
36+
[NUnit.Framework.Test]
37+
public virtual void CheckNoNpeThrowsInWritePositioningOperatorTest() {
38+
PdfCanvas canvasForTest = CreateTestCanvas(1.0F);
39+
TextPositioning textPositioning = new TextPositioning();
40+
try {
41+
textPositioning.AppendPositioningOperator("T*", new List<PdfObject>());
42+
textPositioning.WritePositionedText("T*", new List<PdfObject>(), new PdfArray(), canvasForTest);
43+
}
44+
catch (NullReferenceException) {
45+
NUnit.Framework.Assert.Fail("We don't expect, that NPE will be thrown in this test!");
46+
}
47+
NUnit.Framework.Assert.AreEqual(0.0, canvasForTest.GetGraphicsState().GetLeading(), EPS);
48+
}
49+
50+
[NUnit.Framework.Test]
51+
public virtual void CheckNoNpeThrowsInWritePositioningTextTest() {
52+
PdfCanvas canvasForTest = CreateTestCanvas(2.0F);
53+
TextPositioning textPositioning = new TextPositioning();
54+
try {
55+
textPositioning.AppendPositioningOperator("'", new List<PdfObject>());
56+
textPositioning.WritePositionedText("'", new List<PdfObject>(), new PdfArray(), canvasForTest);
57+
}
58+
catch (NullReferenceException) {
59+
NUnit.Framework.Assert.Fail("We don't expect, that NPE will be thrown in this test!");
60+
}
61+
NUnit.Framework.Assert.AreEqual(0.0, canvasForTest.GetGraphicsState().GetLeading(), EPS);
62+
}
63+
64+
private static PdfCanvas CreateTestCanvas(float canvasLeading) {
65+
PdfDocument document = new PdfDocument(new PdfWriter(new MemoryStream()));
66+
PdfPage documentPage = document.AddNewPage();
67+
PdfCanvas canvas = new PdfCanvas(documentPage);
68+
canvas.SetLeading(canvasLeading);
69+
canvas.SetFontAndSize(PdfFontFactory.CreateFont(StandardFonts.COURIER), 14);
70+
return canvas;
71+
}
72+
}
73+
}

0 commit comments

Comments
 (0)