Skip to content

Commit 5c531be

Browse files
committed
Added core sample for hosting PdfViewer
1 parent f5b310f commit 5c531be

19 files changed

+60
-106
lines changed

How-to/Host-WPFPdfViewer-in-Winforms/Form1.Designer.cs renamed to How-to/Host-WPFPdfViewer-in-Winforms/HostedPdfViewer/Form1.Designer.cs

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

How-to/Host-WPFPdfViewer-in-Winforms/Form1.cs renamed to How-to/Host-WPFPdfViewer-in-Winforms/HostedPdfViewer/Form1.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using System.Windows.Forms;
1010
using System.Windows.Forms.Integration;
1111

12-
namespace Host_WPFPdfViewer_in_Winforms
12+
namespace HostedPdfViewer
1313
{
1414
public partial class Form1 : Form
1515
{

How-to/Host-WPFPdfViewer-in-Winforms/Host-WPFPdfViewer-in-Winforms.csproj renamed to How-to/Host-WPFPdfViewer-in-Winforms/HostedPdfViewer/HostedPdfViewer.csproj

+3-7
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
77
<ProjectGuid>{6C45B582-45B9-4371-A4CC-628F288E2107}</ProjectGuid>
88
<OutputType>WinExe</OutputType>
9-
<RootNamespace>Host_WPFPdfViewer_in_Winforms</RootNamespace>
10-
<AssemblyName>Host-WPFPdfViewer-in-Winforms</AssemblyName>
9+
<RootNamespace>HostedPdfViewer</RootNamespace>
10+
<AssemblyName>HostedPdfViewer</AssemblyName>
1111
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
1212
<FileAlignment>512</FileAlignment>
1313
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
@@ -34,9 +34,7 @@
3434
<ErrorReport>prompt</ErrorReport>
3535
<WarningLevel>4</WarningLevel>
3636
</PropertyGroup>
37-
<PropertyGroup>
38-
<ApplicationManifest>app.manifest</ApplicationManifest>
39-
</PropertyGroup>
37+
<PropertyGroup />
4038
<ItemGroup>
4139
<Reference Include="PresentationCore" />
4240
<Reference Include="PresentationFramework" />
@@ -80,7 +78,6 @@
8078
<AutoGen>True</AutoGen>
8179
<DependentUpon>Resources.resx</DependentUpon>
8280
</Compile>
83-
<None Include="app.manifest" />
8481
<None Include="packages.config" />
8582
<None Include="Properties\Settings.settings">
8683
<Generator>SettingsSingleFileGenerator</Generator>
@@ -102,5 +99,4 @@
10299
</Page>
103100
</ItemGroup>
104101
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
105-
106102
</Project>

How-to/Host-WPFPdfViewer-in-Winforms/Host-WPFPdfViewer-in-Winforms.sln renamed to How-to/Host-WPFPdfViewer-in-Winforms/HostedPdfViewer/HostedPdfViewer.sln

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.12.35527.113 d17.12
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Host-WPFPdfViewer-in-Winforms", "Host-WPFPdfViewer-in-Winforms.csproj", "{6C45B582-45B9-4371-A4CC-628F288E2107}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HostedPdfViewer", "HostedPdfViewer.csproj", "{6C45B582-45B9-4371-A4CC-628F288E2107}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>net8.0-windows</TargetFramework>
6+
<Nullable>enable</Nullable>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<UseWPF>True</UseWPF>
9+
<UseWindowsForms>True</UseWindowsForms>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="Syncfusion.PdfViewer.WPF" Version="*" />
14+
</ItemGroup>
15+
16+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35527.113 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HostedPdfViewer_NET", "HostedPdfViewer_NET.csproj", "{6C45B582-45B9-4371-A4CC-628F288E2107}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{6C45B582-45B9-4371-A4CC-628F288E2107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{6C45B582-45B9-4371-A4CC-628F288E2107}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{6C45B582-45B9-4371-A4CC-628F288E2107}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{6C45B582-45B9-4371-A4CC-628F288E2107}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal

How-to/Host-WPFPdfViewer-in-Winforms/Program.cs renamed to How-to/Host-WPFPdfViewer-in-Winforms/HostedPdfViewer/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Threading.Tasks;
55
using System.Windows.Forms;
66

7-
namespace Host_WPFPdfViewer_in_Winforms
7+
namespace HostedPdfViewer
88
{
99
internal static class Program
1010
{

How-to/Host-WPFPdfViewer-in-Winforms/Properties/AssemblyInfo.cs renamed to How-to/Host-WPFPdfViewer-in-Winforms/HostedPdfViewer/Properties/AssemblyInfo.cs

-6
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
// General Information about an assembly is controlled through the following
66
// set of attributes. Change these attribute values to modify the information
77
// associated with an assembly.
8-
[assembly: AssemblyTitle("Host-WPFPdfViewer-in-Winforms")]
98
[assembly: AssemblyDescription("")]
10-
[assembly: AssemblyConfiguration("")]
11-
[assembly: AssemblyCompany("")]
12-
[assembly: AssemblyProduct("Host-WPFPdfViewer-in-Winforms")]
139
[assembly: AssemblyCopyright("Copyright © 2025")]
1410
[assembly: AssemblyTrademark("")]
1511
[assembly: AssemblyCulture("")]
@@ -29,5 +25,3 @@
2925
// Build Number
3026
// Revision
3127
//
32-
[assembly: AssemblyVersion("1.0.0.0")]
33-
[assembly: AssemblyFileVersion("1.0.0.0")]

How-to/Host-WPFPdfViewer-in-Winforms/Properties/Resources.Designer.cs renamed to How-to/Host-WPFPdfViewer-in-Winforms/HostedPdfViewer/Properties/Resources.Designer.cs

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

How-to/Host-WPFPdfViewer-in-Winforms/Properties/Settings.Designer.cs renamed to How-to/Host-WPFPdfViewer-in-Winforms/HostedPdfViewer/Properties/Settings.Designer.cs

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

How-to/Host-WPFPdfViewer-in-Winforms/WPFPdfViewer.xaml renamed to How-to/Host-WPFPdfViewer-in-Winforms/HostedPdfViewer/WPFPdfViewer.xaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6-
xmlns:local="clr-namespace:Host_WPFPdfViewer_in_Winforms"
7-
xmlns:PdfViewer="clr-namespace:Syncfusion.Windows.PdfViewer;assembly=Syncfusion.PdfViewer.WPF" x:Class="Host_WPFPdfViewer_in_Winforms.WPFPdfViewer"
6+
xmlns:local="clr-namespace:HostedPdfViewer"
7+
xmlns:PdfViewer="clr-namespace:Syncfusion.Windows.PdfViewer;assembly=Syncfusion.PdfViewer.WPF" x:Class="HostedPdfViewer.WPFPdfViewer"
88
mc:Ignorable="d"
99
d:DesignHeight="450" d:DesignWidth="800" Loaded="UserControl_Loaded">
1010
<Grid>

How-to/Host-WPFPdfViewer-in-Winforms/WPFPdfViewer.xaml.cs renamed to How-to/Host-WPFPdfViewer-in-Winforms/HostedPdfViewer/WPFPdfViewer.xaml.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
using System.Windows.Media.Imaging;
1313
using System.Windows.Navigation;
1414
using System.Windows.Shapes;
15+
using UserControl = System.Windows.Controls.UserControl;
1516

16-
namespace Host_WPFPdfViewer_in_Winforms
17+
namespace HostedPdfViewer
1718
{
1819
/// <summary>
1920
/// Interaction logic for WPFPdfViewer.xaml
@@ -34,7 +35,11 @@ public WPFPdfViewer()
3435
private void UserControl_Loaded(object sender, RoutedEventArgs e)
3536
{
3637
//Load a PDF file in the PDF viewer
38+
#if !NETCOREAPP
3739
filePath = "../../Data/F#.pdf";
40+
#else
41+
filePath = "../../../Data/F#.pdf";
42+
#endif
3843
pdfViewer.Load(filePath);
3944
}
4045
}

How-to/Host-WPFPdfViewer-in-Winforms/app.manifest

-79
This file was deleted.

0 commit comments

Comments
 (0)