diff --git a/PdfiumViewer.Demo/PdfiumViewer.Demo.csproj b/PdfiumViewer.Demo/PdfiumViewer.Demo.csproj
index 18a28121..ebf7361b 100644
--- a/PdfiumViewer.Demo/PdfiumViewer.Demo.csproj
+++ b/PdfiumViewer.Demo/PdfiumViewer.Demo.csproj
@@ -1,7 +1,7 @@
WinExe
- net48;net6.0-windows
+ net48;net8.0-windows;net9.0-windows;net10.0-windows
true
PdfViewer.Demo
Pieter van Ginkel
@@ -71,7 +71,7 @@
- 122.0.6219
+ 147.0.7713
\ No newline at end of file
diff --git a/PdfiumViewer.Test/PdfiumViewer.Test.csproj b/PdfiumViewer.Test/PdfiumViewer.Test.csproj
index 26a0e99d..215a497c 100644
--- a/PdfiumViewer.Test/PdfiumViewer.Test.csproj
+++ b/PdfiumViewer.Test/PdfiumViewer.Test.csproj
@@ -1,17 +1,21 @@
- net40
+ net462
PdfiumViewer.Test
PdfiumViewer.Test
Copyright © 2015
bin\$(Configuration)\
-
+
+
+
+ 147.0.7713
+
diff --git a/PdfiumViewer.WPFDemo/PdfiumViewer.WPFDemo.csproj b/PdfiumViewer.WPFDemo/PdfiumViewer.WPFDemo.csproj
index 9af85ab6..c3b3f93a 100644
--- a/PdfiumViewer.WPFDemo/PdfiumViewer.WPFDemo.csproj
+++ b/PdfiumViewer.WPFDemo/PdfiumViewer.WPFDemo.csproj
@@ -1,7 +1,7 @@
WinExe
- net48;net6.0-windows
+ net48;net8.0-windows;net9.0-windows;net10.0-windows
PdfiumViewer.WPFDemo
PdfiumViewer.WPFDemo
true
@@ -52,7 +52,7 @@
- 122.0.6219
+ 147.0.7713
\ No newline at end of file
diff --git a/PdfiumViewer/CustomScrollControl.cs b/PdfiumViewer/CustomScrollControl.cs
index 21642a6e..2a0a9d05 100644
--- a/PdfiumViewer/CustomScrollControl.cs
+++ b/PdfiumViewer/CustomScrollControl.cs
@@ -1,10 +1,8 @@
using System;
-using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Security.Permissions;
-using System.Text;
using System.Windows.Forms;
#pragma warning disable 1591
@@ -349,8 +347,8 @@ private bool SetDisplayRectangleSize(int width, int height)
{
bool needLayout = false;
- double hScale = _displayRect.Height==0 ? 1 :(double)width / _displayRect.Width;
- double vScale = _displayRect.Height==0? 1 : (double)height / _displayRect.Height;
+ double hScale = _displayRect.Height == 0 ? 1 : (double)width / _displayRect.Width;
+ double vScale = _displayRect.Height == 0 ? 1 : (double)height / _displayRect.Height;
if (_displayRect.Width != width || _displayRect.Height != height)
{
@@ -625,7 +623,9 @@ private void WmOnScroll(ref System.Windows.Forms.Message m, int oldValue, int va
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
+#if NETFRAMEWORK
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+#endif
protected override void WndProc(ref System.Windows.Forms.Message m)
{
switch (m.Msg)
diff --git a/PdfiumViewer/IPdfDocument.cs b/PdfiumViewer/IPdfDocument.cs
index c5544211..b57a2e6c 100644
--- a/PdfiumViewer/IPdfDocument.cs
+++ b/PdfiumViewer/IPdfDocument.cs
@@ -3,7 +3,6 @@
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
-using System.Text;
namespace PdfiumViewer
{
@@ -260,6 +259,7 @@ public interface IPdfDocument : IDisposable
/// The converted rectangle.
Rectangle RectangleFromPdf(int page, RectangleF rect);
+ ///
/// Get detailed information for all characters on the page.
///
/// The page to get the information for.
diff --git a/PdfiumViewer/NativeMethods.cs b/PdfiumViewer/NativeMethods.cs
index e4c5ca1c..d4f01373 100644
--- a/PdfiumViewer/NativeMethods.cs
+++ b/PdfiumViewer/NativeMethods.cs
@@ -1,13 +1,10 @@
-using System;
-using System.Collections.Generic;
+using Microsoft.Win32.SafeHandles;
+using System;
using System.Drawing;
using System.IO;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Security.Permissions;
-using System.Text;
-using System.Windows.Forms;
-using Microsoft.Win32.SafeHandles;
namespace PdfiumViewer
{
@@ -84,8 +81,10 @@ public enum FileMapAccess : uint
[DllImport("user32.dll")]
public static extern int ScrollWindowEx(IntPtr hWnd, int dx, int dy, IntPtr prcScroll, IntPtr prcClip, IntPtr hrgnUpdate, IntPtr prcUpdate, uint flags);
+#if NETFRAMEWORK
[SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode = true)]
[SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)]
+#endif
public class MemoryMappedHandle : SafeHandleZeroOrMinusOneIsInvalid
{
public MemoryMappedHandle()
@@ -93,7 +92,9 @@ public MemoryMappedHandle()
{
}
+#if NETFRAMEWORK
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+#endif
protected override bool ReleaseHandle()
{
return CloseHandle(handle);
diff --git a/PdfiumViewer/PdfException.cs b/PdfiumViewer/PdfException.cs
index 49244236..815107e6 100644
--- a/PdfiumViewer/PdfException.cs
+++ b/PdfiumViewer/PdfException.cs
@@ -1,7 +1,5 @@
using System;
-using System.Collections.Generic;
using System.Runtime.Serialization;
-using System.Text;
#pragma warning disable 1591
@@ -52,9 +50,11 @@ public PdfException(string message, Exception innerException)
{
}
+#if NETFRAMEWORK
protected PdfException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
+#endif
}
}
diff --git a/PdfiumViewer/PdfRenderer.cs b/PdfiumViewer/PdfRenderer.cs
index 8d12dec0..b4ca6452 100644
--- a/PdfiumViewer/PdfRenderer.cs
+++ b/PdfiumViewer/PdfRenderer.cs
@@ -61,6 +61,7 @@ public class PdfRenderer : PanningZoomingScrollControl
///
/// Gets or sets the currently focused page.
///
+ [DefaultValue(1)]
public int Page
{
get
@@ -120,6 +121,7 @@ public Rectangle GetOuterBounds(int page)
///
/// Gets or sets the way the document should be zoomed initially.
///
+ [DefaultValue(PdfViewerZoomMode.FitHeight)]
public PdfViewerZoomMode ZoomMode
{
get { return _zoomMode; }
@@ -147,6 +149,7 @@ public PdfViewerCursorMode CursorMode
///
/// Gets or sets the current rotation of the PDF document.
///
+ [DefaultValue(PdfRotation.Rotate0)]
public PdfRotation Rotation
{
get { return _rotation; }
@@ -843,7 +846,7 @@ protected override Rectangle GetDocumentBounds()
int height = (int)(scaledHeight + (ShadeBorder.Size.Vertical + PageMargin.Vertical) * Document.PageCount);
int width = (int)(_maxWidth * _scaleFactor + ShadeBorder.Size.Horizontal + PageMargin.Horizontal);
-
+
var center = new Point(
DisplayRectangle.Width / 2,
DisplayRectangle.Height / 2
@@ -852,7 +855,8 @@ protected override Rectangle GetDocumentBounds()
if (
DisplayRectangle.Width > ClientSize.Width ||
DisplayRectangle.Height > ClientSize.Height
- ) {
+ )
+ {
center.X += DisplayRectangle.Left;
center.Y += DisplayRectangle.Top;
}
diff --git a/PdfiumViewer/PdfiumViewer.csproj b/PdfiumViewer/PdfiumViewer.csproj
index 476b750b..68d96977 100644
--- a/PdfiumViewer/PdfiumViewer.csproj
+++ b/PdfiumViewer/PdfiumViewer.csproj
@@ -3,12 +3,12 @@
Library
Release
x86
- net20;net45;netcoreapp3.1;net6.0-windows
+ net462;net8.0-windows;net9.0-windows;net10.0-windows
true
PdfViewer
Pieter van Ginkel; Bluegrams
PdfViewer
- Updated fork of PdfiumViewer, PDF viewer based on PDFium, ported to .NET Core and .NET 6.
+ Updated fork of PdfiumViewer, PDF viewer based on PDFium, ported to .NET.
Original © 2012-2015 Pieter van Ginkel
2.14.5.0
Pieter van Ginkel, Bluegrams
@@ -20,7 +20,7 @@
true
Key.snk
-
+