2024-06-25 15:30:02 +04:00
|
|
|
|
using Spire.Pdf;
|
|
|
|
|
using Spire.Pdf.Graphics;
|
|
|
|
|
using System;
|
2024-06-25 13:37:33 +04:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace WinFormsApp
|
|
|
|
|
{
|
|
|
|
|
public partial class FormPreviewPDF : Form
|
|
|
|
|
{
|
|
|
|
|
public string src { get; set; }
|
|
|
|
|
public FormPreviewPDF()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonPrint_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DialogResult = DialogResult.OK;
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FormPreviewPDF_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
2024-06-25 15:30:02 +04:00
|
|
|
|
var doc = new PdfDocument();
|
|
|
|
|
doc.LoadFromFile(src);
|
|
|
|
|
Image image = doc.SaveAsImage(0, PdfImageType.Bitmap, 500, 1000);
|
|
|
|
|
pictureBox.Image = image;
|
|
|
|
|
pictureBox.SizeMode = PictureBoxSizeMode.Zoom;
|
2024-06-25 14:27:20 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonCancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DialogResult = DialogResult.Cancel;
|
|
|
|
|
Close();
|
|
|
|
|
}
|
2024-06-25 13:37:33 +04:00
|
|
|
|
}
|
|
|
|
|
}
|