BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
string fileName = ""; PdfDocument document = new PdfDocument(); document.PageSettings = new PdfPageSettings(new SizeF(300, 400)); PdfPage page = document.Pages.Add(); PdfGraphics graphics = page.Graphics; PdfImage image = PdfImage.FromStream(new MemoryStream(attachment.FILE_DATA));//PdfImage.FromFile(@"C:\\DevelopmentMobile\\action.png"); PdfFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 8f, PdfFontStyle.Bold); PdfForm frm = new PdfForm(); graphics.DrawImage(image, 0, 0); PdfButtonField submitButton = new PdfButtonField(page, "submitButton"); submitButton.Bounds = new RectangleF(25, 160, 100, 20); submitButton.Text = "Apply"; submitButton.BackColor = new PdfColor(181, 191, 203); //Create a new PdfJavaScriptAction PdfJavaScriptAction javaAction = new PdfJavaScriptAction("this.saveAs(\" / c / temp / temp.pdf\");"); //Set the javaAction to submitButton submitButton.Actions.MouseDown = javaAction; //Add the submit button to the new document. document.Form.Fields.Add(submitButton); fileName = attachment.FILE_NAME.ToString().Replace(Path.GetExtension(attachment.FILE_NAME.ToString()), ""); document.Save(@"C:\\DevelopmentMobile\\" + fileName + "_" + VZUserProfile.Instance.Username.ToString() + ".pdf"); System.Diagnostics.Process.Start(@"C:\\DevelopmentMobile\\" + fileName + "_" + VZUserProfile.Instance.Username.ToString() + ".pdf");