mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-04-05 20:55:01 +08:00
Merge pull request #436 from UglyToad/net6-target-framework
Net6 target framework
This commit is contained in:
commit
d2864f761a
6
.github/workflows/build_and_test.yml
vendored
6
.github/workflows/build_and_test.yml
vendored
@ -13,9 +13,11 @@ jobs:
|
|||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
|
|
||||||
- name: Set up dotnet core
|
- name: Set up dotnet core
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v2
|
||||||
with:
|
with:
|
||||||
dotnet-version: "2.1.x"
|
dotnet-version: |
|
||||||
|
2.1.x
|
||||||
|
6.0.x
|
||||||
|
|
||||||
- name: Add msbuild to PATH
|
- name: Add msbuild to PATH
|
||||||
uses: microsoft/setup-msbuild@v1.0.2
|
uses: microsoft/setup-msbuild@v1.0.2
|
||||||
|
6
.github/workflows/nightly_release.yml
vendored
6
.github/workflows/nightly_release.yml
vendored
@ -30,9 +30,11 @@ jobs:
|
|||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
|
|
||||||
- name: Set up dotnet core
|
- name: Set up dotnet core
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v2
|
||||||
with:
|
with:
|
||||||
dotnet-version: "2.1.x"
|
dotnet-version: |
|
||||||
|
2.1.x
|
||||||
|
6.0.x
|
||||||
|
|
||||||
- name: Add msbuild to PATH
|
- name: Add msbuild to PATH
|
||||||
uses: microsoft/setup-msbuild@v1.0.2
|
uses: microsoft/setup-msbuild@v1.0.2
|
||||||
|
@ -45,7 +45,7 @@ Open `.\src\UglyToad.PdfPig\UglyToad.PdfPig.csproj` in a text editor and change:
|
|||||||
|
|
||||||
```
|
```
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45;net451;net452;net46;net461;net462;net47</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45;net451;net452;net46;net461;net462;net47;net6.0</TargetFrameworks>
|
||||||
<PackageId>PdfPig</PackageId>
|
<PackageId>PdfPig</PackageId>
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45;net451;net452;net46;net461;net462;net47</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45;net451;net452;net46;net461;net462;net47;net6.0</TargetFrameworks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Version>0.1.6-alpha001</Version>
|
<Version>0.1.6-alpha001</Version>
|
||||||
<IsTestProject>False</IsTestProject>
|
<IsTestProject>False</IsTestProject>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45;net451;net452;net46;net461;net462;net47</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45;net451;net452;net46;net461;net462;net47;net6.0</TargetFrameworks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Version>0.1.6-alpha001</Version>
|
<Version>0.1.6-alpha001</Version>
|
||||||
<IsTestProject>False</IsTestProject>
|
<IsTestProject>False</IsTestProject>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45;net451;net452;net46;net461;net462;net47</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45;net451;net452;net46;net461;net462;net47;net6.0</TargetFrameworks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Version>0.1.6-alpha001</Version>
|
<Version>0.1.6-alpha001</Version>
|
||||||
<IsTestProject>False</IsTestProject>
|
<IsTestProject>False</IsTestProject>
|
||||||
|
@ -23,7 +23,9 @@ namespace UglyToad.PdfPig.Tests.Encryption
|
|||||||
|
|
||||||
var output = AesEncryptionHelper.Decrypt(data, key);
|
var output = AesEncryptionHelper.Decrypt(data, key);
|
||||||
|
|
||||||
Assert.Equal("D:20180808103317-07'00'", OtherEncodings.BytesAsLatin1String(output));
|
var actual = OtherEncodings.BytesAsLatin1String(output);
|
||||||
|
|
||||||
|
Assert.Equal("D:20180808103317-07'00'", actual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ using Xunit;
|
|||||||
|
|
||||||
namespace UglyToad.PdfPig.Tests.Fonts.SystemFonts
|
namespace UglyToad.PdfPig.Tests.Fonts.SystemFonts
|
||||||
{
|
{
|
||||||
|
using PdfPig.Core;
|
||||||
|
|
||||||
public class Linux
|
public class Linux
|
||||||
{
|
{
|
||||||
public static IEnumerable<object[]> DataExtract => new[]
|
public static IEnumerable<object[]> DataExtract => new[]
|
||||||
@ -12,19 +14,43 @@ namespace UglyToad.PdfPig.Tests.Fonts.SystemFonts
|
|||||||
new object[]
|
new object[]
|
||||||
{
|
{
|
||||||
"90 180 270 rotated.pdf",
|
"90 180 270 rotated.pdf",
|
||||||
new object[][]
|
new ExpectedLetterData[]
|
||||||
{
|
{
|
||||||
new object[] { "[(x:53.88, y:759.48), 2.495859375, 0]", 0.0 },
|
new ExpectedLetterData
|
||||||
new object[] { "[(x:514.925312502883, y:744.099765720344), 6.83203125, 7.94531249999983]", -90.0 },
|
{
|
||||||
new object[] { "[(x:512.505390717836, y:736.603703191305), 5.1796875, 5.68945312499983]", -90.0 },
|
TopLeft = new PdfPoint(53.88, 759.48),
|
||||||
new object[] { "[(x:512.505390785898, y:730.931828191305), 3.99609375, 5.52539062499994]", -90.0 },
|
Width = 2.495859375,
|
||||||
|
Height = 0,
|
||||||
|
Rotation = 0
|
||||||
|
},
|
||||||
|
new ExpectedLetterData
|
||||||
|
{
|
||||||
|
TopLeft = new PdfPoint(514.925312502883, 744.099765720344),
|
||||||
|
Width = 6.83203125,
|
||||||
|
Height = 7.94531249999983,
|
||||||
|
Rotation = -90
|
||||||
|
},
|
||||||
|
new ExpectedLetterData
|
||||||
|
{
|
||||||
|
TopLeft = new PdfPoint(512.505390717836, 736.603703191305),
|
||||||
|
Width = 5.1796875,
|
||||||
|
Height = 5.68945312499983,
|
||||||
|
Rotation = -90
|
||||||
|
},
|
||||||
|
new ExpectedLetterData
|
||||||
|
{
|
||||||
|
TopLeft = new PdfPoint(512.505390785898, 730.931828191305),
|
||||||
|
Width = 3.99609375,
|
||||||
|
Height = 5.52539062499994,
|
||||||
|
Rotation = -90
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
[SkippableTheory]
|
[SkippableTheory]
|
||||||
[MemberData(nameof(DataExtract))]
|
[MemberData(nameof(DataExtract))]
|
||||||
public void GetCorrectBBoxLinux(string name, object[][] expected)
|
public void GetCorrectBBoxLinux(string name, ExpectedLetterData[] expected)
|
||||||
{
|
{
|
||||||
// success on Windows but LinuxSystemFontLister cannot find the 'TimesNewRomanPSMT' font
|
// success on Windows but LinuxSystemFontLister cannot find the 'TimesNewRomanPSMT' font
|
||||||
var font = SystemFontFinder.Instance.GetTrueTypeFont("TimesNewRomanPSMT");
|
var font = SystemFontFinder.Instance.GetTrueTypeFont("TimesNewRomanPSMT");
|
||||||
@ -36,13 +62,28 @@ namespace UglyToad.PdfPig.Tests.Fonts.SystemFonts
|
|||||||
var page = document.GetPage(1);
|
var page = document.GetPage(1);
|
||||||
for (int i = 0; i < expected.Length; i++)
|
for (int i = 0; i < expected.Length; i++)
|
||||||
{
|
{
|
||||||
string bbox = (string)expected[i][0];
|
var expectedData = expected[i];
|
||||||
var rotation = (double)expected[i][1];
|
|
||||||
var current = page.Letters[i];
|
var current = page.Letters[i];
|
||||||
Assert.Equal(bbox, current.GlyphRectangle.ToString());
|
|
||||||
Assert.Equal(rotation, current.GlyphRectangle.Rotation, 3);
|
Assert.Equal(expectedData.TopLeft.X, current.GlyphRectangle.TopLeft.X, 7);
|
||||||
|
Assert.Equal(expectedData.TopLeft.Y, current.GlyphRectangle.TopLeft.Y, 7);
|
||||||
|
Assert.Equal(expectedData.Width, current.GlyphRectangle.Width, 7);
|
||||||
|
Assert.Equal(expectedData.Height, current.GlyphRectangle.Height, 7);
|
||||||
|
Assert.Equal(expectedData.Rotation, current.GlyphRectangle.Rotation, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ExpectedLetterData
|
||||||
|
{
|
||||||
|
public PdfPoint TopLeft { get; set; }
|
||||||
|
|
||||||
|
public double Width { get; set; }
|
||||||
|
|
||||||
|
public double Height { get; set; }
|
||||||
|
|
||||||
|
public double Rotation { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFrameworks>netcoreapp2.0;net6.0</TargetFrameworks>
|
||||||
<IsTestProject>true</IsTestProject>
|
<IsTestProject>true</IsTestProject>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45;net451;net452;net46;net461;net462;net47</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45;net451;net452;net46;net461;net462;net47;net6.0</TargetFrameworks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Version>0.1.6-alpha001</Version>
|
<Version>0.1.6-alpha001</Version>
|
||||||
<IsTestProject>False</IsTestProject>
|
<IsTestProject>False</IsTestProject>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45;net451;net452;net46;net461;net462;net47</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45;net451;net452;net46;net461;net462;net47;net6.0</TargetFrameworks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Version>0.1.6-alpha001</Version>
|
<Version>0.1.6-alpha001</Version>
|
||||||
<IsTestProject>False</IsTestProject>
|
<IsTestProject>False</IsTestProject>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
namespace UglyToad.PdfPig.Encryption
|
namespace UglyToad.PdfPig.Encryption
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
@ -20,7 +21,7 @@
|
|||||||
|
|
||||||
var iv = new byte[16];
|
var iv = new byte[16];
|
||||||
Array.Copy(data, iv, iv.Length);
|
Array.Copy(data, iv, iv.Length);
|
||||||
|
|
||||||
using (var rijndael = Rijndael.Create())
|
using (var rijndael = Rijndael.Create())
|
||||||
{
|
{
|
||||||
rijndael.Key = finalKey;
|
rijndael.Key = finalKey;
|
||||||
@ -28,6 +29,11 @@
|
|||||||
|
|
||||||
var buffer = new byte[256];
|
var buffer = new byte[256];
|
||||||
|
|
||||||
|
if (data.Length > 256)
|
||||||
|
{
|
||||||
|
Debugger.Break();
|
||||||
|
}
|
||||||
|
|
||||||
using (var decryptor = rijndael.CreateDecryptor(rijndael.Key, rijndael.IV))
|
using (var decryptor = rijndael.CreateDecryptor(rijndael.Key, rijndael.IV))
|
||||||
using (var input = new MemoryStream(data))
|
using (var input = new MemoryStream(data))
|
||||||
using (var output = new MemoryStream())
|
using (var output = new MemoryStream())
|
||||||
@ -36,15 +42,15 @@
|
|||||||
using (var cryptoStream = new CryptoStream(input, decryptor, CryptoStreamMode.Read))
|
using (var cryptoStream = new CryptoStream(input, decryptor, CryptoStreamMode.Read))
|
||||||
{
|
{
|
||||||
int read;
|
int read;
|
||||||
while ((read = cryptoStream.Read(buffer, 0, buffer.Length)) != -1)
|
do
|
||||||
{
|
{
|
||||||
output.Write(buffer, 0, read);
|
read = cryptoStream.Read(buffer, 0, buffer.Length);
|
||||||
|
|
||||||
if (read < buffer.Length)
|
if (read > 0)
|
||||||
{
|
{
|
||||||
break;
|
output.Write(buffer, 0, read);
|
||||||
}
|
}
|
||||||
}
|
} while (read > 0);
|
||||||
|
|
||||||
return output.ToArray();
|
return output.ToArray();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45;net451;net452;net46;net461;net462;net47</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45;net451;net452;net46;net461;net462;net47;net6.0</TargetFrameworks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Version>0.1.6-alpha001</Version>
|
<Version>0.1.6-alpha001</Version>
|
||||||
<IsTestProject>False</IsTestProject>
|
<IsTestProject>False</IsTestProject>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45;net451;net452;net46;net461;net462;net47</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45;net451;net452;net46;net461;net462;net47;net6.0</TargetFrameworks>
|
||||||
<PackageId>PdfPig</PackageId>
|
<PackageId>PdfPig</PackageId>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Authors>UglyToad</Authors>
|
<Authors>UglyToad</Authors>
|
||||||
|
Loading…
Reference in New Issue
Block a user