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 1 commit
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: 6 additions & 16 deletions Annotations/AddAnnotation/AddAnnotation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@ -36,21 +36,11 @@
<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.Compression.Base" version="*"/>
<packageReference Include="Syncfusion.Licensing" version="*"/>
<packageReference Include="Syncfusion.Pdf.Base" version="*"/>
<packageReference Include="Syncfusion.PdfViewer.WPF" version="*"/>
<packageReference Include="Syncfusion.Shared.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.10.35122.118
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
Binary file removed Annotations/AddAnnotation/F Sharp Succinctly.pdf
Binary file not shown.
7 changes: 6 additions & 1 deletion Annotations/AddAnnotation/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this namespace is added

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed newly added namespace is completed

using System.Windows;

namespace WpfPDFViewer
Expand All @@ -17,7 +18,11 @@ public MainWindow()
{
InitializeComponent();
//Loads the document in PDF Viewer
pdfViewer.Load("../../F Sharp Succinctly.pdf");
#if NETFRAMEWORK
pdfViewer.Load("../../Data/F Sharp Succinctly.pdf");
#else
pdfViewer.Load("../../../Data/F Sharp Succinctly.pdf");
#endif
}

private void Add_Ink_Click(object sender, RoutedEventArgs e)
Expand Down
12 changes: 2 additions & 10 deletions Annotations/AddAnnotation/Properties/AssemblyInfo.cs
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("WpfPDFViewer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WpfPDFViewer")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the details for the output generated assembly. Why we are removing this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assembly throw duplicate assembly error so removed this assembly.

[assembly: AssemblyCopyright("Copyright © 2021")]
[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")]

10 changes: 5 additions & 5 deletions Annotations/AddAnnotation/packages.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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.Compression.Base" version="*" targetFramework="net472" />
<package id="Syncfusion.Licensing" version="*" targetFramework="net472" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the target framework to 4.8. Do this for all the package config files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check version 4.8 all project is completed

<package id="Syncfusion.Pdf.Wpf" version="*" targetFramework="net472" />
<package id="Syncfusion.PdfViewer.WPF" version="*" targetFramework="net472" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the reference for the pdfToImageConverter

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Syncfusion.PdfViewer.Wpf single reference sample is working so removed another reference

<package id="Syncfusion.Shared.WPF" version="*" targetFramework="net472" />
</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 @@ -37,24 +38,12 @@
<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.Compression.Base" version="*" />
<packageReference Include="Syncfusion.Licensing" version="*" />
<packageReference Include="Syncfusion.Pdf.Base" version="*" />
<packageReference Include="Syncfusion.PdfToImageConverter.Base" version="*" />
<packageReference Include="Syncfusion.PdfViewer.WPF" version="*" />
<packageReference Include="Syncfusion.Shared.WPF" version="*" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
Expand All @@ -65,7 +54,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 @@ -124,8 +113,6 @@
<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.10.35122.118
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>
13 changes: 12 additions & 1 deletion Annotations/AddCustomStampInCustomizedButton/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
using Syncfusion.Windows.PdfViewer;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
Expand All @@ -26,7 +28,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 +55,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