private void PrintButton_Click(object sender, EventArgs e) { // Fondo var imageFilePath = @"C:\Users\Anselmo\source\repos\QrAccessControl\QrAccessControl.Desktop\bin\certificadoWebinarCeroDanfoss.png"; var jpg = iTextSharp.text.Image.GetInstance(imageFilePath); jpg.ScaleToFit(200, 500); jpg.Alignment = iTextSharp.text.Image.UNDERLYING; jpg.SetAbsolutePosition(8, 70); using (var doc = new Document(PageSize.A7, 10f, 10f, 10f, 10f)) using (var streamDoc = new FileStream($@"C:\Users\Anselmo\source\repos\QrAccessControl\QrAccessControl.Desktop\bin\Debug\{labelName.Text}.pdf", FileMode.Create)) { PdfWriter.GetInstance(doc, streamDoc); doc.Open(); var para = new Paragraph($"{labelName.Text}") { SpacingBefore = 70f }; doc.Add(jpg); doc.Add(para); doc.Close(); } var pdfConfirmationPath = $@"C:\Users\Anselmo\source\repos\QrAccessControl\QrAccessControl.Desktop\bin\Debug\{labelName.Text}.pdf"; var pdfView = new ConfirmationForm(pdfConfirmationPath); pdfView.Show(); }
private void Timer1_Tick(object sender, EventArgs e) { var reader = new BarcodeReader(); var result = reader.Decode((Bitmap)pictureBox1.Image); if (result != null) { labelName.Text = result.ToString(); var confirmation = new ConfirmationForm { ClientName = labelName.Text }; confirmation.Show(); } else { labelName.Text = "Preparado"; } }