We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

saving a pdf file

Thread ID:





67104 Aug 8,2007 10:51 PM UTC Aug 9,2007 02:16 PM UTC WinForms 1
Tags: PDF
Wen Jiang
Asked On August 8, 2007 10:51 PM UTC

Syncfusion 4.4.

I have a pdfDocument and I want to save it as a pdf file. Here are my two questions:

1. Can I get the sample code to save the pdfDocument as a pdf file, and provide dialog for user to choose the path and name.

2. When I use the following code to save the file:

The report file is saved and opened, but the file has to be closed if I want to regenerate the report, otherwise the program will crash.

Thanks a lot for helping me out.


Melba Winshia [Syncfusion]
Replied On August 9, 2007 02:16 PM UTC

Hi Jane,

Thank you for your interest in Essential PDF.

Issue 1: (provide dialog for user to choose the path)

You can use SaveFileDialog class to provide dialog for user to choose the path and name.


SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "Files(*.pdf)|*.pdf";
saveFileDialog.AddExtension = true;
saveFileDialog.DefaultExt = ".pdf";

if (saveFileDialog.ShowDialog() == DialogResult.OK && saveFileDialog.CheckPathExists)
//Save the PDF Document to disk.

//Message box confirmation to view the created PDF document.
if (MessageBox.Show("Do you want to view the PDF file?", "PDF File Created",
MessageBoxButtons.YesNo, MessageBoxIcon.Information)
== DialogResult.Yes)
Process proc = new Process();
proc.StartInfo.FileName = saveFileDialog.FileName;

Please refer the (modified - if one is provided earlier) sample in the below link which illustrates the above.


Please try running the above sample and let me know if this helps.

Issue 2: (the file has to be closed)

You can close the document by using close method of PDFDocument.



//Close the document


Please let me know if you have any other questions.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon