У меня есть кнопка при нажатии, вставляет текст в поля формы в pdf и сохраняет заполненный pdf в каталог. Когда я закончу редактирование pdf, я хочу открыть pdf в браузере, но Process.Start() не работает. Есть ли лучший способ сразу же показать PDF-файл после его создания? Вот код кнопки:
protected void btnGenerateQuote_Click(object sender, EventArgs e)
{
string address = txtAddress.Text;
string company = txtCompany.Text;
string outputFilePath = @"C:\Quotes\Quote-" + company + "-.pdf";
PdfReader reader = null;
try
{
reader = new PdfReader(@"C:\Quotes\Quote_Template.pdf");
using (FileStream pdfOutputFile = new FileStream
(outputFilePath, FileMode.Create))
{
PdfStamper formFiller = null;
try
{
formFiller = new PdfStamper(reader, pdfOutputFile);
AcroFields quote_template = formFiller.AcroFields;
//Fill the form
quote_template.SetField("OldAddress", address);
//Flatten - make the text go directly onto the pdf
// and close the form.
//formFiller.FormFlattening = true;
}
finally
{
if (formFiller != null)
{
formFiller.Close();
}
}
}
}
finally
{
reader.Close();
}
//Process.Start(outputFilePath); // does not work
}