Skip to content

Commit

Permalink
Merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
sungaila committed Oct 18, 2024
2 parents 9bdd876 + 44115ff commit b5405ea
Show file tree
Hide file tree
Showing 20 changed files with 435 additions and 43 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ jobs:
dotnet-quality: 'ga'
- name: Setup .NET workload maui-android
run: dotnet workload install maui-android
- name: Setup .NET workload maui-ios
run: dotnet workload install maui-ios
- name: Setup .NET workload maui-windows
run: dotnet workload install maui-windows
- name: Setup .NET workload wasm-tools
Expand All @@ -86,6 +88,7 @@ jobs:
- name: Pack
run: dotnet pack src/PDFtoImage/PDFtoImage.csproj -c ${{ github.event_name != 'workflow_dispatch' && 'Debug' || inputs.build_configuration }} -p:VersionSuffix=ci --no-restore
- name: Generate artifact attestation
if: github.repository == 'sungaila/PDFtoImage' && github.ref == 'refs/heads/master'
uses: actions/attest-build-provenance@main
with:
subject-path: src/PDFtoImage/bin/${{ github.event_name != 'workflow_dispatch' && 'Debug' || inputs.build_configuration }}/*.nupkg
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/githubpages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@main
Expand All @@ -24,6 +24,8 @@ jobs:
dotnet-quality: 'ga'
- name: Setup .NET workload maui-android
run: dotnet workload install maui-android
- name: Setup .NET workload maui-ios
run: dotnet workload install maui-ios
- name: Setup .NET workload wasm-tools
run: dotnet workload install wasm-tools
- name: Update relative paths
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/githubpages_staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@main
Expand All @@ -25,6 +25,8 @@ jobs:
dotnet-quality: 'ga'
- name: Setup .NET workload maui-android
run: dotnet workload install maui-android
- name: Setup .NET workload maui-ios
run: dotnet workload install maui-ios
- name: Setup .NET workload wasm-tools
run: dotnet workload install wasm-tools
- name: Update relative paths
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ https://github.com/sungaila/PDFtoImage.git?path=etc/UnityPackage
* [ASP.NET](https://learn.microsoft.com/en-us/aspnet/overview)
* [ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/introduction-to-aspnet-core)
* [Blazor WebAssembly](https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly)
* [.NET Multi-platform App UI (.NET MAUI)](https://learn.microsoft.com/en-us/dotnet/maui/what-is-maui) (excluding **macOS** and **iOS**)
* [.NET Multi-platform App UI (.NET MAUI)](https://learn.microsoft.com/en-us/dotnet/maui/what-is-maui) (excluding **macOS**)
* [Unity](https://docs.unity3d.com/Manual/Mono.html)
* [Universal Windows Platform (UWP)](https://learn.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide)
* [Windows UI Library 3 (WinUI 3)](https://learn.microsoft.com/en-us/windows/apps/winui/winui3/)
* [Xamarin.Android](https://learn.microsoft.com/en-us/xamarin/android)
* [Windows UI Library 3 (WinUI 3)](https://learn.microsoft.com/en-us/windows/apps/winui/winui3/)
9 changes: 4 additions & 5 deletions src/FrameworkTests/MauiApp/App.xaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Application
x:Class="PDFtoImage.FrameworkTests.MauiApp.App"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MauiApp">
<Application x:Class="PDFtoImage.FrameworkTests.MauiApp.App"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:PDFtoImage.FrameworkTests.MauiApp">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand Down
19 changes: 9 additions & 10 deletions src/FrameworkTests/MauiApp/AppShell.xaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="PDFtoImage.FrameworkTests.MauiApp.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:PDFtoImage.FrameworkTests.MauiApp"
Shell.FlyoutBehavior="Disabled">
<Shell x:Class="PDFtoImage.FrameworkTests.MauiApp.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:PDFtoImage.FrameworkTests.MauiApp"
Title="PDFtoImage.FrameworkTests.MauiApp"
Shell.FlyoutBehavior="Disabled">

<ShellContent
Title="Home"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />
<ShellContent Title="Home"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />

</Shell>
7 changes: 4 additions & 3 deletions src/FrameworkTests/MauiApp/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
Spacing="25"
VerticalOptions="Center">

<Image HeightRequest="200"
<Image x:Name="imgTest"
HeightRequest="200"
HorizontalOptions="Center"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
Source="dotnet_bot.png" />
Expand All @@ -23,7 +24,7 @@
HorizontalOptions="Center"
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
SemanticProperties.HeadingLevel="Level2"
Text="Tab the button below to test PDFtoImage." />
Text="Tap the button below to test PDFtoImage." />

<Button x:Name="CounterBtn"
Clicked="OnCounterClicked"
Expand All @@ -34,4 +35,4 @@
</VerticalStackLayout>
</ScrollView>

</ContentPage>
</ContentPage>
10 changes: 9 additions & 1 deletion src/FrameworkTests/MauiApp/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace PDFtoImage.FrameworkTests.MauiApp
using SkiaSharp;

namespace PDFtoImage.FrameworkTests.MauiApp
{
public partial class MainPage : ContentPage
{
Expand All @@ -16,8 +18,14 @@ private async void OnCounterClicked(object sender, EventArgs e)
input.CopyTo(ms);

using var bitmap = PDFtoImage.Conversion.ToImage(ms, 0);
using var encodedImage = new MemoryStream();

OutputLabel.Text = $"SocialPreview.pdf size: {bitmap.Width}x{bitmap.Height}";
bitmap.Encode(encodedImage, SKEncodedImageFormat.Png, 100);

var byteArray = encodedImage.ToArray();

imgTest.Source = ImageSource.FromStream(() => new MemoryStream(byteArray));
}
catch (Exception ex)
{
Expand Down
4 changes: 2 additions & 2 deletions src/FrameworkTests/MauiApp/MauiApp.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net9.0-android</TargetFrameworks>
<TargetFrameworks>net9.0-android;net9.0-ios</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net9.0-tizen</TargetFrameworks> -->
Expand All @@ -22,7 +22,7 @@
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">13.6</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">33.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
Expand Down
1 change: 1 addition & 0 deletions src/PDFtoImage/Conversion.Base64.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace PDFtoImage
[SupportedOSPlatform("Windows")]
[SupportedOSPlatform("Linux")]
[SupportedOSPlatform("macOS")]
[SupportedOSPlatform("iOS13.6")]
[SupportedOSPlatform("Android31.0")]
#endif
public static partial class Conversion
Expand Down
1 change: 1 addition & 0 deletions src/PDFtoImage/Conversion.ByteArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace PDFtoImage
[SupportedOSPlatform("Windows")]
[SupportedOSPlatform("Linux")]
[SupportedOSPlatform("macOS")]
[SupportedOSPlatform("iOS13.6")]
[SupportedOSPlatform("Android31.0")]
#endif
public static partial class Conversion
Expand Down
1 change: 1 addition & 0 deletions src/PDFtoImage/Conversion.Deprecated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace PDFtoImage
[SupportedOSPlatform("Windows")]
[SupportedOSPlatform("Linux")]
[SupportedOSPlatform("macOS")]
[SupportedOSPlatform("iOS13.6")]
[SupportedOSPlatform("Android31.0")]
#endif
public static partial class Conversion
Expand Down
1 change: 1 addition & 0 deletions src/PDFtoImage/Conversion.Stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace PDFtoImage
[SupportedOSPlatform("Windows")]
[SupportedOSPlatform("Linux")]
[SupportedOSPlatform("macOS")]
[SupportedOSPlatform("iOS13.6")]
[SupportedOSPlatform("Android31.0")]
#endif
public static partial class Conversion
Expand Down
1 change: 1 addition & 0 deletions src/PDFtoImage/Conversion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace PDFtoImage
[SupportedOSPlatform("Windows")]
[SupportedOSPlatform("Linux")]
[SupportedOSPlatform("macOS")]
[SupportedOSPlatform("iOS13.6")]
[SupportedOSPlatform("Android31.0")]
#endif
public static partial class Conversion
Expand Down
40 changes: 24 additions & 16 deletions src/PDFtoImage/PDFtoImage.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<!-- Assembly -->
<PropertyGroup>
<TargetFrameworks>net462;net471;net481;netstandard2.0;net6.0;net8.0;net8.0-android;net9.0;net9.0-android</TargetFrameworks>
<TargetFrameworks>net462;net471;net481;netstandard2.0;net6.0;net8.0;net8.0-android;net8.0-ios;net9.0;net9.0-android;net9.0-ios</TargetFrameworks>
<AssemblyName>PDFtoImage</AssemblyName>
<RootNamespace>PDFtoImage</RootNamespace>
<EmbedAllSources>true</EmbedAllSources>
Expand All @@ -11,11 +12,11 @@
<ProjectGuid>{A6F86FA0-87FE-406E-BA86-5A128D59DA12}</ProjectGuid>
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>
</PropertyGroup>

<!-- NuGet -->
<PropertyGroup>
<VersionPrefix>5.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<VersionSuffix>preview</VersionSuffix>
<Authors>David Sungaila</Authors>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand All @@ -26,15 +27,16 @@
<PackageReleaseNotes>- Add .NET 9 as TargetFramework.
- Remove .NET 7 as TargetFramework.
- Remove MonoAndroid/Xamarin as TargetFramework.
- Remove PDFtoImage.Compatibility API.</PackageReleaseNotes>
- Remove PDFtoImage.Compatibility API.
- Add iOS as TargetFramework.</PackageReleaseNotes>
<PackageTags>PDF Bitmap Image Convert Conversion C# PDFium SkiaSharp Skia PNG JPG JPEG WEBP Xamarin Android MAUI wasm WebAssembly</PackageTags>
<RepositoryUrl>https://github.com/sungaila/PDFtoImage.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<!-- C# compiler -->
<PropertyGroup>
<LangVersion>latest</LangVersion>
Expand All @@ -44,65 +46,71 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<SignAssembly>True</SignAssembly>
</PropertyGroup>

<!-- Debug builds -->
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<VersionSuffix>debug</VersionSuffix>
</PropertyGroup>

<!-- Release builds -->
<PropertyGroup Condition="'$(Configuration)'=='Release' or '$(Configuration)'=='ReleaseSigned'">
<SignAssembly>true</SignAssembly>
<Optimize>true</Optimize>
<Deterministic>true</Deterministic>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<!-- Roslyn analyzer for public APIs -->
<ItemGroup>
<AdditionalFiles Include="PublicAPI\$(TargetFramework)\PublicAPI.Shipped.txt" />
<AdditionalFiles Include="PublicAPI\$(TargetFramework)\PublicAPI.Unshipped.txt" />
</ItemGroup>

<!-- NuGet Icon -->
<ItemGroup>
<None Include="..\..\etc\Icon_128.png" Pack="true" PackagePath="" />
<None Include="..\..\README.md" Pack="true" PackagePath="" />
</ItemGroup>

<!-- SourceLink build steps and NuGet packages -->
<ItemGroup>
<PackageReference Include="SkiaSharp" Version="3.0.0-preview.4.1" PrivateAssets="analyzers" />
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4" PrivateAssets="all" />
</ItemGroup>

<!-- Shared packages -->
<ItemGroup Condition="'$(TargetFramework)'!='net8.0-android'">
<ItemGroup Condition="'$(TargetFramework)'!='net8.0-android' and '$(TargetFramework)'!='net8.0-ios' and '$(TargetFramework)'!='net9.0-android' and '$(TargetFramework)'!='net9.0-ios'">
<PackageReference Include="bblanchon.PDFium.Linux" Version="130.0.6721" PrivateAssets="analyzers" />
<PackageReference Include="bblanchon.PDFium.macOS" Version="130.0.6721" PrivateAssets="analyzers" />
<PackageReference Include="bblanchon.PDFium.Win32" Version="130.0.6721" PrivateAssets="analyzers" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="3.0.0-preview.4.1" PrivateAssets="analyzers" />
<PackageReference Include="SkiaSharp.NativeAssets.macOS" Version="3.0.0-preview.4.1" PrivateAssets="analyzers" />
<PackageReference Include="SkiaSharp.NativeAssets.Win32" Version="3.0.0-preview.4.1" PrivateAssets="analyzers" />
</ItemGroup>

<!-- .NET Framework packages -->
<ItemGroup Condition="'$(TargetFramework)'=='net462'">
<PackageReference Include="System.ValueTuple" Version="4.5.0" PrivateAssets="all" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" PrivateAssets="all" />
</ItemGroup>

<!-- .NET packages -->
<ItemGroup Condition="'$(TargetFramework)'=='net6.0' or '$(TargetFramework)'=='net8.0' or '$(TargetFramework)'=='net9.0'">
<!-- NOP -->
</ItemGroup>

<!-- Android packages -->
<ItemGroup Condition="'$(TargetFramework)'=='net8.0-android' or '$(TargetFramework)'=='net9.0-android'">
<PackageReference Include="bblanchon.PDFium.Android" Version="130.0.6721" PrivateAssets="analyzers" />
<PackageReference Include="SkiaSharp.NativeAssets.Android" Version="3.0.0-preview.4.1" PrivateAssets="analyzers" />
</ItemGroup>

<!-- iOS packages -->
<ItemGroup Condition="'$(TargetFramework)'=='net8.0-ios' or '$(TargetFramework)'=='net9.0-ios'">
<PackageReference Include="bblanchon.PDFium.iOS" Version="130.0.6721" PrivateAssets="analyzers" />
<PackageReference Include="SkiaSharp.NativeAssets.iOS" Version="3.0.0-preview.4.1" PrivateAssets="analyzers" />
</ItemGroup>

<!-- Blazor WebAssembly stuff -->
<ItemGroup Condition="'$(TargetFramework)'=='net8.0' or '$(TargetFramework)'=='net9.0'">
<PackageReference Include="SkiaSharp.NativeAssets.WebAssembly" Version="3.0.0-preview.4.1" PrivateAssets="analyzers" />
Expand Down
Loading

0 comments on commit b5405ea

Please sign in to comment.