Skip to content

Commit e86f1c1

Browse files
898743
1 parent 4b18dec commit e86f1c1

File tree

9 files changed

+115
-0
lines changed

9 files changed

+115
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Solution>
2+
<Project Path="Progamatic_printpage/Progamatic_printpage.csproj" />
3+
</Solution>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="Progamatic_printpage.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:Progamatic_printpage"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Configuration;
2+
using System.Data;
3+
using System.Windows;
4+
5+
namespace Progamatic_printpage
6+
{
7+
/// <summary>
8+
/// Interaction logic for App.xaml
9+
/// </summary>
10+
public partial class App : Application
11+
{
12+
}
13+
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Windows;
2+
3+
[assembly: ThemeInfo(
4+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5+
//(used if a resource is not found in the page,
6+
// or application resource dictionaries)
7+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8+
//(used if a resource is not found in the page,
9+
// app, or any theme specific resource dictionaries)
10+
)]
Binary file not shown.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Window x:Class="Progamatic_printpage.MainWindow"
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:Progamatic_printpage"
7+
xmlns:syncfusion="clr-namespace:Syncfusion.Windows.PdfViewer;assembly=Syncfusion.PdfViewer.WPF"
8+
mc:Ignorable="d"
9+
Title="MainWindow" Height="450" Width="800">
10+
<Grid>
11+
<Grid.RowDefinitions>
12+
<RowDefinition Height="Auto"/>
13+
<RowDefinition Height="*"/>
14+
</Grid.RowDefinitions>
15+
<Button x:Name="Print" Content="Print" Width="100" Height="30" Margin="10" Click="Print_Click"/>
16+
<syncfusion:PdfViewerControl x:Name="pdfViewer" Grid.Row="1"></syncfusion:PdfViewerControl>
17+
</Grid>
18+
</Window>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Text;
2+
using System.Windows;
3+
using System.Windows.Controls;
4+
using System.Windows.Data;
5+
using System.Windows.Documents;
6+
using System.Windows.Input;
7+
using System.Windows.Media;
8+
using System.Windows.Media.Imaging;
9+
using System.Windows.Navigation;
10+
using System.Windows.Shapes;
11+
12+
namespace Progamatic_printpage
13+
{
14+
/// <summary>
15+
/// Interaction logic for MainWindow.xaml
16+
/// </summary>
17+
public partial class MainWindow : Window
18+
{
19+
public MainWindow()
20+
{
21+
InitializeComponent();
22+
pdfViewer.Load("../../../Input.pdf");
23+
}
24+
private void Print_Click(object sender, RoutedEventArgs e)
25+
{
26+
BitmapSource bitmapImage = pdfViewer.ExportAsImage(pdfViewer.CurrentPageIndex - 1);
27+
Image image = new Image();
28+
image.Source = bitmapImage;
29+
PrintDialog printDialog = new PrintDialog();
30+
bool? result = printDialog.ShowDialog();
31+
if (result == true)
32+
{
33+
printDialog.PrintVisual(image, "PDF current page");
34+
}
35+
}
36+
37+
}
38+
39+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="Syncfusion.PdfViewer.WPF" Version="*" />
9+
</ItemGroup>
10+
<Import Project="targets\MultiTargeting.targets" />
11+
12+
</Project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project>
2+
<PropertyGroup>
3+
<TargetFrameworks>net462;net8.0-windows;net9.0-windows;net10.0-windows</TargetFrameworks>
4+
<UseWPF>true</UseWPF>
5+
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
6+
<GenerateDocumentationFile>True</GenerateDocumentationFile>
7+
<EnableDefaultItems>True</EnableDefaultItems>
8+
<EnableDefaultEmbeddedResourceItems>True</EnableDefaultEmbeddedResourceItems>
9+
</PropertyGroup>
10+
</Project>

0 commit comments

Comments
 (0)