Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Progamatic_printpage/Progamatic_printpage.csproj" />
</Solution>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="Progamatic_printpage.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Progamatic_printpage"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Configuration;
using System.Data;
using System.Windows;

namespace Progamatic_printpage
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Window x:Class="Progamatic_printpage.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Progamatic_printpage"
xmlns:syncfusion="clr-namespace:Syncfusion.Windows.PdfViewer;assembly=Syncfusion.PdfViewer.WPF"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button x:Name="Print" Content="Print" Width="100" Height="30" Margin="10" Click="Print_Click"/>
<syncfusion:PdfViewerControl x:Name="pdfViewer" Grid.Row="1"></syncfusion:PdfViewerControl>
</Grid>
</Window>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Progamatic_printpage
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
pdfViewer.Load("../../../Input.pdf");
}
private void Print_Click(object sender, RoutedEventArgs e)
{
BitmapSource bitmapImage = pdfViewer.ExportAsImage(pdfViewer.CurrentPageIndex - 1);
Image image = new Image();
image.Source = bitmapImage;
PrintDialog printDialog = new PrintDialog();
bool? result = printDialog.ShowDialog();
if (result == true)
{
printDialog.PrintVisual(image, "PDF current page");
}
}

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.PdfViewer.WPF" Version="*" />
</ItemGroup>
<Import Project="targets\MultiTargeting.targets" />

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net462;net8.0-windows;net9.0-windows;net10.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<EnableDefaultItems>True</EnableDefaultItems>
<EnableDefaultEmbeddedResourceItems>True</EnableDefaultEmbeddedResourceItems>
</PropertyGroup>
</Project>