diff --git a/.vs/certificate-generator/v16/.suo b/.vs/certificate-generator/v16/.suo index f0544e5..68ac7ea 100644 Binary files a/.vs/certificate-generator/v16/.suo and b/.vs/certificate-generator/v16/.suo differ diff --git a/CG.png b/CG.png new file mode 100644 index 0000000..aea1caf Binary files /dev/null and b/CG.png differ diff --git a/Form1.Designer.cs b/Form1.Designer.cs index f9924c7..2c1c35f 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -105,6 +105,7 @@ private void InitializeComponent() // this.tmplt_path_tb.Location = new System.Drawing.Point(23, 270); this.tmplt_path_tb.Name = "tmplt_path_tb"; + this.tmplt_path_tb.ReadOnly = true; this.tmplt_path_tb.Size = new System.Drawing.Size(201, 20); this.tmplt_path_tb.TabIndex = 7; // @@ -112,6 +113,7 @@ private void InitializeComponent() // this.output_folder_path.Location = new System.Drawing.Point(23, 100); this.output_folder_path.Name = "output_folder_path"; + this.output_folder_path.ReadOnly = true; this.output_folder_path.Size = new System.Drawing.Size(201, 20); this.output_folder_path.TabIndex = 8; // @@ -139,6 +141,7 @@ private void InitializeComponent() // this.csv_txt.Location = new System.Drawing.Point(23, 183); this.csv_txt.Name = "csv_txt"; + this.csv_txt.ReadOnly = true; this.csv_txt.Size = new System.Drawing.Size(201, 20); this.csv_txt.TabIndex = 13; // @@ -332,7 +335,7 @@ private void InitializeComponent() this.Controls.Add(this.panel3); this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Form1"; + this.Text = "Certificate Generator"; this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.panel1.ResumeLayout(false); diff --git a/Form1.cs b/Form1.cs index b368ccd..38e871e 100644 --- a/Form1.cs +++ b/Form1.cs @@ -7,6 +7,7 @@ using System.Drawing.Imaging; using System.IO; using System.Linq; +using System.Resources; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -25,6 +26,7 @@ public partial class Form1 : Form { private Control activeControl; private Point previousPosition; + string img_path; public Form1() { InitializeComponent(); @@ -33,16 +35,39 @@ public Form1() private void load_img_btn_Click(object sender, EventArgs e) { - using (OpenFileDialog openFileDialog1 = new OpenFileDialog()) + using (OpenFileDialog ofd = new OpenFileDialog()) { - openFileDialog1.Filter = "Templates |*.png;*.jpg;*.jpeg;"; + ofd.Filter = "Templates |*.png;*.jpg;*.jpeg;*.pdf;"; - if (openFileDialog1.ShowDialog() == DialogResult.OK) + if (ofd.ShowDialog() == DialogResult.OK) { - Image img = Image.FromFile(openFileDialog1.FileName); + string file_name = ofd.FileName; + + Console.WriteLine(file_name); + Image img = null; + + if (Path.GetExtension(file_name) == ".pdf") + { + List errors = cs_pdf_to_image.Pdf2Image.Convert(file_name, "certificate_generator_temp_inputfile.png"); + //extension = ".png"; + img = Image.FromFile("certificate_generator_temp_inputfile.png"); + img_path = "certificate_generator_temp_inputfile.png"; + + foreach (string er in errors) + { + Console.WriteLine(er); + + } + } + else + { + img = Image.FromFile(file_name); + img_path = file_name; + } + pictureBox1.Image = img; img_dim_lbl.Text = img.Width + " x " + img.Height; - tmplt_path_tb.Text = openFileDialog1.FileName; + tmplt_path_tb.Text =ofd.FileName; } } @@ -206,7 +231,7 @@ private void reset_btn_Click(object sender, EventArgs e) file_names_dd.Items.Add("Default Numbering"); file_names_dd.SelectedIndex = 0; png_rb.Checked = true; - + } @@ -249,14 +274,9 @@ private void save_Click(object sender, EventArgs e) Dictionary> fonts = Tools.get_labels_fonts(pictureBox1.Controls.OfType