From 7b821c2ab79166bddd7039160ce872054e3157c2 Mon Sep 17 00:00:00 2001 From: akgulebubekir Date: Mon, 28 Dec 2020 14:30:56 +0100 Subject: [PATCH 01/13] Xamarin.Forms version upgraded to 4.8 --- .../PdfSharp.Xamarin.Forms.Droid.csproj | 174 +++--- .../PdfSharp.Xamarin.Forms.UWP.csproj | 276 ++++----- .../PdfSharp.Xamarin.Forms.iOS.csproj | 177 +++--- PdfSharp.Xamarin.Forms.iOS/packages.config | 6 +- PdfSharp.Xamarin.Forms.sln | 4 +- .../PdfSharp.Xamarin.Forms.csproj | 4 +- .../Renderers/PdfSearchBarRenderer.cs | 2 +- .../PdfSharp.Xamarin.Sample.Android.csproj | 548 +++++++++++------- .../Properties/AndroidManifest.xml | 2 +- .../packages.config | 64 +- .../PdfSharp.Xamarin.Sample.UWP.csproj | 364 ++++++------ .../PdfSharp.Xamarin.Sample.iOS.csproj | 343 ++++++----- .../packages.config | 6 +- .../PdfSharp.Xamarin.Sample.csproj | 4 +- PdfSharpCore/PdfSharpCore.csproj | 11 +- 15 files changed, 1051 insertions(+), 934 deletions(-) diff --git a/PdfSharp.Xamarin.Forms.Droid/PdfSharp.Xamarin.Forms.Droid.csproj b/PdfSharp.Xamarin.Forms.Droid/PdfSharp.Xamarin.Forms.Droid.csproj index 44511f6..6946068 100644 --- a/PdfSharp.Xamarin.Forms.Droid/PdfSharp.Xamarin.Forms.Droid.csproj +++ b/PdfSharp.Xamarin.Forms.Droid/PdfSharp.Xamarin.Forms.Droid.csproj @@ -1,94 +1,94 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {8C8EAA13-5824-462C-8149-D87DB8AFE587} - {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - {9ef11e43-1701-4396-8835-8392d57abb70} - Library - Properties - PdfSharp.Xamarin.Forms.Droid - PdfSharp.Xamarin.Forms.Droid - 512 - Resources\Resource.Designer.cs - Off - false - v8.1 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 25.4.0.2 - - - 2.5.1.527436 - - - - - {86bc6014-ac2d-452b-a4c4-d8e90cd54596} - PdfSharp.Xamarin.Forms - - - {0f2207fe-7e51-43d6-84c0-fe0a07fb5616} - PdfSharpCore.Charting - - - {698e271b-97b3-4fd8-a81d-0b149033fb9a} - PdfSharpCore - - - + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {8C8EAA13-5824-462C-8149-D87DB8AFE587} + {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {9ef11e43-1701-4396-8835-8392d57abb70} + Library + Properties + PdfSharp.Xamarin.Forms.Droid + PdfSharp.Xamarin.Forms.Droid + 512 + Resources\Resource.Designer.cs + Off + false + v8.1 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 28.0.0.3 + + + 4.8.0.1821 + + + + + {86bc6014-ac2d-452b-a4c4-d8e90cd54596} + PdfSharp.Xamarin.Forms + + + {0f2207fe-7e51-43d6-84c0-fe0a07fb5616} + PdfSharpCore.Charting + + + {698e271b-97b3-4fd8-a81d-0b149033fb9a} + PdfSharpCore + + + + --> \ No newline at end of file diff --git a/PdfSharp.Xamarin.Forms.UWP/PdfSharp.Xamarin.Forms.UWP.csproj b/PdfSharp.Xamarin.Forms.UWP/PdfSharp.Xamarin.Forms.UWP.csproj index 291b257..dcf724e 100644 --- a/PdfSharp.Xamarin.Forms.UWP/PdfSharp.Xamarin.Forms.UWP.csproj +++ b/PdfSharp.Xamarin.Forms.UWP/PdfSharp.Xamarin.Forms.UWP.csproj @@ -1,145 +1,145 @@ - - - - - Debug - AnyCPU - {50E03492-A06D-4702-9736-B14B56111E90} - Library - Properties - PdfSharp.Xamarin.Forms.UWP - PdfSharp.Xamarin.Forms.UWP - en-US - UAP - 10.0.17134.0 - 10.0.14393.0 - 14 - 512 - {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - prompt - 4 - - - x86 - true - bin\x86\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x86 - false - prompt - - - x86 - bin\x86\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x86 - false - prompt - - - ARM - true - bin\ARM\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - ARM - false - prompt - - - ARM - bin\ARM\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - ARM - false - prompt - - - x64 - true - bin\x64\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x64 - false - prompt - - - x64 - bin\x64\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x64 - false - prompt - - - PackageReference - - - - - - - - - - - 6.1.5 - - - - - {86bc6014-ac2d-452b-a4c4-d8e90cd54596} - PdfSharp.Xamarin.Forms - - - {0f2207fe-7e51-43d6-84c0-fe0a07fb5616} - PdfSharpCore.Charting - - - {698e271b-97b3-4fd8-a81d-0b149033fb9a} - PdfSharpCore - - - - 14.0 - - + + + + + Debug + AnyCPU + {50E03492-A06D-4702-9736-B14B56111E90} + Library + Properties + PdfSharp.Xamarin.Forms.UWP + PdfSharp.Xamarin.Forms.UWP + en-US + UAP + 10.0.19041.0 + 10.0.16299.0 + 14 + 512 + {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + prompt + 4 + + + x86 + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x86 + false + prompt + + + x86 + bin\x86\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x86 + false + prompt + + + ARM + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + ARM + false + prompt + + + ARM + bin\ARM\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + ARM + false + prompt + + + x64 + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x64 + false + prompt + + + x64 + bin\x64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x64 + false + prompt + + + PackageReference + + + + + + + + + + + 6.2.11 + + + + + {86bc6014-ac2d-452b-a4c4-d8e90cd54596} + PdfSharp.Xamarin.Forms + + + {0f2207fe-7e51-43d6-84c0-fe0a07fb5616} + PdfSharpCore.Charting + + + {698e271b-97b3-4fd8-a81d-0b149033fb9a} + PdfSharpCore + + + + 14.0 + + + --> \ No newline at end of file diff --git a/PdfSharp.Xamarin.Forms.iOS/PdfSharp.Xamarin.Forms.iOS.csproj b/PdfSharp.Xamarin.Forms.iOS/PdfSharp.Xamarin.Forms.iOS.csproj index 45d6eaa..1a486fc 100644 --- a/PdfSharp.Xamarin.Forms.iOS/PdfSharp.Xamarin.Forms.iOS.csproj +++ b/PdfSharp.Xamarin.Forms.iOS/PdfSharp.Xamarin.Forms.iOS.csproj @@ -1,91 +1,88 @@ - - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {E71F3053-056C-4381-9638-048ED73BDFF6} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - {a52b8a63-bc84-4b47-910d-692533484892} - Library - PdfSharp.Xamarin.Forms.iOS - Resources - PdfSharp.Xamarin.Forms.iOS - - - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - - - full - true - bin\Release - prompt - 4 - false - - - - - - - ..\packages\Xamarin.Forms.2.5.1.527436\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll - - - ..\packages\Xamarin.Forms.2.5.1.527436\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll - - - ..\packages\Xamarin.Forms.2.5.1.527436\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll - - - ..\packages\Xamarin.Forms.2.5.1.527436\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll - - - - - - - - - - - - - - - - {86bc6014-ac2d-452b-a4c4-d8e90cd54596} - PdfSharp.Xamarin.Forms - - - {0f2207fe-7e51-43d6-84c0-fe0a07fb5616} - PdfSharpCore.Charting - - - {698e271b-97b3-4fd8-a81d-0b149033fb9a} - PdfSharpCore - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - + + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {E71F3053-056C-4381-9638-048ED73BDFF6} + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {a52b8a63-bc84-4b47-910d-692533484892} + Library + PdfSharp.Xamarin.Forms.iOS + Resources + PdfSharp.Xamarin.Forms.iOS + + + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + bin\Release + prompt + 4 + false + + + + + + + ..\packages\Xamarin.Forms.4.8.0.1821\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll + + + ..\packages\Xamarin.Forms.4.8.0.1821\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll + + + ..\packages\Xamarin.Forms.4.8.0.1821\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll + + + + + + + + + + + + + + + + {86bc6014-ac2d-452b-a4c4-d8e90cd54596} + PdfSharp.Xamarin.Forms + + + {0f2207fe-7e51-43d6-84c0-fe0a07fb5616} + PdfSharpCore.Charting + + + {698e271b-97b3-4fd8-a81d-0b149033fb9a} + PdfSharpCore + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/PdfSharp.Xamarin.Forms.iOS/packages.config b/PdfSharp.Xamarin.Forms.iOS/packages.config index 329d686..491f35b 100644 --- a/PdfSharp.Xamarin.Forms.iOS/packages.config +++ b/PdfSharp.Xamarin.Forms.iOS/packages.config @@ -1,4 +1,4 @@ - - - + + + \ No newline at end of file diff --git a/PdfSharp.Xamarin.Forms.sln b/PdfSharp.Xamarin.Forms.sln index c3be29d..9f4dd49 100644 --- a/PdfSharp.Xamarin.Forms.sln +++ b/PdfSharp.Xamarin.Forms.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27004.2009 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30804.86 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PdfSharpCore", "PdfSharpCore\PdfSharpCore.csproj", "{698E271B-97B3-4FD8-A81D-0B149033FB9A}" EndProject diff --git a/PdfSharp.Xamarin.Forms/PdfSharp.Xamarin.Forms.csproj b/PdfSharp.Xamarin.Forms/PdfSharp.Xamarin.Forms.csproj index 5bc16b9..8acaf1e 100644 --- a/PdfSharp.Xamarin.Forms/PdfSharp.Xamarin.Forms.csproj +++ b/PdfSharp.Xamarin.Forms/PdfSharp.Xamarin.Forms.csproj @@ -1,7 +1,7 @@  - netstandard1.4 + netstandard2.0 akgulebubekir @@ -36,7 +36,7 @@ - + diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfSearchBarRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfSearchBarRenderer.cs index cc0aaa3..7f3ed81 100644 --- a/PdfSharp.Xamarin.Forms/Renderers/PdfSearchBarRenderer.cs +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfSearchBarRenderer.cs @@ -21,7 +21,7 @@ public override void CreatePDFLayout(XGraphics page, SearchBar searchBar, XRect DrawForiOS(page, searchBar, bounds, scaleFactor); break; case Device.UWP: - case Device.WinRT: + case Device.WPF: default: DrawForUWP(page, searchBar, bounds, scaleFactor); break; diff --git a/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.Android/PdfSharp.Xamarin.Sample.Android.csproj b/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.Android/PdfSharp.Xamarin.Sample.Android.csproj index 3103552..82d8e74 100644 --- a/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.Android/PdfSharp.Xamarin.Sample.Android.csproj +++ b/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.Android/PdfSharp.Xamarin.Sample.Android.csproj @@ -1,225 +1,325 @@ - - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {C23B926D-F3D4-4373-B7DB-0C839D9E4651} - {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - Properties - PdfSharp.Xamarin.Sample.Droid - PdfSharp.Xamarin.Sample.Android - 512 - true - Resources\Resource.Designer.cs - Off - Properties\AndroidManifest.xml - true - v8.0 - - - - - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - True - None - armeabi,armeabi-v7a,x86 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - False - SdkOnly - - - - ..\..\packages\Xamarin.Forms.2.5.1.527436\lib\MonoAndroid10\FormsViewGroup.dll - - - - - - - - - - ..\..\packages\Xamarin.Android.Arch.Core.Common.1.0.0\lib\MonoAndroid80\Xamarin.Android.Arch.Core.Common.dll - - - ..\..\packages\Xamarin.Android.Arch.Lifecycle.Common.1.0.1\lib\MonoAndroid80\Xamarin.Android.Arch.Lifecycle.Common.dll - - - ..\..\packages\Xamarin.Android.Arch.Lifecycle.Runtime.1.0.0\lib\MonoAndroid80\Xamarin.Android.Arch.Lifecycle.Runtime.dll - - - ..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Animated.Vector.Drawable.dll - - - ..\..\packages\Xamarin.Android.Support.Annotations.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Annotations.dll - - - ..\..\packages\Xamarin.Android.Support.Compat.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Compat.dll - - - ..\..\packages\Xamarin.Android.Support.Core.UI.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Core.UI.dll - - - ..\..\packages\Xamarin.Android.Support.Core.Utils.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Core.Utils.dll - - - ..\..\packages\Xamarin.Android.Support.Design.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Design.dll - - - ..\..\packages\Xamarin.Android.Support.Fragment.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Fragment.dll - - - ..\..\packages\Xamarin.Android.Support.Media.Compat.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Media.Compat.dll - - - ..\..\packages\Xamarin.Android.Support.Transition.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Transition.dll - - - ..\..\packages\Xamarin.Android.Support.v4.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.v4.dll - - - ..\..\packages\Xamarin.Android.Support.v7.AppCompat.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.v7.AppCompat.dll - - - ..\..\packages\Xamarin.Android.Support.v7.CardView.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.v7.CardView.dll - - - ..\..\packages\Xamarin.Android.Support.v7.MediaRouter.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.v7.MediaRouter.dll - - - ..\..\packages\Xamarin.Android.Support.v7.Palette.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.v7.Palette.dll - - - ..\..\packages\Xamarin.Android.Support.v7.RecyclerView.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.v7.RecyclerView.dll - - - ..\..\packages\Xamarin.Android.Support.Vector.Drawable.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Vector.Drawable.dll - - - ..\..\packages\Xamarin.Forms.2.5.1.527436\lib\MonoAndroid10\Xamarin.Forms.Core.dll - - - ..\..\packages\Xamarin.Forms.2.5.1.527436\lib\MonoAndroid10\Xamarin.Forms.Platform.dll - - - ..\..\packages\Xamarin.Forms.2.5.1.527436\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll - - - ..\..\packages\Xamarin.Forms.2.5.1.527436\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {8c8eaa13-5824-462c-8149-d87db8afe587} - PdfSharp.Xamarin.Forms.Droid - - - {86bc6014-ac2d-452b-a4c4-d8e90cd54596} - PdfSharp.Xamarin.Forms - - - {698e271b-97b3-4fd8-a81d-0b149033fb9a} - PdfSharpCore - - - {fc44d6fa-dbe2-4e52-8677-942f2a50181b} - PdfSharp.Xamarin.Sample - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {C23B926D-F3D4-4373-B7DB-0C839D9E4651} + {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + Properties + PdfSharp.Xamarin.Sample.Droid + PdfSharp.Xamarin.Sample.Android + 512 + true + Resources\Resource.Designer.cs + Off + Properties\AndroidManifest.xml + v9.0 + + + + + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + True + None + armeabi,armeabi-v7a,x86 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + False + SdkOnly + + + + ..\..\packages\Xamarin.Forms.4.8.0.1821\lib\MonoAndroid90\FormsViewGroup.dll + + + + + + + + + + + ..\..\packages\Xamarin.Android.Arch.Core.Common.1.1.1.3\lib\monoandroid90\Xamarin.Android.Arch.Core.Common.dll + + + ..\..\packages\Xamarin.Android.Arch.Core.Runtime.1.1.1.3\lib\monoandroid90\Xamarin.Android.Arch.Core.Runtime.dll + + + ..\..\packages\Xamarin.Android.Arch.Lifecycle.Common.1.1.1.3\lib\monoandroid90\Xamarin.Android.Arch.Lifecycle.Common.dll + + + ..\..\packages\Xamarin.Android.Arch.Lifecycle.LiveData.1.1.1.3\lib\monoandroid90\Xamarin.Android.Arch.Lifecycle.LiveData.dll + + + ..\..\packages\Xamarin.Android.Arch.Lifecycle.LiveData.Core.1.1.1.3\lib\monoandroid90\Xamarin.Android.Arch.Lifecycle.LiveData.Core.dll + + + ..\..\packages\Xamarin.Android.Arch.Lifecycle.Runtime.1.1.1.3\lib\monoandroid90\Xamarin.Android.Arch.Lifecycle.Runtime.dll + + + ..\..\packages\Xamarin.Android.Arch.Lifecycle.ViewModel.1.1.1.3\lib\monoandroid90\Xamarin.Android.Arch.Lifecycle.ViewModel.dll + + + ..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Animated.Vector.Drawable.dll + + + ..\..\packages\Xamarin.Android.Support.Annotations.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Annotations.dll + + + ..\..\packages\Xamarin.Android.Support.AsyncLayoutInflater.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.AsyncLayoutInflater.dll + + + ..\..\packages\Xamarin.Android.Support.Collections.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Collections.dll + + + ..\..\packages\Xamarin.Android.Support.Compat.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Compat.dll + + + ..\..\packages\Xamarin.Android.Support.CoordinaterLayout.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.CoordinaterLayout.dll + + + ..\..\packages\Xamarin.Android.Support.Core.UI.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Core.UI.dll + + + ..\..\packages\Xamarin.Android.Support.Core.Utils.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Core.Utils.dll + + + ..\..\packages\Xamarin.Android.Support.CursorAdapter.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.CursorAdapter.dll + + + ..\..\packages\Xamarin.Android.Support.CustomTabs.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.CustomTabs.dll + + + ..\..\packages\Xamarin.Android.Support.CustomView.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.CustomView.dll + + + ..\..\packages\Xamarin.Android.Support.Design.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Design.dll + + + ..\..\packages\Xamarin.Android.Support.DocumentFile.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.DocumentFile.dll + + + ..\..\packages\Xamarin.Android.Support.DrawerLayout.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.DrawerLayout.dll + + + ..\..\packages\Xamarin.Android.Support.Fragment.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Fragment.dll + + + ..\..\packages\Xamarin.Android.Support.Interpolator.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Interpolator.dll + + + ..\..\packages\Xamarin.Android.Support.Loader.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Loader.dll + + + ..\..\packages\Xamarin.Android.Support.LocalBroadcastManager.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.LocalBroadcastManager.dll + + + ..\..\packages\Xamarin.Android.Support.Media.Compat.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Media.Compat.dll + + + ..\..\packages\Xamarin.Android.Support.Print.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Print.dll + + + ..\..\packages\Xamarin.Android.Support.SlidingPaneLayout.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.SlidingPaneLayout.dll + + + ..\..\packages\Xamarin.Android.Support.SwipeRefreshLayout.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.SwipeRefreshLayout.dll + + + ..\..\packages\Xamarin.Android.Support.Transition.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Transition.dll + + + ..\..\packages\Xamarin.Android.Support.v4.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.v4.dll + + + ..\..\packages\Xamarin.Android.Support.v7.AppCompat.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.v7.AppCompat.dll + + + ..\..\packages\Xamarin.Android.Support.v7.CardView.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.v7.CardView.dll + + + ..\..\packages\Xamarin.Android.Support.v7.MediaRouter.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.v7.MediaRouter.dll + + + ..\..\packages\Xamarin.Android.Support.v7.Palette.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.v7.Palette.dll + + + ..\..\packages\Xamarin.Android.Support.v7.RecyclerView.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.v7.RecyclerView.dll + + + ..\..\packages\Xamarin.Android.Support.Vector.Drawable.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Vector.Drawable.dll + + + ..\..\packages\Xamarin.Android.Support.VersionedParcelable.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.VersionedParcelable.dll + + + ..\..\packages\Xamarin.Android.Support.ViewPager.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.ViewPager.dll + + + ..\..\packages\Xamarin.Forms.4.8.0.1821\lib\MonoAndroid90\Xamarin.Forms.Core.dll + + + ..\..\packages\Xamarin.Forms.4.8.0.1821\lib\MonoAndroid90\Xamarin.Forms.Platform.dll + + + ..\..\packages\Xamarin.Forms.4.8.0.1821\lib\MonoAndroid90\Xamarin.Forms.Platform.Android.dll + + + ..\..\packages\Xamarin.Forms.4.8.0.1821\lib\MonoAndroid90\Xamarin.Forms.Xaml.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {8c8eaa13-5824-462c-8149-d87db8afe587} + PdfSharp.Xamarin.Forms.Droid + + + {86bc6014-ac2d-452b-a4c4-d8e90cd54596} + PdfSharp.Xamarin.Forms + + + {698e271b-97b3-4fd8-a81d-0b149033fb9a} + PdfSharpCore + + + {fc44d6fa-dbe2-4e52-8677-942f2a50181b} + PdfSharp.Xamarin.Sample + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.Android/Properties/AndroidManifest.xml b/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.Android/Properties/AndroidManifest.xml index 325ae0b..0fc9cca 100644 --- a/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.Android/Properties/AndroidManifest.xml +++ b/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.Android/Properties/AndroidManifest.xml @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.Android/packages.config b/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.Android/packages.config index 44363d7..4238274 100644 --- a/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.Android/packages.config +++ b/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.Android/packages.config @@ -1,23 +1,43 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.UWP/PdfSharp.Xamarin.Sample.UWP.csproj b/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.UWP/PdfSharp.Xamarin.Sample.UWP.csproj index b7c0519..247a85e 100644 --- a/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.UWP/PdfSharp.Xamarin.Sample.UWP.csproj +++ b/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.UWP/PdfSharp.Xamarin.Sample.UWP.csproj @@ -1,183 +1,183 @@ - - - - - Debug - x86 - {7CF06189-81AF-4761-B2B7-F524F2FB9E38} - AppContainerExe - Properties - PdfSharp.Xamarin.Sample.UWP - PdfSharp.Xamarin.Sample.UWP - en-US - UAP - 10.0.17134.0 - 10.0.14393.0 - 14 - true - 512 - {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - PdfSharp.Xamarin.Sample.UWP_TemporaryKey.pfx - win10-arm;win10-arm-aot;win10-x86;win10-x86-aot;win10-x64;win10-x64-aot - - - true - bin\ARM\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - ARM - false - prompt - true - - - bin\ARM\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - ARM - false - prompt - true - true - - - true - bin\x64\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x64 - false - prompt - true - - - bin\x64\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x64 - false - prompt - true - true - - - true - bin\x86\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x86 - false - prompt - true - - - bin\x86\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x86 - false - prompt - true - true - - - - App.xaml - - - MainPage.xaml - - - - - - - Designer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - - - {50e03492-a06d-4702-9736-b14b56111e90} - PdfSharp.Xamarin.Forms.UWP - - - {86bc6014-ac2d-452b-a4c4-d8e90cd54596} - PdfSharp.Xamarin.Forms - - - {698e271b-97b3-4fd8-a81d-0b149033fb9a} - PdfSharpCore - - - {fc44d6fa-dbe2-4e52-8677-942f2a50181b} - PdfSharp.Xamarin.Sample - - - - - 6.1.5 - - - 2.5.1.527436 - - - - 14.0 - - + + + + + Debug + x86 + {7CF06189-81AF-4761-B2B7-F524F2FB9E38} + AppContainerExe + Properties + PdfSharp.Xamarin.Sample.UWP + PdfSharp.Xamarin.Sample.UWP + en-US + UAP + 10.0.19041.0 + 10.0.16299.0 + 14 + true + 512 + {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + PdfSharp.Xamarin.Sample.UWP_TemporaryKey.pfx + win10-arm;win10-arm-aot;win10-x86;win10-x86-aot;win10-x64;win10-x64-aot + + + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + ARM + false + prompt + true + + + bin\ARM\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + ARM + false + prompt + true + true + + + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x64 + false + prompt + true + + + bin\x64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x64 + false + prompt + true + true + + + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x86 + false + prompt + true + + + bin\x86\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x86 + false + prompt + true + true + + + + App.xaml + + + MainPage.xaml + + + + + + + Designer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + + + {50e03492-a06d-4702-9736-b14b56111e90} + PdfSharp.Xamarin.Forms.UWP + + + {86bc6014-ac2d-452b-a4c4-d8e90cd54596} + PdfSharp.Xamarin.Forms + + + {698e271b-97b3-4fd8-a81d-0b149033fb9a} + PdfSharpCore + + + {fc44d6fa-dbe2-4e52-8677-942f2a50181b} + PdfSharp.Xamarin.Sample + + + + + 6.2.11 + + + 4.8.0.1821 + + + + 14.0 + + \ No newline at end of file diff --git a/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.iOS/PdfSharp.Xamarin.Sample.iOS.csproj b/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.iOS/PdfSharp.Xamarin.Sample.iOS.csproj index 5e9a6f4..ceab25b 100644 --- a/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.iOS/PdfSharp.Xamarin.Sample.iOS.csproj +++ b/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.iOS/PdfSharp.Xamarin.Sample.iOS.csproj @@ -1,174 +1,171 @@ - - - - - Debug - iPhoneSimulator - 8.0.30703 - 2.0 - {77CA7CAE-B0C0-4B63-B583-1ECB3E7BDA82} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - PdfSharp.Xamarin.Sample.iOS - Resources - PdfSharp.Xamarin.Sample.iOS - - - - - true - full - false - bin\iPhoneSimulator\Debug - DEBUG - prompt - 4 - false - i386, x86_64 - SdkOnly - true - 11.3 - - - none - true - bin\iPhoneSimulator\Release - prompt - 4 - None - i386, x86_64 - false - - - true - full - false - bin\iPhone\Debug - DEBUG - prompt - 4 - false - ARMv7, ARM64 - iPhone Developer - true - Entitlements.plist - - - none - true - bin\iPhone\Release - prompt - 4 - ARMv7, ARM64 - false - iPhone Developer - Entitlements.plist - - - none - True - bin\iPhone\Ad-Hoc - prompt - 4 - False - ARMv7, ARM64 - True - Automatic:AdHoc - iPhone Distribution - Entitlements.plist - - - none - True - bin\iPhone\AppStore - prompt - 4 - False - ARMv7, ARM64 - Automatic:AppStore - iPhone Distribution - Entitlements.plist - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ..\..\packages\Xamarin.Forms.2.5.1.527436\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll - - - ..\..\packages\Xamarin.Forms.2.5.1.527436\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll - - - ..\..\packages\Xamarin.Forms.2.5.1.527436\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll - - - ..\..\packages\Xamarin.Forms.2.5.1.527436\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll - - - - - - {e71f3053-056c-4381-9638-048ed73bdff6} - PdfSharp.Xamarin.Forms.iOS - false - false - - - {86bc6014-ac2d-452b-a4c4-d8e90cd54596} - PdfSharp.Xamarin.Forms - - - {698e271b-97b3-4fd8-a81d-0b149033fb9a} - PdfSharpCore - - - {fc44d6fa-dbe2-4e52-8677-942f2a50181b} - PdfSharp.Xamarin.Sample - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - + + + + + Debug + iPhoneSimulator + 8.0.30703 + 2.0 + {77CA7CAE-B0C0-4B63-B583-1ECB3E7BDA82} + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Exe + PdfSharp.Xamarin.Sample.iOS + Resources + PdfSharp.Xamarin.Sample.iOS + + + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG + prompt + 4 + false + i386, x86_64 + SdkOnly + true + 11.3 + + + none + true + bin\iPhoneSimulator\Release + prompt + 4 + None + i386, x86_64 + false + + + true + full + false + bin\iPhone\Debug + DEBUG + prompt + 4 + false + ARMv7, ARM64 + iPhone Developer + true + Entitlements.plist + + + none + true + bin\iPhone\Release + prompt + 4 + ARMv7, ARM64 + false + iPhone Developer + Entitlements.plist + + + none + True + bin\iPhone\Ad-Hoc + prompt + 4 + False + ARMv7, ARM64 + True + Automatic:AdHoc + iPhone Distribution + Entitlements.plist + + + none + True + bin\iPhone\AppStore + prompt + 4 + False + ARMv7, ARM64 + Automatic:AppStore + iPhone Distribution + Entitlements.plist + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ..\..\packages\Xamarin.Forms.4.8.0.1821\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll + + + ..\..\packages\Xamarin.Forms.4.8.0.1821\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll + + + ..\..\packages\Xamarin.Forms.4.8.0.1821\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll + + + + + + {e71f3053-056c-4381-9638-048ed73bdff6} + PdfSharp.Xamarin.Forms.iOS + false + false + + + {86bc6014-ac2d-452b-a4c4-d8e90cd54596} + PdfSharp.Xamarin.Forms + + + {698e271b-97b3-4fd8-a81d-0b149033fb9a} + PdfSharpCore + + + {fc44d6fa-dbe2-4e52-8677-942f2a50181b} + PdfSharp.Xamarin.Sample + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.iOS/packages.config b/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.iOS/packages.config index 329d686..491f35b 100644 --- a/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.iOS/packages.config +++ b/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.iOS/packages.config @@ -1,4 +1,4 @@ - - - + + + \ No newline at end of file diff --git a/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.csproj b/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.csproj index d71e01c..c3095f3 100644 --- a/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.csproj +++ b/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample/PdfSharp.Xamarin.Sample.csproj @@ -1,13 +1,13 @@  - netstandard1.4 + netstandard2.0 akgulebubekir Full - + diff --git a/PdfSharpCore/PdfSharpCore.csproj b/PdfSharpCore/PdfSharpCore.csproj index 316bc8d..d18ddae 100644 --- a/PdfSharpCore/PdfSharpCore.csproj +++ b/PdfSharpCore/PdfSharpCore.csproj @@ -1,7 +1,7 @@  - netstandard1.4 + netstandard2.0 @@ -9,17 +9,20 @@ - TRACE;DEBUG;NETSTANDARD1_4; PORTABLE + TRACE;DEBUG;NETSTANDARD2_0; PORTABLE; full True - TRACE;RELEASE;NETSTANDARD1_4; PORTABLE;RELEASE;NETSTANDARD1_4 + TRACE;RELEASE;NETSTANDARD2_0; PORTABLE;RELEASE;NETSTANDARD2_0 - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + \ No newline at end of file From 4c346e5d5d1f1c71c5ec0be4ce2ba483ae7882ab Mon Sep 17 00:00:00 2001 From: akgulebubekir Date: Mon, 28 Dec 2020 15:00:32 +0100 Subject: [PATCH 02/13] Extensions moved into ther own namespace --- PdfSharp.Xamarin.Forms/Delegates/PDFListViewRendererDelegate.cs | 1 + PdfSharp.Xamarin.Forms/Extensions/ColorExtension.cs | 2 +- PdfSharp.Xamarin.Forms/Extensions/LayoutOptionsExtension.cs | 2 +- PdfSharp.Xamarin.Forms/Extensions/PointExtension.cs | 2 +- PdfSharp.Xamarin.Forms/Extensions/RectangleExtensions.cs | 2 +- PdfSharp.Xamarin.Forms/Renderers/PDFLabelRender.cs | 1 + PdfSharp.Xamarin.Forms/Renderers/PdfBoxViewRenderer.cs | 1 + PdfSharp.Xamarin.Forms/Renderers/PdfButtonRenderer.cs | 1 + PdfSharp.Xamarin.Forms/Renderers/PdfContentViewRenderer.cs | 1 + PdfSharp.Xamarin.Forms/Renderers/PdfDatePickerRenderer.cs | 1 + PdfSharp.Xamarin.Forms/Renderers/PdfEditorRenderer.cs | 1 + PdfSharp.Xamarin.Forms/Renderers/PdfEntryRenderer.cs | 1 + PdfSharp.Xamarin.Forms/Renderers/PdfImageRenderer.cs | 1 + PdfSharp.Xamarin.Forms/Renderers/PdfPickerRenderer.cs | 1 + PdfSharp.Xamarin.Forms/Renderers/PdfProgressBarRenderer.cs | 1 + PdfSharp.Xamarin.Forms/Renderers/PdfSearchBarRenderer.cs | 1 + 16 files changed, 16 insertions(+), 4 deletions(-) diff --git a/PdfSharp.Xamarin.Forms/Delegates/PDFListViewRendererDelegate.cs b/PdfSharp.Xamarin.Forms/Delegates/PDFListViewRendererDelegate.cs index 7f604df..4f4078a 100644 --- a/PdfSharp.Xamarin.Forms/Delegates/PDFListViewRendererDelegate.cs +++ b/PdfSharp.Xamarin.Forms/Delegates/PDFListViewRendererDelegate.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Linq; +using PdfSharp.Xamarin.Forms.Extensions; using PdfSharpCore.Drawing; using PdfSharpCore.Fonts; using Xamarin.Forms; diff --git a/PdfSharp.Xamarin.Forms/Extensions/ColorExtension.cs b/PdfSharp.Xamarin.Forms/Extensions/ColorExtension.cs index 44f19f3..2d499cc 100644 --- a/PdfSharp.Xamarin.Forms/Extensions/ColorExtension.cs +++ b/PdfSharp.Xamarin.Forms/Extensions/ColorExtension.cs @@ -1,7 +1,7 @@ using PdfSharpCore.Drawing; using Xamarin.Forms; -namespace PdfSharp.Xamarin.Forms +namespace PdfSharp.Xamarin.Forms.Extensions { public static class ColorExtension { diff --git a/PdfSharp.Xamarin.Forms/Extensions/LayoutOptionsExtension.cs b/PdfSharp.Xamarin.Forms/Extensions/LayoutOptionsExtension.cs index fb54251..78be7b5 100644 --- a/PdfSharp.Xamarin.Forms/Extensions/LayoutOptionsExtension.cs +++ b/PdfSharp.Xamarin.Forms/Extensions/LayoutOptionsExtension.cs @@ -1,7 +1,7 @@ using PdfSharpCore.Drawing; using Xamarin.Forms; -namespace PdfSharp.Xamarin.Forms +namespace PdfSharp.Xamarin.Forms.Extensions { public static class LayoutOptionsExtension { diff --git a/PdfSharp.Xamarin.Forms/Extensions/PointExtension.cs b/PdfSharp.Xamarin.Forms/Extensions/PointExtension.cs index 025e510..b4588b6 100644 --- a/PdfSharp.Xamarin.Forms/Extensions/PointExtension.cs +++ b/PdfSharp.Xamarin.Forms/Extensions/PointExtension.cs @@ -1,7 +1,7 @@ using PdfSharpCore.Drawing; using Xamarin.Forms; -namespace PdfSharp.Xamarin.Forms +namespace PdfSharp.Xamarin.Forms.Extensions { public static class PointExtension { diff --git a/PdfSharp.Xamarin.Forms/Extensions/RectangleExtensions.cs b/PdfSharp.Xamarin.Forms/Extensions/RectangleExtensions.cs index bd16566..fca2fac 100644 --- a/PdfSharp.Xamarin.Forms/Extensions/RectangleExtensions.cs +++ b/PdfSharp.Xamarin.Forms/Extensions/RectangleExtensions.cs @@ -1,7 +1,7 @@ using PdfSharpCore.Drawing; using Xamarin.Forms; -namespace PdfSharp.Xamarin.Forms +namespace PdfSharp.Xamarin.Forms.Extensions { public static class RectangleExtensions { diff --git a/PdfSharp.Xamarin.Forms/Renderers/PDFLabelRender.cs b/PdfSharp.Xamarin.Forms/Renderers/PDFLabelRender.cs index 1641eef..62cf34b 100644 --- a/PdfSharp.Xamarin.Forms/Renderers/PDFLabelRender.cs +++ b/PdfSharp.Xamarin.Forms/Renderers/PDFLabelRender.cs @@ -1,4 +1,5 @@ using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; using PdfSharpCore.Drawing; using PdfSharpCore.Fonts; using Xamarin.Forms; diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfBoxViewRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfBoxViewRenderer.cs index 1d2621f..0f52033 100644 --- a/PdfSharp.Xamarin.Forms/Renderers/PdfBoxViewRenderer.cs +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfBoxViewRenderer.cs @@ -1,4 +1,5 @@ using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; using PdfSharpCore.Drawing; using Xamarin.Forms; diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfButtonRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfButtonRenderer.cs index 93b0bab..ef8dcf6 100644 --- a/PdfSharp.Xamarin.Forms/Renderers/PdfButtonRenderer.cs +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfButtonRenderer.cs @@ -1,4 +1,5 @@ using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; using PdfSharpCore.Drawing; using PdfSharpCore.Fonts; using Xamarin.Forms; diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfContentViewRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfContentViewRenderer.cs index 0dedc11..7de90f2 100644 --- a/PdfSharp.Xamarin.Forms/Renderers/PdfContentViewRenderer.cs +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfContentViewRenderer.cs @@ -1,4 +1,5 @@ using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; using PdfSharpCore.Drawing; using Xamarin.Forms; diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfDatePickerRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfDatePickerRenderer.cs index ffa4740..ec56fac 100644 --- a/PdfSharp.Xamarin.Forms/Renderers/PdfDatePickerRenderer.cs +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfDatePickerRenderer.cs @@ -1,4 +1,5 @@ using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; using PdfSharpCore.Drawing; using PdfSharpCore.Fonts; using Xamarin.Forms; diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfEditorRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfEditorRenderer.cs index 9b3e4d9..a21cb01 100644 --- a/PdfSharp.Xamarin.Forms/Renderers/PdfEditorRenderer.cs +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfEditorRenderer.cs @@ -1,4 +1,5 @@ using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; using PdfSharpCore.Drawing; using PdfSharpCore.Fonts; using Xamarin.Forms; diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfEntryRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfEntryRenderer.cs index 2525882..9ad5184 100644 --- a/PdfSharp.Xamarin.Forms/Renderers/PdfEntryRenderer.cs +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfEntryRenderer.cs @@ -1,4 +1,5 @@ using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; using PdfSharpCore.Drawing; using PdfSharpCore.Fonts; using Xamarin.Forms; diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfImageRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfImageRenderer.cs index 67e1d35..dce7a50 100644 --- a/PdfSharp.Xamarin.Forms/Renderers/PdfImageRenderer.cs +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfImageRenderer.cs @@ -1,4 +1,5 @@ using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; using PdfSharpCore.Drawing; using Xamarin.Forms; diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfPickerRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfPickerRenderer.cs index d41382b..ab4250b 100644 --- a/PdfSharp.Xamarin.Forms/Renderers/PdfPickerRenderer.cs +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfPickerRenderer.cs @@ -1,4 +1,5 @@ using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; using PdfSharpCore.Drawing; using PdfSharpCore.Fonts; using Xamarin.Forms; diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfProgressBarRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfProgressBarRenderer.cs index 9bc6c6a..85e4c25 100644 --- a/PdfSharp.Xamarin.Forms/Renderers/PdfProgressBarRenderer.cs +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfProgressBarRenderer.cs @@ -1,4 +1,5 @@ using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; using PdfSharpCore.Drawing; using Xamarin.Forms; diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfSearchBarRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfSearchBarRenderer.cs index 7f3ed81..efced67 100644 --- a/PdfSharp.Xamarin.Forms/Renderers/PdfSearchBarRenderer.cs +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfSearchBarRenderer.cs @@ -1,5 +1,6 @@ using System.Reflection; using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; using PdfSharpCore.Drawing; using PdfSharpCore.Fonts; using Xamarin.Forms; From 1ceb34b5b073755a44ed569bce673c41b40638a1 Mon Sep 17 00:00:00 2001 From: akgulebubekir Date: Mon, 28 Dec 2020 15:01:43 +0100 Subject: [PATCH 03/13] BrushExtension added to support LinearGradient --- .../Extensions/BrushExtension.cs | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 PdfSharp.Xamarin.Forms/Extensions/BrushExtension.cs diff --git a/PdfSharp.Xamarin.Forms/Extensions/BrushExtension.cs b/PdfSharp.Xamarin.Forms/Extensions/BrushExtension.cs new file mode 100644 index 0000000..f65793e --- /dev/null +++ b/PdfSharp.Xamarin.Forms/Extensions/BrushExtension.cs @@ -0,0 +1,43 @@ +using System.Linq; +using PdfSharpCore.Drawing; +using Xamarin.Forms; + +namespace PdfSharp.Xamarin.Forms.Extensions +{ + public static class BrushExtension + { + public static XBrush ToXBrush(this Brush brush) + { + switch (brush) + { + case LinearGradientBrush gradientBrush when gradientBrush.GradientStops.Any(): + return new XLinearGradientBrush(gradientBrush.StartPoint.ToXPoint(), + gradientBrush.EndPoint.ToXPoint(), gradientBrush.GradientStops.First().Color.ToXColor(), + gradientBrush.GradientStops.Last().Color.ToXColor()); + case SolidColorBrush solidColorBrush: + return new XSolidBrush(solidColorBrush.Color.ToXColor()); + default: + return new XSolidBrush(XColors.Black); + } + } + + public static XPen ToXPen(this Brush brush, double with) + { + XColor color; + switch (brush) + { + case LinearGradientBrush gradientBrush when gradientBrush.GradientStops.Any(): + color = gradientBrush.GradientStops.First().Color.ToXColor(); + break; + case SolidColorBrush solidColorBrush: + color = solidColorBrush.Color.ToXColor(); + break; + default: + color = XColors.Black; + break; + } + + return new XPen(color, with); + } + } +} From af25a73be5e1ffc09a9ab04eadeac5ce5bf77fd5 Mon Sep 17 00:00:00 2001 From: akgulebubekir Date: Mon, 28 Dec 2020 15:03:19 +0100 Subject: [PATCH 04/13] Renderers implemented for Ellipse, Line and Rectangle Shapes --- .../Renderers/PdfEllipseRenderer.cs | 21 ++++++++++++++++ .../Renderers/PdfLineRenderer.cs | 25 +++++++++++++++++++ .../Renderers/PdfRectangleRenderer.cs | 23 +++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 PdfSharp.Xamarin.Forms/Renderers/PdfEllipseRenderer.cs create mode 100644 PdfSharp.Xamarin.Forms/Renderers/PdfLineRenderer.cs create mode 100644 PdfSharp.Xamarin.Forms/Renderers/PdfRectangleRenderer.cs diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfEllipseRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfEllipseRenderer.cs new file mode 100644 index 0000000..7cc257a --- /dev/null +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfEllipseRenderer.cs @@ -0,0 +1,21 @@ +using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; +using PdfSharpCore.Drawing; +using Xamarin.Forms.Shapes; + +namespace PdfSharp.Xamarin.Forms.Renderers +{ + [PdfRenderer(ViewType = typeof(Ellipse))] + public class PdfEllipseRenderer : PdfRendererBase + { + public override void CreatePDFLayout(XGraphics page, Ellipse ellipse, XRect bounds, double scaleFactor) + { + if (ellipse.BackgroundColor != default) + page.DrawRectangle(ellipse.BackgroundColor.ToXBrush(), bounds); + if (ellipse.Stroke != null) + page.DrawEllipse(ellipse.Stroke.ToXPen(ellipse.StrokeThickness * scaleFactor), bounds); + if (ellipse.Fill != null) + page.DrawEllipse(ellipse.Fill.ToXBrush(), bounds); + } + } +} diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfLineRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfLineRenderer.cs new file mode 100644 index 0000000..035f307 --- /dev/null +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfLineRenderer.cs @@ -0,0 +1,25 @@ +using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; +using PdfSharpCore.Drawing; +using Xamarin.Forms.Shapes; + +namespace PdfSharp.Xamarin.Forms.Renderers +{ + [PdfRenderer(ViewType = typeof(Line))] + public class PdfLineRenderer : PdfRendererBase + { + public override void CreatePDFLayout(XGraphics page, Line line, XRect bounds, double scaleFactor) + { + if (line.BackgroundColor != default) + page.DrawRectangle(line.BackgroundColor.ToXBrush(), bounds); + + var x1 = bounds.X + line.X1 * bounds.Width / line.Width; + var x2 = bounds.X + line.X2 * bounds.Width / line.Width; + var y1 = bounds.Y + line.Y1 * bounds.Height / line.Height; + var y2 = bounds.Y + line.Y2 * bounds.Height / line.Height; + + if (line.Stroke != null) + page.DrawLine(line.Stroke.ToXPen(line.StrokeThickness * scaleFactor), x1, y1, x2, y2); + } + } +} diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfRectangleRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfRectangleRenderer.cs new file mode 100644 index 0000000..6223e4b --- /dev/null +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfRectangleRenderer.cs @@ -0,0 +1,23 @@ +using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; +using PdfSharpCore.Drawing; +using Rectangle = Xamarin.Forms.Shapes.Rectangle; + +namespace PdfSharp.Xamarin.Forms.Renderers +{ + [PdfRenderer(ViewType = typeof(Rectangle))] + public class PdfRectangleRenderer : PdfRendererBase + { + public override void CreatePDFLayout(XGraphics page, Rectangle rectangle, XRect bounds, double scaleFactor) + { + if (rectangle.BackgroundColor != default) + page.DrawRectangle(rectangle.BackgroundColor.ToXBrush(), bounds); + + if (rectangle.Fill != null) + page.DrawRectangle(rectangle.Fill.ToXBrush(), bounds); + + if (rectangle.Stroke != null) + page.DrawRectangle(rectangle.Stroke.ToXPen(rectangle.StrokeThickness * scaleFactor), bounds); + } + } +} From 0bd7c4f3a64a710d8129b9b2d35b6626bfbe9c51 Mon Sep 17 00:00:00 2001 From: akgulebubekir Date: Mon, 28 Dec 2020 15:04:11 +0100 Subject: [PATCH 05/13] Extension method implemented to create XStringFormat from TextAlignment --- .../Extensions/LayoutOptionsExtension.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PdfSharp.Xamarin.Forms/Extensions/LayoutOptionsExtension.cs b/PdfSharp.Xamarin.Forms/Extensions/LayoutOptionsExtension.cs index 78be7b5..edf9f20 100644 --- a/PdfSharp.Xamarin.Forms/Extensions/LayoutOptionsExtension.cs +++ b/PdfSharp.Xamarin.Forms/Extensions/LayoutOptionsExtension.cs @@ -34,5 +34,14 @@ public static XLineAlignment ToXLineAlignment(this TextAlignment alignment) return XLineAlignment.BaseLine; } } + + public static XStringFormat ToXStringFormat(this TextAlignment alignment) + { + return new XStringFormat + { + Alignment = alignment.ToXStringAlignment(), + LineAlignment = alignment.ToXLineAlignment(), + }; + } } } From 5352195405de0d6a8fd11a725a6ccbe3e4b597a9 Mon Sep 17 00:00:00 2001 From: akgulebubekir Date: Mon, 28 Dec 2020 15:05:04 +0100 Subject: [PATCH 06/13] CheckBox, ImageButton, RadioButton, Slider and Switch renderers implemented --- .../Renderers/PdfCheckboxRenderer.cs | 62 ++++++++++++ .../Renderers/PdfImageButtonRenderer.cs | 68 +++++++++++++ .../Renderers/PdfRadioButtonRenderer.cs | 42 ++++++++ .../Renderers/PdfSliderRenderer.cs | 32 ++++++ .../Renderers/PdfSwitchRenderer.cs | 99 +++++++++++++++++++ 5 files changed, 303 insertions(+) create mode 100644 PdfSharp.Xamarin.Forms/Renderers/PdfCheckboxRenderer.cs create mode 100644 PdfSharp.Xamarin.Forms/Renderers/PdfImageButtonRenderer.cs create mode 100644 PdfSharp.Xamarin.Forms/Renderers/PdfRadioButtonRenderer.cs create mode 100644 PdfSharp.Xamarin.Forms/Renderers/PdfSliderRenderer.cs create mode 100644 PdfSharp.Xamarin.Forms/Renderers/PdfSwitchRenderer.cs diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfCheckboxRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfCheckboxRenderer.cs new file mode 100644 index 0000000..8ebbc44 --- /dev/null +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfCheckboxRenderer.cs @@ -0,0 +1,62 @@ +using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; +using PdfSharpCore.Drawing; +using Xamarin.Forms; + +namespace PdfSharp.Xamarin.Forms.Renderers +{ + [PdfRenderer(ViewType = typeof(RadioButton))] + public class PdfCheckBoxRenderer : PdfRendererBase + { + public override void CreatePDFLayout(XGraphics page, CheckBox checkBox, XRect bounds, double scaleFactor) + { + if (checkBox.BackgroundColor != default) + page.DrawRectangle(checkBox.BackgroundColor.ToXBrush(), bounds); + + var adjustedBounds = new XRect(bounds.Location, new XSize(bounds.Height, bounds.Height)); + var checkPath = new[] + { + new XPoint(adjustedBounds.Width * 0.15, adjustedBounds.Height * 0.3), + new XPoint(adjustedBounds.Width * 0.3, adjustedBounds.Height * 0.7), + new XPoint(adjustedBounds.Width * 0.85, adjustedBounds.Height * 0.8) + }; + + switch (Device.RuntimePlatform) + { + case Device.iOS: + case Device.macOS: + if (checkBox.IsChecked) + { + page.DrawEllipse(checkBox.Color.ToXBrush(), adjustedBounds); + page.DrawLines(new XPen(XColors.White, scaleFactor * 3), checkPath); + } + else + page.DrawEllipse(new XPen(checkBox.Color.ToXColor(), scaleFactor), adjustedBounds); + + break; + + case Device.Android: + if (checkBox.IsChecked) + { + page.DrawRectangle(checkBox.Color.ToXBrush(), adjustedBounds); + page.DrawLines(new XPen(XColors.White, scaleFactor * 3), checkPath); + } + else + page.DrawRectangle(new XPen(checkBox.Color.ToXColor(), scaleFactor), adjustedBounds); + + break; + case Device.UWP: + case Device.WPF: + if (checkBox.IsChecked) + { + page.DrawRectangle(checkBox.Color.ToXBrush(), adjustedBounds); + page.DrawLines(new XPen(XColors.LightBlue, scaleFactor * 3), checkPath); + } + else + page.DrawRectangle(new XPen(checkBox.Color.ToXColor(), scaleFactor), adjustedBounds); + + break; + } + } + } +} diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfImageButtonRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfImageButtonRenderer.cs new file mode 100644 index 0000000..7f28d36 --- /dev/null +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfImageButtonRenderer.cs @@ -0,0 +1,68 @@ +using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; +using PdfSharpCore.Drawing; +using Xamarin.Forms; + +namespace PdfSharp.Xamarin.Forms.Renderers +{ + [PdfRenderer(ViewType = typeof(ImageButton))] + public class PdfImageButtonRenderer : PdfRendererBase + { + public override async void CreatePDFLayout(XGraphics page, ImageButton imageButton, XRect bounds, + double scaleFactor) + { + if (imageButton.BackgroundColor != default) + page.DrawRectangle(imageButton.BackgroundColor.ToXBrush(), bounds); + + if (imageButton.Source == null) + return; + + XImage img = null; + + switch (imageButton.Source) + { + case FileImageSource fileImageSource: + img = XImage.FromFile(fileImageSource.File); + break; + case UriImageSource uriImageSource: + img = XImage.FromFile(uriImageSource.Uri.AbsolutePath); + break; + case StreamImageSource streamImageSource: + { + var stream = await streamImageSource.Stream.Invoke(new System.Threading.CancellationToken()); + img = XImage.FromStream(() => stream); + break; + } + } + + XRect desiredBounds = bounds; + switch (imageButton.Aspect) + { + case Aspect.Fill: + desiredBounds = bounds; + break; + case Aspect.AspectFit: + { + double aspectRatio = (double) img.PixelWidth / img.PixelHeight; + if (aspectRatio > bounds.Width / bounds.Height) + desiredBounds.Height = desiredBounds.Width * aspectRatio; + else + desiredBounds.Width = desiredBounds.Height * aspectRatio; + } + break; + //PdfSharp does not support drawing a portion pf image, its not supported + case Aspect.AspectFill: + desiredBounds = bounds; + break; + } + + if (imageButton.BorderColor != default) + page.DrawRectangle(new XPen(imageButton.BorderColor.ToXColor(), imageButton.BorderWidth * scaleFactor), + bounds); + + var centeredBounds = new XRect(bounds.X + (bounds.Width - desiredBounds.Width) / 2, + bounds.Y + (bounds.Height - desiredBounds.Height) / 2, desiredBounds.Width, desiredBounds.Height); + page.DrawImage(img, centeredBounds, new System.Threading.CancellationToken()); + } + } +} diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfRadioButtonRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfRadioButtonRenderer.cs new file mode 100644 index 0000000..97e2ba5 --- /dev/null +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfRadioButtonRenderer.cs @@ -0,0 +1,42 @@ +using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; +using PdfSharpCore.Drawing; +using PdfSharpCore.Fonts; +using Xamarin.Forms; + +namespace PdfSharp.Xamarin.Forms.Renderers +{ + [PdfRenderer(ViewType = typeof(RadioButton))] + public class PdfRadioButtonRenderer : PdfRendererBase + { + public static readonly XStringFormat DefaultTextFormat = new XStringFormat + { + LineAlignment = XLineAlignment.Center, + Alignment = XStringAlignment.Near, + }; + + public override void CreatePDFLayout(XGraphics page, RadioButton button, XRect bounds, double scaleFactor) + { + var font = new XFont(button.FontFamily ?? GlobalFontSettings.FontResolver.DefaultFontName, + button.FontSize * scaleFactor); + var textColor = button.TextColor != default ? button.TextColor : Color.Black; + + if (button.BackgroundColor != default) + page.DrawRectangle(button.BackgroundColor.ToXBrush(), bounds); + if (button.BorderWidth > 0 && button.BorderColor != default) + page.DrawRectangle(new XPen(button.BorderColor.ToXColor(), button.BorderWidth * scaleFactor), bounds); + + page.DrawEllipse(new XPen(Color.Black.ToXColor(), scaleFactor * 2), bounds.X + bounds.Height * 0.1, + bounds.Y + bounds.Height * 0.1, bounds.Height * 0.8, bounds.Height * 0.8); + + if (button.IsChecked) + page.DrawEllipse(Color.Black.ToXBrush(), bounds.X + bounds.Height * 0.3, bounds.Y + bounds.Height * 0.3, + bounds.Height * 0.4, bounds.Height * 0.4); + + if (!string.IsNullOrEmpty(button.Text)) + page.DrawString(button.Text, font, textColor.ToXBrush(), + new XRect(new XPoint(bounds.X + bounds.Height, bounds.Y), + new XSize(bounds.Width - bounds.Height, bounds.Height)), DefaultTextFormat); + } + } +} diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfSliderRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfSliderRenderer.cs new file mode 100644 index 0000000..7784b3a --- /dev/null +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfSliderRenderer.cs @@ -0,0 +1,32 @@ +using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; +using PdfSharpCore.Drawing; +using Xamarin.Forms; + +namespace PdfSharp.Xamarin.Forms.Renderers +{ + [PdfRenderer(ViewType = typeof(Slider))] + public class PdfSliderRenderer : PdfRendererBase + { + public override void CreatePDFLayout(XGraphics page, Slider slider, XRect bounds, double scaleFactor) + { + double valueXPosition = slider.Value / (slider.Maximum - slider.Minimum) * bounds.Width; + var minimumTrackColor = slider.MinimumTrackColor != default + ? slider.MinimumTrackColor.ToXBrush() + : XBrushes.LightBlue; + var maximumTrackColor = slider.MaximumTrackColor != default + ? slider.MaximumTrackColor.ToXBrush() + : XBrushes.LightGray; + var thumbColor = slider.ThumbColor != default ? slider.ThumbColor.ToXBrush() : XBrushes.LightSlateGray; + + if (slider.BackgroundColor != default) + page.DrawRectangle(slider.BackgroundColor.ToXBrush(), bounds); + + page.DrawRectangle(minimumTrackColor, bounds.X, bounds.Y, valueXPosition, 8 * scaleFactor); + page.DrawRectangle(maximumTrackColor, valueXPosition + bounds.X, bounds.Y, bounds.Width - valueXPosition, + 8 * scaleFactor); + page.DrawEllipse(thumbColor, bounds.X + valueXPosition - 10 * scaleFactor, + bounds.Y + bounds.Height % 2 - 6 * scaleFactor, 20 * scaleFactor, 20 * scaleFactor); + } + } +} diff --git a/PdfSharp.Xamarin.Forms/Renderers/PdfSwitchRenderer.cs b/PdfSharp.Xamarin.Forms/Renderers/PdfSwitchRenderer.cs new file mode 100644 index 0000000..ccde880 --- /dev/null +++ b/PdfSharp.Xamarin.Forms/Renderers/PdfSwitchRenderer.cs @@ -0,0 +1,99 @@ +using PdfSharp.Xamarin.Forms.Attributes; +using PdfSharp.Xamarin.Forms.Extensions; +using PdfSharpCore.Drawing; +using Xamarin.Forms; + +namespace PdfSharp.Xamarin.Forms.Renderers +{ + [PdfRenderer(ViewType = typeof(Switch))] + public class PdfSwitchRenderer : PdfRendererBase + { + public override void CreatePDFLayout(XGraphics page, Switch toggleSwitch, XRect bounds, double scaleFactor) + { + if (toggleSwitch.BackgroundColor != default) + page.DrawRectangle(toggleSwitch.BackgroundColor.ToXBrush(), bounds); + + switch (Device.RuntimePlatform) + { + case Device.iOS: + case Device.macOS: + DrawForiOS(page, toggleSwitch, bounds, scaleFactor); + break; + case Device.Android: + DrawForAndroid(page, toggleSwitch, bounds, scaleFactor); + break; + case Device.UWP: + case Device.WPF: + default: + DrawForUWP(page, toggleSwitch, bounds, scaleFactor); + break; + } + } + + #region Platform Helpers + + private void DrawForiOS(XGraphics page, Switch toggleSwitch, XRect bounds, double scaleFactor) + { + var thumbColor = toggleSwitch.ThumbColor != default ? toggleSwitch.ThumbColor : Color.WhiteSmoke; + if (toggleSwitch.IsToggled) + { + var onColor = toggleSwitch.OnColor != default ? toggleSwitch.OnColor : Color.Green; + page.DrawRoundedRectangle(onColor.ToXBrush(), bounds.X, bounds.Y, 2 * bounds.Height, bounds.Height, + bounds.Height, bounds.Height); + page.DrawEllipse(thumbColor.ToXBrush(), bounds.X + bounds.Height * 1.1, bounds.Y + bounds.Height * 0.1, + bounds.Height * 0.8, bounds.Height * 0.8); + } + else + { + page.DrawRoundedRectangle(new XPen(XColors.LightGray, scaleFactor), bounds.X, bounds.Y, + 2 * bounds.Height, bounds.Height, bounds.Height, bounds.Height); + + page.DrawEllipse(new XPen(Color.LightGray.ToXColor(), scaleFactor), bounds.X + bounds.Height * 0.1, + bounds.Y + bounds.Height * 0.1, bounds.Height * 0.8, bounds.Height * 0.8); + } + } + + private void DrawForAndroid(XGraphics page, Switch toggleSwitch, XRect bounds, double scaleFactor) + { + var thumbColor = toggleSwitch.ThumbColor != default ? toggleSwitch.ThumbColor : Color.WhiteSmoke; + if (toggleSwitch.IsToggled) + { + var onColor = toggleSwitch.OnColor != default ? toggleSwitch.OnColor : Color.DodgerBlue; + page.DrawRoundedRectangle(onColor.ToXBrush(), bounds.X, bounds.Y + bounds.Height * 0.25, + 2 * bounds.Height, bounds.Height * 0.5, bounds.Height / 2, bounds.Height / 2); + page.DrawEllipse(thumbColor.ToXBrush(), bounds.X + bounds.Height * 1.1, bounds.Y + bounds.Height * 0.1, + bounds.Height * 0.8, bounds.Height * 0.8); + } + else + { + page.DrawRoundedRectangle(Color.DarkGray.ToXBrush(), bounds.X, bounds.Y + bounds.Height * 0.25, + 2 * bounds.Height, bounds.Height * 0.5, bounds.Height / 2, bounds.Height / 2); + page.DrawEllipse(Color.LightGray.ToXBrush(), bounds.X + bounds.Height * 0.1, + bounds.Y + bounds.Height * 0.1, bounds.Height * 0.8, bounds.Height * 0.8); + } + } + + private void DrawForUWP(XGraphics page, Switch toggleSwitch, XRect bounds, double scaleFactor) + { + var thumbColor = toggleSwitch.ThumbColor != default ? toggleSwitch.ThumbColor : Color.WhiteSmoke; + if (toggleSwitch.IsToggled) + { + var onColor = toggleSwitch.OnColor != default ? toggleSwitch.OnColor : Color.DodgerBlue; + page.DrawRoundedRectangle(onColor.ToXBrush(), bounds.X, bounds.Y, 2 * bounds.Height, bounds.Height, + bounds.Height, bounds.Height); + page.DrawEllipse(thumbColor.ToXBrush(), bounds.X + bounds.Height * 1.2, bounds.Y + bounds.Height * 0.2, + bounds.Height * 0.6, bounds.Height * 0.6); + } + else + { + page.DrawRoundedRectangle(new XPen(XColors.LightGray, scaleFactor), bounds.X, bounds.Y, + 2 * bounds.Height, bounds.Height, bounds.Height, bounds.Height); + + page.DrawEllipse(Color.Black.ToXBrush(), bounds.X + bounds.Height * 0.2, bounds.Y + bounds.Height * 0.2, + bounds.Height * 0.6, bounds.Height * 0.6); + } + } + + #endregion + } +} From a6d093bd19b28686143ef8646a4b69856910c088 Mon Sep 17 00:00:00 2001 From: akgulebubekir Date: Mon, 28 Dec 2020 15:07:59 +0100 Subject: [PATCH 07/13] Refactoring for tabs-spaces, variable types and simplification --- .../Delegates/PDFListViewRendererDelegate.cs | 42 +++---- .../Extensions/ColorExtension.cs | 8 +- PdfSharp.Xamarin.Forms/PDFGenerator.cs | 53 +++++---- PdfSharp.Xamarin.Forms/PdfManager.cs | 26 +---- .../PdfRendererAttributes.cs | 14 +-- .../Renderers/PDFLabelRender.cs | 12 +- .../Renderers/PdfBoxViewRenderer.cs | 4 +- .../Renderers/PdfButtonRenderer.cs | 12 +- .../Renderers/PdfContentViewRenderer.cs | 2 +- .../Renderers/PdfDatePickerRenderer.cs | 8 +- .../Renderers/PdfEditorRenderer.cs | 17 +-- .../Renderers/PdfEntryRenderer.cs | 19 ++-- .../Renderers/PdfImageRenderer.cs | 40 ++++--- .../Renderers/PdfPickerRenderer.cs | 6 +- .../Renderers/PdfProgressBarRenderer.cs | 8 +- .../Renderers/PdfRendererBase.cs | 3 +- .../Renderers/PdfSearchBarRenderer.cs | 105 +++++++++++------- PdfSharp.Xamarin.Forms/Utils/FontProvider.cs | 22 ++-- 18 files changed, 201 insertions(+), 200 deletions(-) diff --git a/PdfSharp.Xamarin.Forms/Delegates/PDFListViewRendererDelegate.cs b/PdfSharp.Xamarin.Forms/Delegates/PDFListViewRendererDelegate.cs index 4f4078a..fb4a955 100644 --- a/PdfSharp.Xamarin.Forms/Delegates/PDFListViewRendererDelegate.cs +++ b/PdfSharp.Xamarin.Forms/Delegates/PDFListViewRendererDelegate.cs @@ -9,8 +9,8 @@ namespace PdfSharp.Xamarin.Forms.Delegates { public class PdfListViewRendererDelegate { - #region Items Calculation + public virtual int GetNumberOfSections(ListView listView) { if (!listView.IsGroupingEnabled) @@ -22,17 +22,17 @@ public virtual int GetNumberOfSections(ListView listView) public virtual int GetNumberOfRowsInSection(ListView listView, int section) { if (!listView.IsGroupingEnabled) - return listView.ItemsSource?.Cast()?.Count() ?? 0; + return listView.ItemsSource?.Cast().Count() ?? 0; - var sectionItems = listView.ItemsSource?.Cast()?.ElementAt(section); + var sectionItems = listView.ItemsSource?.Cast().ElementAt(section); return sectionItems?.Cast()?.Count() ?? 0; - } #endregion #region Size calculation + public virtual double GetHeaderHeight(ListView listView, int section) { if (listView.HeaderTemplate == null) @@ -65,48 +65,48 @@ public virtual double GetTotalHeight(ListView listView) height += GetFooterHeight(listView, section); for (int row = 0; row < GetNumberOfRowsInSection(listView, section); row++) + { height += GetCellHeight(listView, section, row); + } } return height; } + #endregion #region Template Drawing - public virtual void DrawHeader(ListView listView, int section, XGraphics page, XRect bounds, double scaleFactor) - { - } + public virtual void DrawHeader(ListView listView, int section, XGraphics page, XRect bounds, double scaleFactor) + { } public virtual void DrawFooter(ListView listView, int section, XGraphics page, XRect bounds, double scaleFactor) - { + { } - } - - public virtual void DrawCell(ListView listView, int section, int row, XGraphics page, XRect bounds, double scaleFactor) + public virtual void DrawCell(ListView listView, int section, int row, XGraphics page, XRect bounds, + double scaleFactor) { - var itemsource = listView.ItemsSource?.Cast(); object bindingContext = null; if (!listView.IsGroupingEnabled) - bindingContext = listView.ItemsSource?.Cast()?.ElementAt(row); + bindingContext = listView.ItemsSource?.Cast().ElementAt(row); else { - var grounSource = listView.ItemsSource?.Cast()?.ElementAt(section); - bindingContext = grounSource?.Cast()?.ElementAt(row); + var grounSource = listView.ItemsSource?.Cast().ElementAt(section); + bindingContext = grounSource?.Cast().ElementAt(row); } if (bindingContext != null) { XFont font = new XFont(GlobalFontSettings.FontResolver.DefaultFontName, 15 * scaleFactor); - page.DrawString(bindingContext.ToString(), font, Color.Black.ToXBrush(), bounds, - new XStringFormat() { - Alignment = XStringAlignment.Near, - LineAlignment = XLineAlignment.Center, - }); + page.DrawString(bindingContext.ToString(), font, Color.Black.ToXBrush(), bounds, new XStringFormat + { + Alignment = XStringAlignment.Near, + LineAlignment = XLineAlignment.Center, + }); } } - #endregion + #endregion } } diff --git a/PdfSharp.Xamarin.Forms/Extensions/ColorExtension.cs b/PdfSharp.Xamarin.Forms/Extensions/ColorExtension.cs index 2d499cc..e7c4900 100644 --- a/PdfSharp.Xamarin.Forms/Extensions/ColorExtension.cs +++ b/PdfSharp.Xamarin.Forms/Extensions/ColorExtension.cs @@ -7,10 +7,14 @@ public static class ColorExtension { public static XColor ToXColor(this Color color) { - if (color == default(Color)) + if (color == default) return XColors.Transparent; - return XColor.FromArgb((int)(color.A * 255), (int)(color.R * 255), (int)(color.G * 255), (int)(color.B * 255)); + return XColor.FromArgb( + (int) (color.A * 255), + (int) (color.R * 255), + (int) (color.G * 255), + (int) (color.B * 255)); } public static XBrush ToXBrush(this Color color) diff --git a/PdfSharp.Xamarin.Forms/PDFGenerator.cs b/PdfSharp.Xamarin.Forms/PDFGenerator.cs index 2520548..babe20c 100644 --- a/PdfSharp.Xamarin.Forms/PDFGenerator.cs +++ b/PdfSharp.Xamarin.Forms/PDFGenerator.cs @@ -13,11 +13,12 @@ namespace PdfSharp.Xamarin.Forms internal class PdfGenerator { #region Fields - double _scaleFactor; - XRect _desiredPageSize; - PageOrientation _orientation; - PageSize _pageSize; - View _rootView; + + readonly double _scaleFactor; + readonly XRect _desiredPageSize; + readonly PageOrientation _orientation; + readonly PageSize _pageSize; + readonly View _rootView; List _viewsToDraw; #endregion @@ -54,8 +55,9 @@ private void VisitView(View view, Point pageOffset) Point newOffset = new Point(pageOffset.X + view.X * _scaleFactor + invisiblesOffsetTreshold.X, pageOffset.Y + view.Y * _scaleFactor + invisiblesOffsetTreshold.Y); - Rectangle bounds = new Rectangle(newOffset, new Size(view.Bounds.Width * _scaleFactor, view.Bounds.Height * _scaleFactor)); - _viewsToDraw.Add(new ViewInfo { View = view, Offset = newOffset, Bounds = bounds }); + Rectangle bounds = new Rectangle(newOffset, + new Size(view.Bounds.Width * _scaleFactor, view.Bounds.Height * _scaleFactor)); + _viewsToDraw.Add(new ViewInfo {View = view, Offset = newOffset, Bounds = bounds}); if (view is ListView) { @@ -115,34 +117,34 @@ private void VisitView(View view, Point pageOffset) //add extra space for writing all listView cells into UI if (desiredHeight > listView.Bounds.Height) invisiblesOffsetTreshold.Y += (desiredHeight - listView.Bounds.Height) * _scaleFactor; - } - if (view is Layout) + if (view is Layout layout) { - foreach (var v in (view as Layout).Children) + foreach (var v in layout.Children) + { VisitView(v, newOffset); + } } - else if (view is Frame && (view as Frame).Content != null) + else if (view is Frame frame && frame.Content != null) { - VisitView((view as Frame).Content, newOffset); + VisitView(frame.Content, newOffset); } - else if (view is ContentView && (view as ContentView).Content != null) + else if (view is ContentView contentView && contentView.Content != null) { - VisitView((view as ContentView).Content, newOffset); + VisitView(contentView.Content, newOffset); } - else if (view is ScrollView && (view as ScrollView).Content != null) + else if (view is ScrollView scrollView && scrollView.Content != null) { - VisitView((view as ScrollView).Content, newOffset); + VisitView(scrollView.Content, newOffset); } } - private PdfDocument CreatePDF(List views) { - var document = new PdfDocument() { }; + var document = new PdfDocument(); - int numberOfPages = (int)Math.Ceiling(_viewsToDraw.Max(x => x.Offset.Y + x.View.HeightRequest * _scaleFactor) / _desiredPageSize.Height); + int numberOfPages = (int) Math.Ceiling(_viewsToDraw.Max(x => x.Offset.Y + x.View.HeightRequest * _scaleFactor) / _desiredPageSize.Height); for (int i = 0; i < numberOfPages; i++) { @@ -155,16 +157,14 @@ private PdfDocument CreatePDF(List views) foreach (var v in viewsInPage) { - var rList = PDFManager.Instance.Renderers.FirstOrDefault(x => x.Key == v.View.GetType()); //Draw ListView Content With Delegate - if (v is ListViewInfo) + if (v is ListViewInfo vInfo) { - var vInfo = v as ListViewInfo; - XRect desiredBounds = new XRect(v.Offset.X + _desiredPageSize.X, - v.Offset.Y + _desiredPageSize.Y - (i * _desiredPageSize.Height), - v.Bounds.Width, - v.Bounds.Height); + XRect desiredBounds = new XRect(vInfo.Offset.X + _desiredPageSize.X, + vInfo.Offset.Y + _desiredPageSize.Y - (i * _desiredPageSize.Height), + vInfo.Bounds.Width, + vInfo.Bounds.Height); switch (vInfo.ItemType) { case ListViewItemType.Cell: @@ -190,7 +190,6 @@ private PdfDocument CreatePDF(List views) renderer.CreateLayout(gfx, v.View, desiredBounds, _scaleFactor); } - } } diff --git a/PdfSharp.Xamarin.Forms/PdfManager.cs b/PdfSharp.Xamarin.Forms/PdfManager.cs index 4f992b8..b8a7ffb 100644 --- a/PdfSharp.Xamarin.Forms/PdfManager.cs +++ b/PdfSharp.Xamarin.Forms/PdfManager.cs @@ -13,6 +13,7 @@ [assembly: InternalsVisibleTo("PdfSharp.Xamarin.Forms.Droid")] [assembly: InternalsVisibleTo("PdfSharp.Xamarin.Forms.iOS")] [assembly: InternalsVisibleTo("PdfSharp.Xamarin.Forms.UWP")] +[assembly: InternalsVisibleTo("PdfSharp.Xamarin.Forms.WPF")] namespace PdfSharp.Xamarin.Forms { public class PDFManager @@ -20,8 +21,7 @@ public class PDFManager internal static PDFManager Instance { get; private set; } private PDFManager() - { - } + { } internal Dictionary Renderers { get; set; } @@ -60,31 +60,15 @@ internal static void Init(ImageSource handler, ICustomFontProvider customFontPro } } - [Obsolete("use Init(,,rendererAssemblies)")] - public static void RegisterRenderer(Type viewType, Type rendererType) - { - if (Instance == null) - throw new InvalidOperationException("You must call Init firsts"); - - if (!rendererType.GetTypeInfo().IsSubclassOf(typeof(Renderers.PdfRendererBase))) - throw new ArgumentException("Renderertype Must inherit PdfRenderdererBase"); - if (Instance.Renderers.ContainsKey(viewType)) - Instance.Renderers[viewType] = rendererType; - else - Instance.Renderers[viewType] = rendererType; - } - - public static PdfDocument GeneratePDFFromView(View view, PageOrientation orientaiton = PageOrientation.Portrait, PageSize size = PageSize.A4, bool resizeToFit = true) + public static PdfDocument GeneratePDFFromView(View view, PageOrientation orientation = PageOrientation.Portrait, PageSize size = PageSize.A4, bool resizeToFit = true) { if (Instance == null) throw new InvalidOperationException("You must call Init first"); - PdfGenerator generator = new PdfGenerator(view, orientaiton, size, resizeToFit); - var pdf = generator.Generate(); + PdfGenerator generator = new PdfGenerator(view, orientation, size, resizeToFit); - return pdf; + return generator.Generate(); } - } } diff --git a/PdfSharp.Xamarin.Forms/PdfRendererAttributes.cs b/PdfSharp.Xamarin.Forms/PdfRendererAttributes.cs index 98b57e2..cc75c55 100644 --- a/PdfSharp.Xamarin.Forms/PdfRendererAttributes.cs +++ b/PdfSharp.Xamarin.Forms/PdfRendererAttributes.cs @@ -5,28 +5,28 @@ namespace PdfSharp.Xamarin.Forms { public class PdfRendererAttributes : BindableObject { - public bool ShouldRender { - get { return (bool)GetValue(ShouldRenderProperty); } - set { SetValue(ShouldRenderProperty, value); } + get => (bool) GetValue(ShouldRenderProperty); + set => SetValue(ShouldRenderProperty, value); } public PdfListViewRendererDelegate ListRendererDelegate { - get { return (PdfListViewRendererDelegate)GetValue(ListRendererDelegateProperty); } - set { SetValue(ListRendererDelegateProperty, value); } + get => (PdfListViewRendererDelegate) GetValue(ListRendererDelegateProperty); + set => SetValue(ListRendererDelegateProperty, value); } public static readonly BindableProperty ShouldRenderProperty = BindableProperty.CreateAttached(nameof(ShouldRender), typeof(bool), typeof(PdfRendererAttributes), true); public static readonly BindableProperty ListRendererDelegateProperty = - BindableProperty.CreateAttached(nameof(ListRendererDelegate), typeof(PdfListViewRendererDelegate), typeof(PdfRendererAttributes), new PdfListViewRendererDelegate()); + BindableProperty.CreateAttached(nameof(ListRendererDelegate), typeof(PdfListViewRendererDelegate), + typeof(PdfRendererAttributes), new PdfListViewRendererDelegate()); public static bool ShouldRenderView(BindableObject bindable) { - return (bool)bindable.GetValue(ShouldRenderProperty); + return (bool) bindable.GetValue(ShouldRenderProperty); } } } diff --git a/PdfSharp.Xamarin.Forms/Renderers/PDFLabelRender.cs b/PdfSharp.Xamarin.Forms/Renderers/PDFLabelRender.cs index 62cf34b..4eab83c 100644 --- a/PdfSharp.Xamarin.Forms/Renderers/PDFLabelRender.cs +++ b/PdfSharp.Xamarin.Forms/Renderers/PDFLabelRender.cs @@ -11,18 +11,14 @@ public class PDFLabelRenderer : PdfRendererBase