Skip to content

Commit d515322

Browse files
Merge pull request #160 from ArtifexSoftware/linux-dist
Updates to create linux distribution.
2 parents ad7d582 + a2a210a commit d515322

23 files changed

+4822
-1735
lines changed

Demo/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Program
77
{
88
static void Main(string[] args)
99
{
10+
Console.WriteLine("Hello World!");
1011
Document doc = new();
1112
Page page = doc.NewPage();
1213

MuPDF.NET/Document.cs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Runtime.InteropServices;
44
using System.Text;
55
using mupdf;
6+
using Newtonsoft.Json.Linq;
67

78
namespace MuPDF.NET
89
{
@@ -720,17 +721,21 @@ public void InitDocument()
720721
Dictionary<string, string> values = new Dictionary<string, string>()
721722
{
722723
{ "format", "format" },
723-
{ "title", "info:Title" },
724-
{ "author", "info:Author" },
725-
{ "subject", "info:Subject" },
726-
{ "keywords", "info:Keywords" },
727-
{ "creator", "info:Creator" },
728-
{ "producer", "info:Producer" },
729-
{ "creationDate", "info:CreationDate" },
730-
{ "modDate", "info:ModDate" },
731-
{ "trapped", "info:Trapped" }
732724
};
733725

726+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
727+
{
728+
values.Add("title", "info:Title");
729+
values.Add("author", "info:Author");
730+
values.Add("subject", "info:Subject");
731+
values.Add("keywords", "info:Keywords");
732+
values.Add("creator", "info:Creator");
733+
values.Add("producer", "info:Producer");
734+
values.Add("creationDate", "info:CreationDate");
735+
values.Add("modDate", "info:ModDate");
736+
values.Add("trapped", "info:Trapped");
737+
}
738+
734739
foreach ((string key, string value) in values)
735740
{
736741
MetaData.Add(key, GetMetadata(value));
@@ -4029,7 +4034,8 @@ public void Select(List<int> list)
40294034
Marshal.Copy(list.ToArray(), 0, pNumbers, list.Count);
40304035
SWIGTYPE_p_int swigNumbers = new SWIGTYPE_p_int(pNumbers, true);
40314036

4032-
pdf.pdf_rearrange_pages(list.Count, swigNumbers);
4037+
pdf.pdf_rearrange_pages(list.Count, swigNumbers, pdf_clean_options_structure.PDF_CLEAN_STRUCTURE_DROP);
4038+
40334039
ResetPageRefs();
40344040
}
40354041

MuPDF.NET/MuPDF.NET.csproj

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFrameworks>net8.0</TargetFrameworks>
55
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
66
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
7-
<UseMaui>true</UseMaui>
7+
<UseMaui>false</UseMaui>
88
<SingleProject>true</SingleProject>
99
<ImplicitUsings>enable</ImplicitUsings>
1010

@@ -16,7 +16,7 @@
1616
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
1717
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
1818
<Title>MuPDF.NET</Title>
19-
<Version>3.0.0</Version>
19+
<Version>3.1.2-rc.1</Version>
2020
<Authors>Maksym Tkachuk, Jamie Lemon, Chris Palman</Authors>
2121
<Company>Artifex</Company>
2222
<Description>A C# binding for MuPDF</Description>
@@ -29,6 +29,10 @@
2929
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
3030
</PropertyGroup>
3131

32+
<PropertyGroup Condition="'$(OS)' == 'Windows_NT'">
33+
<DefineConstants>$(DefineConstants);WINDOWS</DefineConstants>
34+
</PropertyGroup>
35+
3236
<ItemGroup>
3337
<None Include="..\LICENSE.md">
3438
<Pack>True</Pack>
@@ -56,15 +60,28 @@
5660
<PackageReference Update="Microsoft.Maui.Controls.Compatibility" Version="8.0.14" />
5761
</ItemGroup>
5862

59-
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
60-
<EmbeddedResource Include="mupdfcsharp.dll">
63+
<ItemGroup>
64+
<EmbeddedResource Include="libs\mupdf\linux\libmupdf.so">
65+
<LogicalName>libmupdf.so</LogicalName>
66+
</EmbeddedResource>
67+
<EmbeddedResource Include="libs\mupdf\linux\libmupdf.so.26.0">
68+
<LogicalName>libmupdf.so.26.0</LogicalName>
69+
</EmbeddedResource>
70+
<EmbeddedResource Include="libs\mupdf\linux\libmupdfcpp.so">
71+
<LogicalName>libmupdfcpp.so</LogicalName>
72+
</EmbeddedResource>
73+
<EmbeddedResource Include="libs\mupdf\linux\libmupdfcpp.so.26.0">
74+
<LogicalName>libmupdfcpp.so.26.0</LogicalName>
75+
</EmbeddedResource>
76+
<EmbeddedResource Include="libs\mupdf\linux\mupdfcsharp.so">
77+
<LogicalName>mupdfcsharp.so</LogicalName>
78+
</EmbeddedResource>
79+
<EmbeddedResource Include="libs\mupdf\windows\mupdfcsharp.dll">
6180
<LogicalName>mupdfcsharp.dll</LogicalName>
6281
</EmbeddedResource>
63-
</ItemGroup>
64-
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
65-
<EmbeddedResource Include="mupdfcpp64.dll">
82+
<EmbeddedResource Include="libs\mupdf\windows\mupdfcpp64.dll">
6683
<LogicalName>mupdfcpp64.dll</LogicalName>
6784
</EmbeddedResource>
6885
</ItemGroup>
69-
86+
7087
</Project>

MuPDF.NET/Page.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Runtime.CompilerServices;
33
using System.Runtime.InteropServices;
44
using System.Text;
5-
using Microsoft.Maui;
65
using mupdf;
76
using static System.Net.Mime.MediaTypeNames;
87
using static MuPDF.NET.Global;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
namespace MuPDF.NET
22
{
3+
#if ANDROID
34
// All the code in this file is only included on Android.
45
public class PlatformClass1
56
{
67
}
8+
#endif
79
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
namespace MuPDF.NET
22
{
3+
#if MACCATALYST
34
// All the code in this file is only included on Mac Catalyst.
45
public class PlatformClass1
56
{
67
}
8+
#endif
79
}

MuPDF.NET/Platforms/Tizen/PlatformClass1.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
namespace MuPDF.NET
44
{
5+
#if TVOS
56
// All the code in this file is only included on Tizen.
67
public class PlatformClass1
78
{
89
}
10+
#endif
911
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
namespace MuPDF.NET
22
{
3+
#if WINDOWS
34
// All the code in this file is only included on Windows.
45
public class PlatformClass1
56
{
67
}
8+
#endif
79
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
namespace MuPDF.NET
22
{
3+
#if IOS
34
// All the code in this file is only included on iOS.
45
public class PlatformClass1
56
{
67
}
8+
#endif
79
}

MuPDF.NET/TextPage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ internal void MakeTextPage2Dict(PageInfo pageDict, bool raw)
11711171
style.Font = GetFontName(
11721172
new FzFont(mupdf.mupdf.ll_fz_keep_font(ch.font))
11731173
);
1174-
style.Color = ch.color;
1174+
style.Color = (int)ch.argb;
11751175
style.Asc = (
11761176
new FzFont(mupdf.mupdf.ll_fz_keep_font(ch.font))
11771177
).fz_font_ascender();

0 commit comments

Comments
 (0)