diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index c7fd332d..70d3fef6 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -124,7 +124,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-2019, windows-2022, ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, macos-12, macos-13, macos-14, macos-15] + os: [windows-2019, windows-2022, ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, macos-13, macos-14, macos-15] runs-on: ${{ matrix.os }} if: success() && (github.event_name != 'workflow_dispatch' && true || inputs.run_tests) == true steps: diff --git a/src/Console/Console.csproj b/src/Console/Console.csproj deleted file mode 100644 index 8d1dfdcb..00000000 --- a/src/Console/Console.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - - net462;net471;net481;net6.0;net8.0;net9.0 - win-x86;win-x64;win-arm64;linux-x64;linux-arm;linux-arm64;osx-x64;osx-arm64 - Exe - PDFtoImage.Console - PDFtoImage.Console - PDFtoImage.Console.Program - 5.0.0 - Debug;Release;ReleaseSigned - - - - - latest - enable - strict - nullable - CS0618,CA1416 - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Console/Program.cs b/src/Console/Program.cs deleted file mode 100644 index 5256a8a8..00000000 --- a/src/Console/Program.cs +++ /dev/null @@ -1,184 +0,0 @@ -using System; -using System.IO; -using System.Reflection; - -namespace PDFtoImage.Console -{ -#if NET8_0_OR_GREATER -#pragma warning disable CA1510 // Use ArgumentNullException throw helper -#endif - public static class Program - { - public static int Main(string[] args) - { - var entryAssembly = Assembly.GetEntryAssembly(); - System.Console.WriteLine($"{entryAssembly?.GetName()?.ToString() ?? "PDFtoImage"}"); - System.Console.WriteLine(); - - try - { - ParseArguments(args, out string? inputPath, out string? outputPath, out int page, out int dpi, out bool withAnnotations, out bool withFormFill); - - if (inputPath == null) - throw new InvalidOperationException("There is no PDF file path."); - - if (outputPath == null) - throw new InvalidOperationException("There is no output image file path."); - - using var inputStream = new FileStream(inputPath, FileMode.Open, FileAccess.Read); - -#if NET6_0_OR_GREATER - if (!OperatingSystem.IsWindows() && !OperatingSystem.IsLinux() && !OperatingSystem.IsMacOS()) - throw new PlatformNotSupportedException("Only win-x86, win-x64, win-arm64, linux-x64, linux-arm, linux-arm64, osx-x64 and osx-arm64 are supported for PDF file conversion."); -#endif - - switch (Path.GetExtension(outputPath).ToLower()) - { - case ".png": - Conversion.SavePng(outputPath, inputStream, page: page - 1, options: new(Dpi: dpi, WithAnnotations: withAnnotations, WithFormFill: withFormFill)); - break; - case ".jpg": - case ".jpeg": - Conversion.SaveJpeg(outputPath, inputStream, page: page - 1, options: new(Dpi: dpi, WithAnnotations: withAnnotations, WithFormFill: withFormFill)); - break; - case ".webp": - Conversion.SaveWebp(outputPath, inputStream, page: page - 1, options: new(Dpi: dpi, WithAnnotations: withAnnotations, WithFormFill: withFormFill)); - break; - default: - throw new InvalidOperationException("Only the following file extensions are supported: png, jpg/jpeg and webp."); - } - } - catch (Exception ex) - { - System.Console.Error.WriteLine("Failed to render PDF."); - System.Console.Error.WriteLine(ex); - - return -1; - } - - return 0; - } - - private static void ParseArguments(string[] args, out string? inputPath, out string? outputPath, out int page, out int dpi, out bool withAnnotations, out bool withFormFill) - { - if (args == null) - throw new ArgumentNullException(nameof(args)); - - if (args.Length >= 1) - { - inputPath = args[0]; - } - else - { - System.Console.Write("Enter the path to the PDF file: "); - inputPath = System.Console.ReadLine(); - } - - inputPath = inputPath!.Trim('\"'); - - if (args.Length >= 2) - { - outputPath = args[1]; - } - else - { - System.Console.Write("Enter the output path of the result: "); - outputPath = System.Console.ReadLine(); - - if (string.IsNullOrWhiteSpace(outputPath)) - { - outputPath = Path.Combine(Path.GetDirectoryName(inputPath)!, Path.GetFileNameWithoutExtension(inputPath) + ".png"); - System.Console.WriteLine($"Output defaulting to \"{outputPath}\"."); - } - } - - outputPath = outputPath.Trim('\"'); - - page = 1; - - if (args.Length >= 3) - { - outputPath = args[2]; - } - else - { - System.Console.Write("Enter PDF page number: "); - - if (!int.TryParse(System.Console.ReadLine(), out page) || page <= 0) - { - page = 1; - System.Console.WriteLine($"PDF page number defaulting to {page}."); - } - } - - dpi = 300; - - if (args.Length >= 4) - { - outputPath = args[3]; - } - else - { - System.Console.Write("Enter the target resolution in DPI: "); - - if (!int.TryParse(System.Console.ReadLine(), out dpi) || dpi <= 0) - { - dpi = 300; - System.Console.WriteLine($"Target DPI defaulting to {dpi}."); - } - } - - withAnnotations = false; - - if (args.Length >= 5) - { - outputPath = args[4]; - } - else - { - System.Console.Write("Should annotations be rendered (y/n): "); - - var input = System.Console.ReadLine(); - if (input?.ToLowerInvariant() == "y") - { - withAnnotations = true; - } - else if (input?.ToLowerInvariant() == "n") - { - withAnnotations = false; - } - else - { - withAnnotations = false; - System.Console.WriteLine($"Annotations not rendered by default."); - } - } - - withFormFill = false; - - if (args.Length >= 5) - { - outputPath = args[4]; - } - else - { - System.Console.Write("Should form filling be rendered (y/n): "); - - var input = System.Console.ReadLine(); - if (input?.ToLowerInvariant() == "y") - { - withFormFill = true; - } - else if (input?.ToLowerInvariant() == "n") - { - withFormFill = false; - } - else - { - withFormFill = false; - System.Console.WriteLine($"Form filling not rendered by default."); - } - } - } - } -} \ No newline at end of file diff --git a/src/Console/Properties/PublishProfiles/DotNet.pubxml b/src/Console/Properties/PublishProfiles/DotNet.pubxml deleted file mode 100644 index 873cfc39..00000000 --- a/src/Console/Properties/PublishProfiles/DotNet.pubxml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - ReleaseSigned - Any CPU - bin\Publish\net8.0 - FileSystem - net8.0 - false - - \ No newline at end of file diff --git a/src/Console/Properties/PublishProfiles/DotNetFramework.pubxml b/src/Console/Properties/PublishProfiles/DotNetFramework.pubxml deleted file mode 100644 index 2123f4d1..00000000 --- a/src/Console/Properties/PublishProfiles/DotNetFramework.pubxml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - ReleaseSigned - Any CPU - bin\Publish\net462 - FileSystem - net462 - false - - \ No newline at end of file diff --git a/src/Console/Properties/PublishProfiles/DotNetFramework481.pubxml b/src/Console/Properties/PublishProfiles/DotNetFramework481.pubxml deleted file mode 100644 index 23f66232..00000000 --- a/src/Console/Properties/PublishProfiles/DotNetFramework481.pubxml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - ReleaseSigned - Any CPU - bin\Publish\net481 - FileSystem - net481 - false - - \ No newline at end of file diff --git a/src/FrameworkTests/MauiApp/App.xaml.cs b/src/FrameworkTests/MauiApp/App.xaml.cs index cc3657b2..36f194bb 100644 --- a/src/FrameworkTests/MauiApp/App.xaml.cs +++ b/src/FrameworkTests/MauiApp/App.xaml.cs @@ -5,8 +5,11 @@ public partial class App : Application public App() { InitializeComponent(); + } - MainPage = new AppShell(); + protected override Window CreateWindow(IActivationState activationState) + { + return new Window(new AppShell()); } } } \ No newline at end of file diff --git a/src/PDFtoImage.sln b/src/PDFtoImage.sln index 99166f7a..2ab4f439 100644 --- a/src/PDFtoImage.sln +++ b/src/PDFtoImage.sln @@ -13,8 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\README.md = ..\README.md EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Console", "Console\Console.csproj", "{02D43353-6E92-4DBB-86FD-7205D623F10A}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebConverter", "WebConverter\WebConverter.csproj", "{EDA29F04-48E7-4823-8141-22A82CB80037}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FrameworkTests", "FrameworkTests", "{7BB9FE70-BACD-4FC6-B90A-B505265A66E0}" @@ -110,36 +108,6 @@ Global {55C8F100-1D62-4792-B9EF-C78EF33C7A0C}.ReleaseSigned|x64.Build.0 = Release|Any CPU {55C8F100-1D62-4792-B9EF-C78EF33C7A0C}.ReleaseSigned|x86.ActiveCfg = Release|Any CPU {55C8F100-1D62-4792-B9EF-C78EF33C7A0C}.ReleaseSigned|x86.Build.0 = Release|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Debug|ARM.ActiveCfg = Debug|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Debug|ARM.Build.0 = Debug|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Debug|ARM64.Build.0 = Debug|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Debug|x64.ActiveCfg = Debug|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Debug|x64.Build.0 = Debug|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Debug|x86.ActiveCfg = Debug|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Debug|x86.Build.0 = Debug|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Release|Any CPU.Build.0 = Release|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Release|ARM.ActiveCfg = Release|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Release|ARM.Build.0 = Release|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Release|ARM64.ActiveCfg = Release|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Release|ARM64.Build.0 = Release|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Release|x64.ActiveCfg = Release|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Release|x64.Build.0 = Release|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Release|x86.ActiveCfg = Release|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.Release|x86.Build.0 = Release|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.ReleaseSigned|Any CPU.ActiveCfg = ReleaseSigned|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.ReleaseSigned|Any CPU.Build.0 = ReleaseSigned|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.ReleaseSigned|ARM.ActiveCfg = ReleaseSigned|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.ReleaseSigned|ARM.Build.0 = ReleaseSigned|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.ReleaseSigned|ARM64.ActiveCfg = ReleaseSigned|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.ReleaseSigned|ARM64.Build.0 = ReleaseSigned|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.ReleaseSigned|x64.ActiveCfg = ReleaseSigned|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.ReleaseSigned|x64.Build.0 = ReleaseSigned|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.ReleaseSigned|x86.ActiveCfg = ReleaseSigned|Any CPU - {02D43353-6E92-4DBB-86FD-7205D623F10A}.ReleaseSigned|x86.Build.0 = ReleaseSigned|Any CPU {EDA29F04-48E7-4823-8141-22A82CB80037}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EDA29F04-48E7-4823-8141-22A82CB80037}.Debug|Any CPU.Build.0 = Debug|Any CPU {EDA29F04-48E7-4823-8141-22A82CB80037}.Debug|ARM.ActiveCfg = Debug|Any CPU diff --git a/src/PDFtoImage/PDFtoImage.csproj b/src/PDFtoImage/PDFtoImage.csproj index 07e84407..0c8e6ef6 100644 --- a/src/PDFtoImage/PDFtoImage.csproj +++ b/src/PDFtoImage/PDFtoImage.csproj @@ -114,7 +114,7 @@ - + diff --git a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_images_paths.jpg b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_images_paths.jpg index a42424fb..45feca83 100644 Binary files a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_images_paths.jpg and b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_images_paths.jpg differ diff --git a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_images_paths.png b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_images_paths.png index a79bfa89..9830e99a 100644 Binary files a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_images_paths.png and b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_images_paths.png differ diff --git a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_images_paths.webp b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_images_paths.webp index a28706eb..03998c59 100644 Binary files a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_images_paths.webp and b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_images_paths.webp differ diff --git a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_paths.jpg b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_paths.jpg index a42424fb..45feca83 100644 Binary files a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_paths.jpg and b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_paths.jpg differ diff --git a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_paths.png b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_paths.png index a79bfa89..9830e99a 100644 Binary files a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_paths.png and b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_paths.png differ diff --git a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_paths.webp b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_paths.webp index a28706eb..03998c59 100644 Binary files a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_paths.webp and b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_paths.webp differ diff --git a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_images_paths.jpg b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_images_paths.jpg index b7b6aa93..bed550ef 100644 Binary files a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_images_paths.jpg and b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_images_paths.jpg differ diff --git a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_images_paths.png b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_images_paths.png index abf16d83..b9ded8b0 100644 Binary files a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_images_paths.png and b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_images_paths.png differ diff --git a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_images_paths.webp b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_images_paths.webp index 7fa56d3f..6106e7d0 100644 Binary files a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_images_paths.webp and b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_images_paths.webp differ diff --git a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_paths.jpg b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_paths.jpg index b7b6aa93..bed550ef 100644 Binary files a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_paths.jpg and b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_paths.jpg differ diff --git a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_paths.png b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_paths.png index abf16d83..b9ded8b0 100644 Binary files a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_paths.png and b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_paths.png differ diff --git a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_paths.webp b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_paths.webp index 7fa56d3f..6106e7d0 100644 Binary files a/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_paths.webp and b/src/Tests/Assets/Expected/WINDOWS/AntiAliasing/hundesteuer-anmeldung_aliasing_text_paths.webp differ