Skip to content

Updated WPF-PDFViewer-Examples #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 23, 2024
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 4 additions & 18 deletions Annotations/AddAnnotation/AddAnnotation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>WpfPDFViewer</RootNamespace>
<AssemblyName>WpfPDFViewer</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
Expand All @@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>DEBUG;TRACE;NETFRAMEWORK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
Expand All @@ -31,26 +31,12 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;NETFRAMEWORK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Syncfusion.Compression.Base, Version=20.3460.0.47, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.Compression.Base.20.3.0.47\lib\net46\Syncfusion.Compression.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Licensing, Version=20.3460.0.47, Culture=neutral, PublicKeyToken=632609b4d040f6b4, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.Licensing.20.3.0.47\lib\net46\Syncfusion.Licensing.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Pdf.Base, Version=20.3460.0.47, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.Pdf.Wpf.20.3.0.47\lib\net46\Syncfusion.Pdf.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.PdfViewer.WPF, Version=20.3460.0.47, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.PdfViewer.WPF.20.3.0.47\lib\net46\Syncfusion.PdfViewer.WPF.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Shared.WPF, Version=20.3460.0.47, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.Shared.WPF.20.3.0.47\lib\net46\Syncfusion.Shared.WPF.dll</HintPath>
</Reference>
<packageReference Include="Syncfusion.PdfViewer.WPF" version="*"/>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
Expand Down
18 changes: 18 additions & 0 deletions Annotations/AddAnnotation/AddAnnotation_NET.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.PdfViewer.WPF" Version="*" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions Annotations/AddAnnotation/AddAnnotation_NET.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.226.21692
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddAnnotation_NET", "AddAnnotation_NET.csproj", "{E79D712B-0966-4E56-989F-B6A78BE3A022}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E79D712B-0966-4E56-989F-B6A78BE3A022}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E79D712B-0966-4E56-989F-B6A78BE3A022}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E79D712B-0966-4E56-989F-B6A78BE3A022}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E79D712B-0966-4E56-989F-B6A78BE3A022}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {66FBE309-FC8F-4FE0-A34F-85576BA23799}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion Annotations/AddAnnotation/App.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime>

Expand Down
6 changes: 5 additions & 1 deletion Annotations/AddAnnotation/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ public MainWindow()
{
InitializeComponent();
//Loads the document in PDF Viewer
pdfViewer.Load("../../F Sharp Succinctly.pdf");
#if NETFRAMEWORK
pdfViewer.Load("../../Data/F#.pdf");
#else
pdfViewer.Load("../../../Data/F#.pdf");
#endif
}

private void Add_Ink_Click(object sender, RoutedEventArgs e)
Expand Down
5 changes: 2 additions & 3 deletions Annotations/AddAnnotation/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WpfPDFViewer")]

[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
Expand Down Expand Up @@ -51,5 +51,4 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

7 changes: 2 additions & 5 deletions Annotations/AddAnnotation/packages.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Syncfusion.Compression.Base" version="20.3.0.47" targetFramework="net472" />
<package id="Syncfusion.Licensing" version="20.3.0.47" targetFramework="net472" />
<package id="Syncfusion.Pdf.Wpf" version="20.3.0.47" targetFramework="net472" />
<package id="Syncfusion.PdfViewer.WPF" version="20.3.0.47" targetFramework="net472" />
<package id="Syncfusion.Shared.WPF" version="20.3.0.47" targetFramework="net472" />

<package id="Syncfusion.PdfViewer.WPF" version="*" targetFramework="net48" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@
<OutputType>WinExe</OutputType>
<RootNamespace>AddCustomStampInCustomizedButton</RootNamespace>
<AssemblyName>AddCustomStampInCustomizedButton</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>DEBUG;TRACE;NETFRAMEWORK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
Expand All @@ -32,29 +33,12 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;NETFRAMEWORK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Syncfusion.Compression.Base, Version=25.1462.35.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.Compression.Base.25.1.35\lib\net462\Syncfusion.Compression.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Licensing, Version=25.1462.35.0, Culture=neutral, PublicKeyToken=632609b4d040f6b4, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.Licensing.25.1.35\lib\net462\Syncfusion.Licensing.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Pdf.Base, Version=25.1462.35.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.Pdf.Wpf.25.1.35\lib\net462\Syncfusion.Pdf.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.PdfToImageConverter.Base, Version=25.1462.35.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.PdfToImageConverter.WPF.25.1.35\lib\net462\Syncfusion.PdfToImageConverter.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.PdfViewer.WPF, Version=25.1462.35.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.PdfViewer.WPF.25.1.35\lib\net462\Syncfusion.PdfViewer.WPF.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Shared.WPF, Version=25.1462.35.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.Shared.WPF.25.1.35\lib\net462\Syncfusion.Shared.WPF.dll</HintPath>
</Reference>
<packageReference Include="Syncfusion.PdfViewer.WPF" version="*" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
Expand All @@ -65,7 +49,7 @@
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
<RequiredTargetFramework>4.8</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
Expand Down Expand Up @@ -121,11 +105,8 @@
<Resource Include="Data\ThankYou.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="packages\Syncfusion.PdfToImageConverter.WPF.25.1.35\build\net462\Syncfusion.PdfToImageConverter.WPF.targets" Condition="Exists('packages\Syncfusion.PdfToImageConverter.WPF.25.1.35\build\net462\Syncfusion.PdfToImageConverter.WPF.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>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}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\Syncfusion.PdfToImageConverter.WPF.25.1.35\build\net462\Syncfusion.PdfToImageConverter.WPF.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Syncfusion.PdfToImageConverter.WPF.25.1.35\build\net462\Syncfusion.PdfToImageConverter.WPF.targets'))" />
</Target>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyFileversionAttibute>false</GenerateAssemblyFileversionAttibute>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.PdfViewer.WPF" Version="*" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.226.21692
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddCustomStampInCustomizedButton_NET", "AddCustomStampInCustomizedButton_NET.csproj", "{E79D712B-0966-4E56-989F-B6A78BE3A022}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E79D712B-0966-4E56-989F-B6A78BE3A022}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E79D712B-0966-4E56-989F-B6A78BE3A022}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E79D712B-0966-4E56-989F-B6A78BE3A022}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E79D712B-0966-4E56-989F-B6A78BE3A022}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {66FBE309-FC8F-4FE0-A34F-85576BA23799}
EndGlobalSection
EndGlobal
6 changes: 3 additions & 3 deletions Annotations/AddCustomStampInCustomizedButton/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>
</configuration>
11 changes: 10 additions & 1 deletion Annotations/AddCustomStampInCustomizedButton/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ public partial class MainWindow : Window
public MainWindow()
{
InitializeComponent();
#if NETFRAMEWORK
pdfViewer.Load("../../Data/F#.pdf");
#else
pdfViewer.Load("../../../Data/F#.pdf");
#endif
pdfViewer.PageClicked += PdfViewer_PageClicked;
}

Expand All @@ -49,7 +53,12 @@ private void PdfViewer_PageClicked(object sender, Syncfusion.Windows.PdfViewer.P

Point position = new Point(x, y);
pdfViewer.AnnotationMode = PdfDocumentView.PdfViewerAnnotationMode.None;
var bitmapImage = new BitmapImage(new Uri("../../Data/ThankYou.png", UriKind.RelativeOrAbsolute));
var bitmapImage = new BitmapImage();
#if NETFRAMEWORK
bitmapImage = new BitmapImage(new Uri("../../Data/ThankYou.png", UriKind.RelativeOrAbsolute));
#else
bitmapImage = new BitmapImage(new Uri("../../../Data/ThankYou.png", UriKind.RelativeOrAbsolute));
#endif
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
var image = new System.Windows.Controls.Image() { Source = bitmapImage };
var pdfStamp = new PdfStampAnnotation(image);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,7 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AddCustomStampInCustomizedButton")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AddCustomStampInCustomizedButton")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]


// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
Expand Down Expand Up @@ -51,5 +44,4 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Loading
Loading