Skip to content

Commit b0e9419

Browse files
authored
Merge pull request #20 from SyncfusionExamples/WPF-264119_1
264119 - How to view PDF in C# winforms
2 parents 6632415 + 6b96a94 commit b0e9419

File tree

3 files changed

+59
-9
lines changed

3 files changed

+59
-9
lines changed

How-to/ViewPDFInWinforms/Form1.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace ViewPDFInWinforms
55
{
66
public partial class Form1 : Form
77
{
8+
string filePath;
89
public Form1()
910
{
1011
InitializeComponent();
@@ -17,7 +18,12 @@ public Form1()
1718
//Docking the control to all edges of its containing control and sizing appropriately.
1819
pdfViewerControl1.Dock = DockStyle.Fill;
1920
//Loading the document in the PdfViewerControl
20-
pdfViewerControl1.Load(@"../../../Data/PDF_Succinctly.pdf");
21+
#if NETCOREAPP
22+
filePath = @"../../../Data/PDF_Succinctly.pdf";
23+
#else
24+
filePath = @"../../Data/PDF_Succinctly.pdf";
25+
#endif
26+
pdfViewerControl1.Load(filePath);
2127
}
2228
}
2329
}

How-to/ViewPDFInWinforms/Program.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
52
using System.Windows.Forms;
63

74
namespace ViewPDFInWinforms

How-to/ViewPDFInWinforms/ViewPDFInWinforms.csproj

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> <PropertyGroup>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
35
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
46
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
57
<ProjectGuid>{B17764AA-7541-47A2-B1B1-B7087E473FF5}</ProjectGuid>
68
<OutputType>WinExe</OutputType>
79
<RootNamespace>ViewPDFusingPDFWinforms</RootNamespace>
810
<AssemblyName>ViewPDFusingPDFWinforms</AssemblyName>
9-
<TargetFramework>net48</TargetFramework>
11+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
1012
<FileAlignment>512</FileAlignment>
1113
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1214
<Deterministic>true</Deterministic>
13-
<LangVersion>latest</LangVersion>
14-
<UseWindowsForms>true</UseWindowsForms>
15+
<TargetFrameworkProfile />
1516
</PropertyGroup>
1617
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1718
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -33,9 +34,55 @@
3334
<WarningLevel>4</WarningLevel>
3435
</PropertyGroup>
3536
<ItemGroup>
36-
<PackageReference Include="Syncfusion.PdfViewer.Windows" version="*" />
37+
<PackageReference Include="Syncfusion.PdfViewer.Windows" version="*" />
38+
<Reference Include="PresentationCore" />
39+
<Reference Include="PresentationFramework" />
40+
<Reference Include="System" />
41+
<Reference Include="System.Core" />
42+
<Reference Include="System.Xaml" />
43+
<Reference Include="System.Xml.Linq" />
44+
<Reference Include="System.Data.DataSetExtensions" />
45+
<Reference Include="Microsoft.CSharp" />
46+
<Reference Include="System.Data" />
47+
<Reference Include="System.Deployment" />
48+
<Reference Include="System.Drawing" />
49+
<Reference Include="System.Net.Http" />
50+
<Reference Include="System.Windows.Forms" />
51+
<Reference Include="System.Xml" />
52+
<Reference Include="WindowsBase" />
53+
<Reference Include="WindowsFormsIntegration" />
54+
</ItemGroup>
55+
<ItemGroup>
56+
<Compile Include="Form1.cs">
57+
<SubType>Form</SubType>
58+
</Compile>
59+
<Compile Include="Form1.Designer.cs">
60+
<DependentUpon>Form1.cs</DependentUpon>
61+
</Compile>
62+
<Compile Include="Program.cs" />
63+
<Compile Include="Properties\AssemblyInfo.cs" />
64+
<EmbeddedResource Include="Properties\Resources.resx">
65+
<Generator>ResXFileCodeGenerator</Generator>
66+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
67+
<SubType>Designer</SubType>
68+
</EmbeddedResource>
69+
<Compile Include="Properties\Resources.Designer.cs">
70+
<AutoGen>True</AutoGen>
71+
<DependentUpon>Resources.resx</DependentUpon>
72+
<DesignTime>True</DesignTime>
73+
</Compile>
74+
<None Include="Properties\Settings.settings">
75+
<Generator>SettingsSingleFileGenerator</Generator>
76+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
77+
</None>
78+
<Compile Include="Properties\Settings.Designer.cs">
79+
<AutoGen>True</AutoGen>
80+
<DependentUpon>Settings.settings</DependentUpon>
81+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
82+
</Compile>
3783
</ItemGroup>
3884
<ItemGroup>
3985
<None Include="App.config" />
4086
</ItemGroup>
87+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
4188
</Project>

0 commit comments

Comments
 (0)