Test
This commit is contained in:
		
							
								
								
									
										30
									
								
								PrintPDF/PdfSharp/Windows/PagePreview-ag.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								PrintPDF/PdfSharp/Windows/PagePreview-ag.xaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
<UserControl x:Class="PdfSharp.Windows.PagePreview"
 | 
			
		||||
    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"
 | 
			
		||||
    mc:Ignorable="d"
 | 
			
		||||
    d:DesignHeight="407" d:DesignWidth="602">
 | 
			
		||||
  <Grid x:Name="LayoutRoot" Background="White">
 | 
			
		||||
    <Border Margin="0">
 | 
			
		||||
      <ScrollViewer HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" Background="#A0A0A0" >
 | 
			
		||||
        <Grid>
 | 
			
		||||
          <Border Background="Transparent" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="3 3 6 6">
 | 
			
		||||
            <Border Background="#F8F8FF" BorderBrush="#111111" BorderThickness="1" Visibility="{Binding PageVisibility}">
 | 
			
		||||
              <Border.Effect>
 | 
			
		||||
                <DropShadowEffect Opacity="0.6" />
 | 
			
		||||
              </Border.Effect>
 | 
			
		||||
              <Grid x:Name="canvasGrid" Width="210" Height="297" Background="#FCFCFF">
 | 
			
		||||
                <Canvas x:Name="canvas" Margin="0" Background="Transparent">
 | 
			
		||||
                  <Canvas.RenderTransform>
 | 
			
		||||
                    <ScaleTransform x:Name="scaleTransform" ScaleX="{Binding CanvasScaleX}" ScaleY="{Binding CanvasScaleY}"/>
 | 
			
		||||
                  </Canvas.RenderTransform>
 | 
			
		||||
                </Canvas>
 | 
			
		||||
              </Grid>
 | 
			
		||||
            </Border>
 | 
			
		||||
          </Border>
 | 
			
		||||
        </Grid>
 | 
			
		||||
      </ScrollViewer>
 | 
			
		||||
    </Border>
 | 
			
		||||
  </Grid>
 | 
			
		||||
</UserControl>
 | 
			
		||||
							
								
								
									
										163
									
								
								PrintPDF/PdfSharp/Windows/PagePreview-ag.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										163
									
								
								PrintPDF/PdfSharp/Windows/PagePreview-ag.xaml.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,163 @@
 | 
			
		||||
#if !NETSTANDARD2_0
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Net;
 | 
			
		||||
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.Animation;
 | 
			
		||||
using System.Windows.Shapes;
 | 
			
		||||
 | 
			
		||||
namespace PdfSharp.Windows
 | 
			
		||||
{
 | 
			
		||||
  /// <summary>
 | 
			
		||||
  /// A simple page viewer for WPF and Silverlight.
 | 
			
		||||
  /// Not based on empira application framework.
 | 
			
		||||
  /// </summary>
 | 
			
		||||
  public partial class PagePreview : UserControl
 | 
			
		||||
  {
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Initializes a new instance of the <see cref="PagePreview"/> class.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public PagePreview()
 | 
			
		||||
    {
 | 
			
		||||
      InitializeComponent();
 | 
			
		||||
 | 
			
		||||
      //TextBlock tb = new TextBlock(); 
 | 
			
		||||
      //Binding b = new Binding("FontSize"); 
 | 
			
		||||
      //b.Source = this; 
 | 
			
		||||
      //tb.SetBinding(TextBlock.FontSizeProperty, b);
 | 
			
		||||
 | 
			
		||||
      //canvasGrid.SetBinding(WidthProperty, new Binding("CanvasWidth"));
 | 
			
		||||
      //canvasGrid.SetBinding(HeightProperty, new Binding("CanvasHeight"));
 | 
			
		||||
      //canvas.SetBinding(WidthProperty, new Binding("CanvasWidth"));
 | 
			
		||||
      //canvas.SetBinding(HeightProperty, new Binding("CanvasHeight"));
 | 
			
		||||
 | 
			
		||||
      LayoutRoot.DataContext = this;
 | 
			
		||||
      Zoom = (Zoom)100;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void Test()
 | 
			
		||||
    {
 | 
			
		||||
      double factor = 1;
 | 
			
		||||
      int zoom = (int)Zoom;
 | 
			
		||||
      if (zoom > 0)
 | 
			
		||||
        factor = Math.Max(Math.Min(zoom, 800), 10) / 100.0;
 | 
			
		||||
      else
 | 
			
		||||
        factor = 1;
 | 
			
		||||
 | 
			
		||||
      canvasGrid.Width = 480 * factor;
 | 
			
		||||
      canvasGrid.Height = 640 * factor;
 | 
			
		||||
      scaleTransform.ScaleX = factor;
 | 
			
		||||
      scaleTransform.ScaleY = factor;
 | 
			
		||||
 | 
			
		||||
      //CanvasWidth = 480 * factor;
 | 
			
		||||
      //CanvasHeight = 640 * factor;
 | 
			
		||||
      //CanvasScaleX = 1 * factor;
 | 
			
		||||
      //CanvasScaleY = 1 * factor;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Gets the canvas.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public Canvas Canvas
 | 
			
		||||
    {
 | 
			
		||||
      get { return canvas; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Gets or sets the size of the page 1/96 inch.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public Size PageSize
 | 
			
		||||
    {
 | 
			
		||||
      get { return (Size)GetValue(PageSizeProperty); }
 | 
			
		||||
      set { SetValue(PageSizeProperty, value); }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// DependencyProperty of PageSize.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public readonly DependencyProperty PageSizeProperty =
 | 
			
		||||
      DependencyProperty.Register("PageSize", typeof(Size), typeof(PagePreview), new PropertyMetadata(new Size(480, 640), PageSizeChanged));
 | 
			
		||||
 | 
			
		||||
    private static void PageSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 | 
			
		||||
    {
 | 
			
		||||
      ((PagePreview)d).Test();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Gets or sets the zoom.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public Zoom Zoom
 | 
			
		||||
    {
 | 
			
		||||
      get { return (Zoom)GetValue(ZoomProperty); }
 | 
			
		||||
      set { SetValue(ZoomProperty, value); }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// DependencyProperty of Zoom.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public readonly DependencyProperty ZoomProperty =
 | 
			
		||||
      DependencyProperty.Register("Zoom", typeof(Zoom), typeof(PagePreview), new PropertyMetadata(Zoom.FullPage, ZoomChanged));
 | 
			
		||||
 | 
			
		||||
    private static void ZoomChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 | 
			
		||||
    {
 | 
			
		||||
      ((PagePreview)d).Test();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if _
 | 
			
		||||
    public double CanvasWidth
 | 
			
		||||
    {
 | 
			
		||||
      get { return (double)GetValue(CanvasWidthProperty); }
 | 
			
		||||
      set { SetValue(CanvasWidthProperty, value); }
 | 
			
		||||
    }
 | 
			
		||||
    public readonly DependencyProperty CanvasWidthProperty =
 | 
			
		||||
      DependencyProperty.Register("CanvasWidth", typeof(double), typeof(PagePreview), new PropertyMetadata(210.0));
 | 
			
		||||
 | 
			
		||||
    public double CanvasHeight
 | 
			
		||||
    {
 | 
			
		||||
      get { return (double)GetValue(CanvasHeightProperty); }
 | 
			
		||||
      set { SetValue(CanvasHeightProperty, value); }
 | 
			
		||||
    }
 | 
			
		||||
    public readonly DependencyProperty CanvasHeightProperty =
 | 
			
		||||
      DependencyProperty.Register("CanvasHeight", typeof(double), typeof(PagePreview), new PropertyMetadata(297.0));
 | 
			
		||||
 | 
			
		||||
    public double CanvasScaleX
 | 
			
		||||
    {
 | 
			
		||||
      get { return (double)GetValue(CanvasScaleXProperty); }
 | 
			
		||||
      set { SetValue(CanvasScaleXProperty, value); }
 | 
			
		||||
    }
 | 
			
		||||
    public readonly DependencyProperty CanvasScaleXProperty =
 | 
			
		||||
      DependencyProperty.Register("CanvasScaleX", typeof(double), typeof(PagePreview), new PropertyMetadata(1.0));
 | 
			
		||||
 | 
			
		||||
    public double CanvasScaleY
 | 
			
		||||
    {
 | 
			
		||||
      get { return (double)GetValue(CanvasScaleYProperty); }
 | 
			
		||||
      set { SetValue(CanvasScaleYProperty, value); }
 | 
			
		||||
    }
 | 
			
		||||
    public readonly DependencyProperty CanvasScaleYProperty =
 | 
			
		||||
      DependencyProperty.Register("CanvasScaleY", typeof(double), typeof(PagePreview), new PropertyMetadata(1.0));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Gets or sets the page visibility.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public Visibility PageVisibility
 | 
			
		||||
    {
 | 
			
		||||
      get { return (Visibility)GetValue(PageVisibilityProperty); }
 | 
			
		||||
      set { SetValue(PageVisibilityProperty, value); }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// DependencyProperty of PageVisibility.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public readonly DependencyProperty PageVisibilityProperty =
 | 
			
		||||
      DependencyProperty.Register("PageVisibility", typeof(Visibility), typeof(PagePreview), null);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										30
									
								
								PrintPDF/PdfSharp/Windows/PagePreview-wpf.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								PrintPDF/PdfSharp/Windows/PagePreview-wpf.xaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
<UserControl x:Class="PdfSharp.Windows.PagePreview"
 | 
			
		||||
    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"
 | 
			
		||||
    mc:Ignorable="d"
 | 
			
		||||
    d:DesignHeight="407" d:DesignWidth="602">
 | 
			
		||||
  <Grid x:Name="LayoutRoot" Background="White">
 | 
			
		||||
    <Border Margin="0">
 | 
			
		||||
      <ScrollViewer HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" Background="#A0A0A0" >
 | 
			
		||||
        <Grid>
 | 
			
		||||
          <Border Background="Transparent" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="3 3 6 6">
 | 
			
		||||
            <Border Background="#F8F8FF" BorderBrush="#111111" BorderThickness="1" Visibility="{Binding PageVisibility}">
 | 
			
		||||
              <Border.Effect>
 | 
			
		||||
                <DropShadowEffect Opacity="0.6" />
 | 
			
		||||
              </Border.Effect>
 | 
			
		||||
              <Grid x:Name="canvasGrid" Width="210" Height="297" Background="#FCFCFF">
 | 
			
		||||
                <Canvas x:Name="canvas" Margin="0" Background="Transparent">
 | 
			
		||||
                  <Canvas.RenderTransform>
 | 
			
		||||
                    <ScaleTransform x:Name="scaleTransform" ScaleX="{Binding CanvasScaleX}" ScaleY="{Binding CanvasScaleY}"/>
 | 
			
		||||
                  </Canvas.RenderTransform>
 | 
			
		||||
                </Canvas>
 | 
			
		||||
              </Grid>
 | 
			
		||||
            </Border>
 | 
			
		||||
          </Border>
 | 
			
		||||
        </Grid>
 | 
			
		||||
      </ScrollViewer>
 | 
			
		||||
    </Border>
 | 
			
		||||
  </Grid>
 | 
			
		||||
</UserControl>
 | 
			
		||||
							
								
								
									
										163
									
								
								PrintPDF/PdfSharp/Windows/PagePreview-wpf.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										163
									
								
								PrintPDF/PdfSharp/Windows/PagePreview-wpf.xaml.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,163 @@
 | 
			
		||||
#if !NETSTANDARD2_0
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Net;
 | 
			
		||||
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.Animation;
 | 
			
		||||
using System.Windows.Shapes;
 | 
			
		||||
 | 
			
		||||
namespace PdfSharp.Windows
 | 
			
		||||
{
 | 
			
		||||
  /// <summary>
 | 
			
		||||
  /// A simple page viewer for WPF and Silverlight.
 | 
			
		||||
  /// Not based on empira application framework.
 | 
			
		||||
  /// </summary>
 | 
			
		||||
  public partial class PagePreview : UserControl
 | 
			
		||||
  {
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Initializes a new instance of the <see cref="PagePreview"/> class.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public PagePreview()
 | 
			
		||||
    {
 | 
			
		||||
      InitializeComponent();
 | 
			
		||||
 | 
			
		||||
      //TextBlock tb = new TextBlock(); 
 | 
			
		||||
      //Binding b = new Binding("FontSize"); 
 | 
			
		||||
      //b.Source = this; 
 | 
			
		||||
      //tb.SetBinding(TextBlock.FontSizeProperty, b);
 | 
			
		||||
 | 
			
		||||
      //canvasGrid.SetBinding(WidthProperty, new Binding("CanvasWidth"));
 | 
			
		||||
      //canvasGrid.SetBinding(HeightProperty, new Binding("CanvasHeight"));
 | 
			
		||||
      //canvas.SetBinding(WidthProperty, new Binding("CanvasWidth"));
 | 
			
		||||
      //canvas.SetBinding(HeightProperty, new Binding("CanvasHeight"));
 | 
			
		||||
 | 
			
		||||
      LayoutRoot.DataContext = this;
 | 
			
		||||
      Zoom = (Zoom)100;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void Test()
 | 
			
		||||
    {
 | 
			
		||||
      double factor = 1;
 | 
			
		||||
      int zoom = (int)Zoom;
 | 
			
		||||
      if (zoom > 0)
 | 
			
		||||
        factor = Math.Max(Math.Min(zoom, 800), 10) / 100.0;
 | 
			
		||||
      else
 | 
			
		||||
        factor = 1;
 | 
			
		||||
 | 
			
		||||
      canvasGrid.Width = 480 * factor;
 | 
			
		||||
      canvasGrid.Height = 640 * factor;
 | 
			
		||||
      scaleTransform.ScaleX = factor;
 | 
			
		||||
      scaleTransform.ScaleY = factor;
 | 
			
		||||
 | 
			
		||||
      //CanvasWidth = 480 * factor;
 | 
			
		||||
      //CanvasHeight = 640 * factor;
 | 
			
		||||
      //CanvasScaleX = 1 * factor;
 | 
			
		||||
      //CanvasScaleY = 1 * factor;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Gets the canvas.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public Canvas Canvas
 | 
			
		||||
    {
 | 
			
		||||
      get { return canvas; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Gets or sets the size of the page 1/96 inch.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public Size PageSize
 | 
			
		||||
    {
 | 
			
		||||
      get { return (Size)GetValue(PageSizeProperty); }
 | 
			
		||||
      set { SetValue(PageSizeProperty, value); }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// DependencyProperty of PageSize.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public readonly DependencyProperty PageSizeProperty =
 | 
			
		||||
      DependencyProperty.Register("PageSize", typeof(Size), typeof(PagePreview), new PropertyMetadata(new Size(480, 640), PageSizeChanged));
 | 
			
		||||
 | 
			
		||||
    private static void PageSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 | 
			
		||||
    {
 | 
			
		||||
      ((PagePreview)d).Test();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Gets or sets the zoom.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public Zoom Zoom
 | 
			
		||||
    {
 | 
			
		||||
      get { return (Zoom)GetValue(ZoomProperty); }
 | 
			
		||||
      set { SetValue(ZoomProperty, value); }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// DependencyProperty of Zoom.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public readonly DependencyProperty ZoomProperty =
 | 
			
		||||
      DependencyProperty.Register("Zoom", typeof(Zoom), typeof(PagePreview), new PropertyMetadata(Zoom.FullPage, ZoomChanged));
 | 
			
		||||
 | 
			
		||||
    private static void ZoomChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 | 
			
		||||
    {
 | 
			
		||||
      ((PagePreview)d).Test();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if _
 | 
			
		||||
    public double CanvasWidth
 | 
			
		||||
    {
 | 
			
		||||
      get { return (double)GetValue(CanvasWidthProperty); }
 | 
			
		||||
      set { SetValue(CanvasWidthProperty, value); }
 | 
			
		||||
    }
 | 
			
		||||
    public readonly DependencyProperty CanvasWidthProperty =
 | 
			
		||||
      DependencyProperty.Register("CanvasWidth", typeof(double), typeof(PagePreview), new PropertyMetadata(210.0));
 | 
			
		||||
 | 
			
		||||
    public double CanvasHeight
 | 
			
		||||
    {
 | 
			
		||||
      get { return (double)GetValue(CanvasHeightProperty); }
 | 
			
		||||
      set { SetValue(CanvasHeightProperty, value); }
 | 
			
		||||
    }
 | 
			
		||||
    public readonly DependencyProperty CanvasHeightProperty =
 | 
			
		||||
      DependencyProperty.Register("CanvasHeight", typeof(double), typeof(PagePreview), new PropertyMetadata(297.0));
 | 
			
		||||
 | 
			
		||||
    public double CanvasScaleX
 | 
			
		||||
    {
 | 
			
		||||
      get { return (double)GetValue(CanvasScaleXProperty); }
 | 
			
		||||
      set { SetValue(CanvasScaleXProperty, value); }
 | 
			
		||||
    }
 | 
			
		||||
    public readonly DependencyProperty CanvasScaleXProperty =
 | 
			
		||||
      DependencyProperty.Register("CanvasScaleX", typeof(double), typeof(PagePreview), new PropertyMetadata(1.0));
 | 
			
		||||
 | 
			
		||||
    public double CanvasScaleY
 | 
			
		||||
    {
 | 
			
		||||
      get { return (double)GetValue(CanvasScaleYProperty); }
 | 
			
		||||
      set { SetValue(CanvasScaleYProperty, value); }
 | 
			
		||||
    }
 | 
			
		||||
    public readonly DependencyProperty CanvasScaleYProperty =
 | 
			
		||||
      DependencyProperty.Register("CanvasScaleY", typeof(double), typeof(PagePreview), new PropertyMetadata(1.0));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Gets or sets the page visibility.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public Visibility PageVisibility
 | 
			
		||||
    {
 | 
			
		||||
      get { return (Visibility)GetValue(PageVisibilityProperty); }
 | 
			
		||||
      set { SetValue(PageVisibilityProperty, value); }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// DependencyProperty of PageVisibility.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public readonly DependencyProperty PageVisibilityProperty =
 | 
			
		||||
      DependencyProperty.Register("PageVisibility", typeof(Visibility), typeof(PagePreview), null);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										32
									
								
								PrintPDF/PdfSharp/Windows/PagePreviewDesignTimeData.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								PrintPDF/PdfSharp/Windows/PagePreviewDesignTimeData.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
#if !NETSTANDARD2_0
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Net;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
using System.Windows.Controls;
 | 
			
		||||
using System.Windows.Documents;
 | 
			
		||||
using System.Windows.Ink;
 | 
			
		||||
using System.Windows.Input;
 | 
			
		||||
using System.Windows.Media;
 | 
			
		||||
using System.Windows.Media.Animation;
 | 
			
		||||
using System.Windows.Shapes;
 | 
			
		||||
 | 
			
		||||
namespace PdfSharp.Windows
 | 
			
		||||
{
 | 
			
		||||
  public class PagePreviewDesignTimeData
 | 
			
		||||
  {
 | 
			
		||||
    public double CanvasWidth
 | 
			
		||||
    {
 | 
			
		||||
      get { return 210; }
 | 
			
		||||
      set { }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double CanvasHeight
 | 
			
		||||
    {
 | 
			
		||||
      get { return 297; }
 | 
			
		||||
      set { }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										56
									
								
								PrintPDF/PdfSharp/Windows/VisualPresenter.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								PrintPDF/PdfSharp/Windows/VisualPresenter.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,56 @@
 | 
			
		||||
#if !NETSTANDARD2_0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
using System.Windows.Media;
 | 
			
		||||
 | 
			
		||||
namespace PdfSharp.Windows
 | 
			
		||||
{
 | 
			
		||||
    // Create a host visual derived from the FrameworkElement class.// This class provides layout, event handling, and container support for// the child visual objects.
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Used to present Visuals in the PagePreview.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public class VisualPresenter : FrameworkElement
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Initializes a new instance of the <see cref="VisualPresenter"/> class.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public VisualPresenter()
 | 
			
		||||
        {
 | 
			
		||||
            _children = new VisualCollection(this);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets the number of visual child elements within this element.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        protected override int VisualChildrenCount
 | 
			
		||||
        {
 | 
			
		||||
            get { return _children.Count; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Overrides <see cref="M:System.Windows.Media.Visual.GetVisualChild(System.Int32)"/>, and returns a child at the specified index from a collection of child elements.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        protected override Visual GetVisualChild(int index)
 | 
			
		||||
        {
 | 
			
		||||
            if (index < 0 || index >= _children.Count)
 | 
			
		||||
                throw new ArgumentOutOfRangeException("index");
 | 
			
		||||
 | 
			
		||||
            return _children[index];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets the children collection.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public VisualCollection Children
 | 
			
		||||
        {
 | 
			
		||||
            get { return _children; }
 | 
			
		||||
        }
 | 
			
		||||
        readonly VisualCollection _children;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										56
									
								
								PrintPDF/PdfSharp/Windows/enums/RenderMode.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								PrintPDF/PdfSharp/Windows/enums/RenderMode.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,56 @@
 | 
			
		||||
#region PDFsharp - A .NET library for processing PDF
 | 
			
		||||
//
 | 
			
		||||
// Authors:
 | 
			
		||||
//   Stefan Lange
 | 
			
		||||
//
 | 
			
		||||
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
 | 
			
		||||
//
 | 
			
		||||
// http://www.pdfsharp.com
 | 
			
		||||
// http://sourceforge.net/projects/pdfsharp
 | 
			
		||||
//
 | 
			
		||||
// Permission is hereby granted, free of charge, to any person obtaining a
 | 
			
		||||
// copy of this software and associated documentation files (the "Software"),
 | 
			
		||||
// to deal in the Software without restriction, including without limitation
 | 
			
		||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
 | 
			
		||||
// and/or sell copies of the Software, and to permit persons to whom the
 | 
			
		||||
// Software is furnished to do so, subject to the following conditions:
 | 
			
		||||
//
 | 
			
		||||
// The above copyright notice and this permission notice shall be included
 | 
			
		||||
// in all copies or substantial portions of the Software.
 | 
			
		||||
//
 | 
			
		||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 | 
			
		||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 | 
			
		||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 | 
			
		||||
// DEALINGS IN THE SOFTWARE.
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
#if !NETSTANDARD2_0
 | 
			
		||||
 | 
			
		||||
namespace PdfSharp.Windows
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Specifies how to render the preview.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public enum RenderMode
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Draw retained
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        Default = 0,
 | 
			
		||||
 | 
			
		||||
        ///// <summary>
 | 
			
		||||
        ///// Draw using a metafile
 | 
			
		||||
        ///// </summary>
 | 
			
		||||
        //Metafile = 1,
 | 
			
		||||
 | 
			
		||||
        ///// <summary>
 | 
			
		||||
        ///// Draw using a bitmap image.
 | 
			
		||||
        ///// </summary>
 | 
			
		||||
        //Bitmap = 2
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										122
									
								
								PrintPDF/PdfSharp/Windows/enums/Zoom.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										122
									
								
								PrintPDF/PdfSharp/Windows/enums/Zoom.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,122 @@
 | 
			
		||||
#region PDFsharp - A .NET library for processing PDF
 | 
			
		||||
//
 | 
			
		||||
// Authors:
 | 
			
		||||
//   Stefan Lange
 | 
			
		||||
//
 | 
			
		||||
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
 | 
			
		||||
//
 | 
			
		||||
// http://www.pdfsharp.com
 | 
			
		||||
// http://sourceforge.net/projects/pdfsharp
 | 
			
		||||
//
 | 
			
		||||
// Permission is hereby granted, free of charge, to any person obtaining a
 | 
			
		||||
// copy of this software and associated documentation files (the "Software"),
 | 
			
		||||
// to deal in the Software without restriction, including without limitation
 | 
			
		||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
 | 
			
		||||
// and/or sell copies of the Software, and to permit persons to whom the
 | 
			
		||||
// Software is furnished to do so, subject to the following conditions:
 | 
			
		||||
//
 | 
			
		||||
// The above copyright notice and this permission notice shall be included
 | 
			
		||||
// in all copies or substantial portions of the Software.
 | 
			
		||||
//
 | 
			
		||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 | 
			
		||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 | 
			
		||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 | 
			
		||||
// DEALINGS IN THE SOFTWARE.
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
#if !NETSTANDARD2_0
 | 
			
		||||
 | 
			
		||||
namespace PdfSharp.Windows
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Defines a zoom factor used in the preview control.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public enum Zoom
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// The smallest possible zoom factor.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        Mininum = 10,
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// The largest possible zoom factor.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        Maximum = 800,
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// A pre-defined zoom factor.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        Percent800 = 800,
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// A pre-defined zoom factor.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        Percent600 = 600,
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// A pre-defined zoom factor.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        Percent400 = 400,
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// A pre-defined zoom factor.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        Percent200 = 200,
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// A pre-defined zoom factor.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        Percent150 = 150,
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// A pre-defined zoom factor.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        Percent100 = 100,
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// A pre-defined zoom factor.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        Percent75 = 75,
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// A pre-defined zoom factor.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        Percent50 = 50,
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// A pre-defined zoom factor.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        Percent25 = 25,
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// A pre-defined zoom factor.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        Percent10 = 10,
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Sets the percent value such that the document fits horizontally into the window.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        BestFit = -1,
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Sets the percent value such that the printable area of the document fits horizontally into the window.
 | 
			
		||||
        /// Currently not yet implemented and the same as ZoomBestFit.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        TextFit = -2,
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Sets the percent value such that the whole document fits completely into the window.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        FullPage = -3,
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Sets the percent value such that the document is displayed in its real physical size.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        OriginalSize = -4,
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
		Reference in New Issue
	
	Block a user