Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions PdfiumViewer.Demo/PdfiumViewer.Demo.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net48;net6.0-windows</TargetFrameworks>
<TargetFrameworks>net48;net8.0-windows;net9.0-windows;net10.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyTitle>PdfViewer.Demo</AssemblyTitle>
<Company>Pieter van Ginkel</Company>
Expand Down Expand Up @@ -71,7 +71,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="bblanchon.PDFium.Win32">
<Version>122.0.6219</Version>
<Version>147.0.7713</Version>
</PackageReference>
</ItemGroup>
</Project>
8 changes: 6 additions & 2 deletions PdfiumViewer.Test/PdfiumViewer.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net40</TargetFramework>
<TargetFrameworks>net462</TargetFrameworks>
<AssemblyTitle>PdfiumViewer.Test</AssemblyTitle>
<Product>PdfiumViewer.Test</Product>
<Copyright>Copyright © 2015</Copyright>
<OutputPath>bin\$(Configuration)\</OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="2.6.4" />
<PackageReference Include="NUnit" Version="4.5.0" />
<PackageReference Include="NUnit3TestAdapter" Version="6.1.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<PackageReference Include="bblanchon.PDFium.Win32">
<Version>147.0.7713</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PdfiumViewer\PdfiumViewer.csproj" />
Expand Down
4 changes: 2 additions & 2 deletions PdfiumViewer.WPFDemo/PdfiumViewer.WPFDemo.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net48;net6.0-windows</TargetFrameworks>
<TargetFrameworks>net48;net8.0-windows;net9.0-windows;net10.0-windows</TargetFrameworks>
<AssemblyTitle>PdfiumViewer.WPFDemo</AssemblyTitle>
<Product>PdfiumViewer.WPFDemo</Product>
<UseWPF>true</UseWPF>
Expand Down Expand Up @@ -52,7 +52,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="bblanchon.PDFium.Win32">
<Version>122.0.6219</Version>
<Version>147.0.7713</Version>
</PackageReference>
</ItemGroup>
</Project>
8 changes: 4 additions & 4 deletions PdfiumViewer/CustomScrollControl.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion PdfiumViewer/IPdfDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using System.Text;

namespace PdfiumViewer
{
Expand Down Expand Up @@ -260,6 +259,7 @@ public interface IPdfDocument : IDisposable
/// <returns>The converted rectangle.</returns>
Rectangle RectangleFromPdf(int page, RectangleF rect);

/// <summary>
/// Get detailed information for all characters on the page.
/// </summary>
/// <param name="page">The page to get the information for.</param>
Expand Down
11 changes: 6 additions & 5 deletions PdfiumViewer/NativeMethods.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down Expand Up @@ -84,16 +81,20 @@ 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()
: base(true)
{
}

#if NETFRAMEWORK
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
#endif
protected override bool ReleaseHandle()
{
return CloseHandle(handle);
Expand Down
4 changes: 2 additions & 2 deletions PdfiumViewer/PdfException.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;

#pragma warning disable 1591

Expand Down Expand Up @@ -52,9 +50,11 @@ public PdfException(string message, Exception innerException)
{
}

#if NETFRAMEWORK
protected PdfException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif
}
}
8 changes: 6 additions & 2 deletions PdfiumViewer/PdfRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class PdfRenderer : PanningZoomingScrollControl
/// <summary>
/// Gets or sets the currently focused page.
/// </summary>
[DefaultValue(1)]
public int Page
{
get
Expand Down Expand Up @@ -120,6 +121,7 @@ public Rectangle GetOuterBounds(int page)
/// <summary>
/// Gets or sets the way the document should be zoomed initially.
/// </summary>
[DefaultValue(PdfViewerZoomMode.FitHeight)]
public PdfViewerZoomMode ZoomMode
{
get { return _zoomMode; }
Expand Down Expand Up @@ -147,6 +149,7 @@ public PdfViewerCursorMode CursorMode
/// <summary>
/// Gets or sets the current rotation of the PDF document.
/// </summary>
[DefaultValue(PdfRotation.Rotate0)]
public PdfRotation Rotation
{
get { return _rotation; }
Expand Down Expand Up @@ -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
Expand All @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions PdfiumViewer/PdfiumViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<OutputType>Library</OutputType>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<TargetFrameworks>net20;net45;netcoreapp3.1;net6.0-windows</TargetFrameworks>
<TargetFrameworks>net462;net8.0-windows;net9.0-windows;net10.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyTitle>PdfViewer</AssemblyTitle>
<Company>Pieter van Ginkel; Bluegrams</Company>
<Product>PdfViewer</Product>
<Description>Updated fork of PdfiumViewer, PDF viewer based on PDFium, ported to .NET Core and .NET 6.</Description>
<Description>Updated fork of PdfiumViewer, PDF viewer based on PDFium, ported to .NET.</Description>
<Copyright>Original © 2012-2015 Pieter van Ginkel</Copyright>
<Version>2.14.5.0</Version>
<Authors>Pieter van Ginkel, Bluegrams</Authors>
Expand All @@ -20,7 +20,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net20' Or '$(TargetFramework)' == 'net45'">
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
Expand Down