How to save the Edited PDF without opening the Save As Dialog box in WinForms c#

22 Views Asked by At

I am developing windows application that allows user to edit the PDF using HtmlDocument option.

After editing while clicking save button I don't want to save the file via Save as Dailog window. I want to save to some specific folder

Below the code I tried

System.IO.File.Copy(FormPath, TempFormPath, true);

PdfReader pdfReader = new PdfReader(FormPath);

pdfStamper = new PdfStamper(pdfReader, new FileStream(TempFormPath, FileMode.Create));

AcroFields pdfFormFields = pdfStamper.AcroFields;

pdfFormFields.SetField("text_1yxrc", caseId.Text);

pdfFormFields.SetField("text_2xuej", dateTimePicker1.Text);

pdfStamper.FormFlattening = false;

pdfStamper.Close();

webBrowser1.Url = new Uri(TempFormPath);

Once this code got executed I will get the PDF in browser. There I can edit the PDF.

0

There are 0 best solutions below