Skip to content

Commit 1277428

Browse files
authored
Merge pull request #44 from SyncfusionExamples/559099
559099 -Update the code sample in "Programmatically navigate to a bookmark destination" and publish a sample
2 parents 8aba7af + 7e39133 commit 1277428

30 files changed

+1078
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
5+
</startup>
6+
</configuration>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="Bookmark_Navigation.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:Bookmark_Navigation"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace Bookmark_Navigation
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<?xml version="1.0" encoding="utf-8"?>
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>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{513EB8C8-8B4F-4D5D-AEE2-80AC82FF4F32}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>Bookmark_Navigation</RootNamespace>
10+
<AssemblyName>Bookmark_Navigation</AssemblyName>
11+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<WarningLevel>4</WarningLevel>
15+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
16+
<Deterministic>true</Deterministic>
17+
<NuGetPackageImportStamp>
18+
</NuGetPackageImportStamp>
19+
<TargetFrameworkProfile />
20+
</PropertyGroup>
21+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
22+
<PlatformTarget>AnyCPU</PlatformTarget>
23+
<DebugSymbols>true</DebugSymbols>
24+
<DebugType>full</DebugType>
25+
<Optimize>false</Optimize>
26+
<OutputPath>bin\Debug\</OutputPath>
27+
<DefineConstants>DEBUG;TRACE;NETFRAMEWORK</DefineConstants>
28+
<ErrorReport>prompt</ErrorReport>
29+
<WarningLevel>4</WarningLevel>
30+
</PropertyGroup>
31+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
32+
<PlatformTarget>AnyCPU</PlatformTarget>
33+
<DebugType>pdbonly</DebugType>
34+
<Optimize>true</Optimize>
35+
<OutputPath>bin\Release\</OutputPath>
36+
<DefineConstants>TRACE;NETFRAMEWORK</DefineConstants>
37+
<ErrorReport>prompt</ErrorReport>
38+
<WarningLevel>4</WarningLevel>
39+
</PropertyGroup>
40+
<ItemGroup>
41+
<packageReference Include="Syncfusion.PdfViewer.WPF" version="*" />
42+
<Reference Include="System" />
43+
<Reference Include="System.Data" />
44+
<Reference Include="System.Xml" />
45+
<Reference Include="Microsoft.CSharp" />
46+
<Reference Include="System.Core" />
47+
<Reference Include="System.Xml.Linq" />
48+
<Reference Include="System.Data.DataSetExtensions" />
49+
<Reference Include="System.Net.Http" />
50+
<Reference Include="System.Xaml">
51+
<RequiredTargetFramework>4.0</RequiredTargetFramework>
52+
</Reference>
53+
<Reference Include="WindowsBase" />
54+
<Reference Include="PresentationCore" />
55+
<Reference Include="PresentationFramework" />
56+
</ItemGroup>
57+
<ItemGroup>
58+
<ApplicationDefinition Include="App.xaml">
59+
<Generator>MSBuild:Compile</Generator>
60+
<SubType>Designer</SubType>
61+
</ApplicationDefinition>
62+
<Page Include="MainWindow.xaml">
63+
<Generator>MSBuild:Compile</Generator>
64+
<SubType>Designer</SubType>
65+
</Page>
66+
<Compile Include="App.xaml.cs">
67+
<DependentUpon>App.xaml</DependentUpon>
68+
<SubType>Code</SubType>
69+
</Compile>
70+
<Compile Include="MainWindow.xaml.cs">
71+
<DependentUpon>MainWindow.xaml</DependentUpon>
72+
<SubType>Code</SubType>
73+
</Compile>
74+
</ItemGroup>
75+
<ItemGroup>
76+
<Compile Include="Properties\AssemblyInfo.cs">
77+
<SubType>Code</SubType>
78+
</Compile>
79+
<Compile Include="Properties\Resources.Designer.cs">
80+
<AutoGen>True</AutoGen>
81+
<DesignTime>True</DesignTime>
82+
<DependentUpon>Resources.resx</DependentUpon>
83+
</Compile>
84+
<Compile Include="Properties\Settings.Designer.cs">
85+
<AutoGen>True</AutoGen>
86+
<DependentUpon>Settings.settings</DependentUpon>
87+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
88+
</Compile>
89+
<EmbeddedResource Include="Properties\Resources.resx">
90+
<Generator>ResXFileCodeGenerator</Generator>
91+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
92+
</EmbeddedResource>
93+
<None Include="packages.config" />
94+
<None Include="Properties\Settings.settings">
95+
<Generator>SettingsSingleFileGenerator</Generator>
96+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
97+
</None>
98+
</ItemGroup>
99+
<ItemGroup>
100+
<None Include="App.config" />
101+
</ItemGroup>
102+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
103+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
104+
<PropertyGroup>
105+
</PropertyGroup>
106+
</Target>
107+
</Project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.8.34309.116
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bookmark_Navigation", "Bookmark_Navigation.csproj", "{513EB8C8-8B4F-4D5D-AEE2-80AC82FF4F32}"
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+
{513EB8C8-8B4F-4D5D-AEE2-80AC82FF4F32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{513EB8C8-8B4F-4D5D-AEE2-80AC82FF4F32}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{513EB8C8-8B4F-4D5D-AEE2-80AC82FF4F32}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{513EB8C8-8B4F-4D5D-AEE2-80AC82FF4F32}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {D3D60C40-00A0-4936-823E-EC6249565949}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.PdfViewer.WPF" Version="*" />
13+
</ItemGroup>
14+
15+
</Project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.8.226.21692
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bookmark_Navigation_NET", "Bookmark_Navigation_NET.csproj", "{E79D712B-0966-4E56-989F-B6A78BE3A022}"
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+
{E79D712B-0966-4E56-989F-B6A78BE3A022}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{E79D712B-0966-4E56-989F-B6A78BE3A022}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{E79D712B-0966-4E56-989F-B6A78BE3A022}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{E79D712B-0966-4E56-989F-B6A78BE3A022}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {66FBE309-FC8F-4FE0-A34F-85576BA23799}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Window
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:Bookmark_Navigation"
7+
xmlns:PdfViewer="clr-namespace:Syncfusion.Windows.PdfViewer;assembly=Syncfusion.PdfViewer.WPF" x:Class="Bookmark_Navigation.MainWindow"
8+
mc:Ignorable="d"
9+
Title="MainWindow" WindowState="Maximized" Height="450" Width="800">
10+
<Grid>
11+
12+
<PdfViewer:PdfViewerControl Name="pdfViewer"/>
13+
14+
</Grid>
15+
</Window>
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
using Syncfusion.Pdf.Interactive;
2+
using Syncfusion.Pdf.Parsing;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
using System.Windows;
9+
using System.Windows.Controls;
10+
using System.Windows.Data;
11+
using System.Windows.Documents;
12+
using System.Windows.Input;
13+
using System.Windows.Media;
14+
using System.Windows.Media.Imaging;
15+
using System.Windows.Navigation;
16+
17+
namespace Bookmark_Navigation
18+
{
19+
/// <summary>
20+
/// Interaction logic for MainWindow.xaml
21+
/// </summary>
22+
public partial class MainWindow : Window
23+
{
24+
public MainWindow()
25+
{
26+
InitializeComponent();
27+
this.WindowState = WindowState.Maximized;
28+
//Wire the DocumentLoaded event of PDF Viewer
29+
pdfViewer.DocumentLoaded += PdfViewer_DocumentLoaded;
30+
31+
//Loads the PDF document
32+
#if NETFRAMEWORK
33+
pdfViewer.Load("../../../Data/PDF_Succinctly.pdf");
34+
#else
35+
pdfViewer.Load("../../../../Data/PDF_Succinctly.pdf");
36+
#endif
37+
38+
39+
}
40+
private void PdfViewer_DocumentLoaded(object sender, System.EventArgs args)
41+
{
42+
//navigate to the desired bookmark destination
43+
GoToBookmark();
44+
//navigate to the child bookmarks
45+
// GoToChildBookmark();
46+
}
47+
private void GoToBookmark()
48+
{
49+
//Get the loadedDocument object from PDF Viewer
50+
PdfLoadedDocument pdfLoadedDocument = pdfViewer.LoadedDocument;
51+
//Get the complete bookmarks in the PDF.
52+
PdfBookmarkBase bookmarks = pdfLoadedDocument.Bookmarks;
53+
//In this example, we get the first bookmark in the PDF bookmarks collection at the index of 0.
54+
PdfBookmark firstBookmark = bookmarks[0];
55+
56+
//Navigates to the first bookmark present in the PDF.
57+
pdfViewer.GoToBookmark(firstBookmark);
58+
}
59+
private void GoToChildBookmark()
60+
{
61+
//Get the loadedDocument object from PDF Viewer
62+
PdfLoadedDocument pdfLoadedDocument = pdfViewer.LoadedDocument;
63+
//Get the complete bookmarks in the PDF.
64+
PdfBookmarkBase bookmarks = pdfLoadedDocument.Bookmarks;
65+
//Gets the fourth bookmark in the PDF bookmarks collection at the index of 3.
66+
PdfBookmark fourthBookmark = bookmarks[3];
67+
//Check whether it has child bookmarks.
68+
if (fourthBookmark.Count > 0)
69+
{
70+
//Navigates to the first child of the fourth bookmark in the PDF.
71+
pdfViewer.GoToBookmark(bookmarks[3][0]);
72+
}
73+
}
74+
}
75+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System.Reflection;
2+
using System.Resources;
3+
using System.Runtime.CompilerServices;
4+
using System.Runtime.InteropServices;
5+
using System.Windows;
6+
7+
// General Information about an assembly is controlled through the following
8+
// set of attributes. Change these attribute values to modify the information
9+
// associated with an assembly.
10+
11+
12+
// Setting ComVisible to false makes the types in this assembly not visible
13+
// to COM components. If you need to access a type in this assembly from
14+
// COM, set the ComVisible attribute to true on that type.
15+
[assembly: ComVisible(false)]
16+
17+
//In order to begin building localizable applications, set
18+
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
19+
//inside a <PropertyGroup>. For example, if you are using US english
20+
//in your source files, set the <UICulture> to en-US. Then uncomment
21+
//the NeutralResourceLanguage attribute below. Update the "en-US" in
22+
//the line below to match the UICulture setting in the project file.
23+
24+
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
25+
26+
27+
[assembly: ThemeInfo(
28+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
29+
//(used if a resource is not found in the page,
30+
// or application resource dictionaries)
31+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
32+
//(used if a resource is not found in the page,
33+
// app, or any theme specific resource dictionaries)
34+
)]
35+
36+
37+
// Version information for an assembly consists of the following four values:
38+
//
39+
// Major Version
40+
// Minor Version
41+
// Build Number
42+
// Revision
43+
//
44+
// You can specify all the values or you can default the Build and Revision Numbers
45+
// by using the '*' as shown below:
46+
// [assembly: AssemblyVersion("1.0.*")]
47+

0 commit comments

Comments
 (0)