In this tutorial, you will configure a C# or VB.NET project for a Windows Presentation Foundation (WPF) application and use ImageGear .NET PDF capabilities. You will also learn how to open a PDF or PS file, display it on the screen, and navigate through the different pages of the PDF.
The following tutorial refers specifically to 64-bit installations; for 32-bit installations:
Using the desired version of Visual Studio (2010 or later):
Your output target directory should be set to $YOURLOCALPROJ\bin\x64\Debug\
XAML |
Copy Code |
---|---|
<Window x:Class="my_first_PDF_WPF_project.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:IGWC="clr-namespace:ImageGear.Windows.Controls;assembly=ImageGear24.Windows.Controls" Title="MainWindow" Height="714" Width="1035" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"> </Window> |
XAML |
Copy Code |
---|---|
<Window x:Class="my_first_PDF_WPF_project.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:IGWC="clr-namespace:ImageGear.Windows.Controls;assembly=ImageGear24.Windows.Controls" Title="MainWindow" Height="714" Width="1035" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="91*" /> <ColumnDefinition Width="4*" /> <ColumnDefinition Width="44*" /> <ColumnDefinition Width="888*" /> </Grid.ColumnDefinitions> <Menu Height="20" HorizontalAlignment="Stretch" Name="menu" VerticalAlignment="Top" Grid.ColumnSpan="4"> <MenuItem Name="menuItemFileOpen" Header="Open PDF ..." Click="menuItemFileOpen_Click"/> </Menu> <StatusBar Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" VerticalContentAlignment="Center" HorizontalContentAlignment="Stretch" Margin="0,0,0,-1" Grid.ColumnSpan="4"> <StatusBarItem Name="statusLabel" DataContext="{Binding}" BorderBrush="Black" BorderThickness="0" VerticalAlignment="Center" /> </StatusBar> </Grid> </Window> |
XAML |
Copy Code |
---|---|
<Window x:Class="my_first_PDF_WPF_project.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:IGWC="clr-namespace:ImageGear.Windows.Controls;assembly=ImageGear24.Windows.Controls" Title="MainWindow" Height="714" Width="1035" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="91*" /> <ColumnDefinition Width="4*" /> <ColumnDefinition Width="44*" /> <ColumnDefinition Width="888*" /> </Grid.ColumnDefinitions> <Menu Height="20" HorizontalAlignment="Stretch" Name="menu" VerticalAlignment="Top" Grid.ColumnSpan="4"> <MenuItem Name="menuItemFileOpen" Header="Open Document ..." Click="menuItemFileOpen_Click"/> </Menu> <StatusBar Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" VerticalContentAlignment="Center" HorizontalContentAlignment="Stretch" Margin="0,0,0,-1" Grid.ColumnSpan="4"> <StatusBarItem Name="statusLabel" DataContext="{Binding}" BorderBrush="Black" BorderThickness="0" VerticalAlignment="Center" /> </StatusBar> <IGWC:ImGearThumbnailList Name="igThumbnailList" Margin="12,26,0,30" HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="90" ItemHeight="80" ItemWidth="60" SelectionChanged="igThumbnailList_SelectionChanged" Grid.ColumnSpan="3" /> <IGWC:PageView Name="igPageView" Margin="20,26,12,30" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="LightGray" Grid.Column="2" Grid.ColumnSpan="2" /> </Grid> </Window> |
This sample project was created as a simple introduction to using the PDF functionality in ImageGear. For systems designed for production environments, you need to configure your projects more efficiently by only adding the resources that you need. For more information, refer to Deploying Your Product.