예제 #1
0
        public FrameworkElement GetElement(string fileName)
        {
            var pdfViewer = new PdfViewer();

            var document = PdfDocument.Load(new MemoryStream(File.ReadAllBytes(fileName)));

            pdfViewer.Document = document;

            var windowsFormsHost = new WindowsFormsHost();

            windowsFormsHost.BeginInit();
            windowsFormsHost.Child  = pdfViewer;
            windowsFormsHost.Width  = document.PageSizes[0].Width * 1.2;
            windowsFormsHost.Height = document.PageSizes[0].Height * 1.2;
            windowsFormsHost.EndInit();

            return(windowsFormsHost);
        }
        public FrameworkElement GetElement(string fileName)
        {
            var maxWidth  = SystemParameters.WorkArea.Width - 100;
            var maxHeight = SystemParameters.WorkArea.Height - 100;

            var previewHandlerHost = new PreviewHandlerHost();

            var windowsFormsHost = new WindowsFormsHost();

            windowsFormsHost.BeginInit();
            windowsFormsHost.Child  = previewHandlerHost;
            windowsFormsHost.Width  = maxWidth / 1.5;
            windowsFormsHost.Height = maxHeight / 1.5;
            windowsFormsHost.EndInit();

            previewHandlerHost.Open(fileName);

            return(windowsFormsHost);
        }
        public FrameworkElement GetElement(string fileName)
        {
            var maxWidth = SystemParameters.WorkArea.Width - 100;
            var maxHeight = SystemParameters.WorkArea.Height - 100;

            var previewHandlerHost = new PreviewHandlerHost();

            var windowsFormsHost = new WindowsFormsHost();

            windowsFormsHost.BeginInit();
            windowsFormsHost.Child = previewHandlerHost;
            windowsFormsHost.Width = maxWidth / 1.5;
            windowsFormsHost.Height = maxHeight / 1.5;
            windowsFormsHost.EndInit();

            previewHandlerHost.Open(fileName);

            return windowsFormsHost;
        }
예제 #4
0
        public FrameworkElement GetElement(string fileName)
        {
            var maxWidth  = SystemParameters.WorkArea.Width - 100;
            var maxHeight = SystemParameters.WorkArea.Height - 100;

            var pdfViewer = new PdfViewer();

            var windowsFormsHost = new WindowsFormsHost();

            windowsFormsHost.BeginInit();
            windowsFormsHost.Child  = pdfViewer;
            windowsFormsHost.Width  = maxWidth / 1.5;
            windowsFormsHost.Height = maxHeight / 1.5;
            windowsFormsHost.EndInit();

            pdfViewer.Document = PdfDocument.Load(new MemoryStream(File.ReadAllBytes(fileName)));

            return(windowsFormsHost);
        }
예제 #5
0
        public (FrameworkElement, Size, string) GetViewer(FileInfo fileInfo)
        {
            var requestSize = new Size
            {
                Width  = 1200,
                Height = 900
            };

            var previewHandlerHost = new PreviewHandlerHost();

            var windowsFormsHost = new WindowsFormsHost();

            windowsFormsHost.BeginInit();
            windowsFormsHost.Child = previewHandlerHost;
            windowsFormsHost.EndInit();

            previewHandlerHost.Open(fileInfo.FullName);

            return(windowsFormsHost, requestSize, WinExplorerHelper.GetSizeFormat(fileInfo.Length));
        }
예제 #6
0
        public (FrameworkElement, Size, string) GetViewer(FileInfo fileInfo)
        {
            var pdfViewer = new PdfViewer();

            var document = PdfDocument.Load(new MemoryStream(File.ReadAllBytes(fileInfo.FullName)));

            pdfViewer.Document      = document;
            pdfViewer.ShowBookmarks = false;
            pdfViewer.ShowToolbar   = false;

            var requestSize = document.GetPageSize();

            var windowsFormsHost = new WindowsFormsHost();

            windowsFormsHost.BeginInit();
            windowsFormsHost.Child = pdfViewer;
            windowsFormsHost.EndInit();

            return(windowsFormsHost, requestSize, FormatMetadata(document, fileInfo));
        }