We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PdfContentEditor save

While using aspose.cell i try to save an excel file as a pdf and used the following format

excel.Save(HttpContext.Current.Response, “Xls2Pdf.pdf”, Aspose.Cells.ContentDisposition.Attachment, new XlsSaveOptions(Aspose.Cells.SaveFormat.Pdf));

I use to get an option on the browser “Do you want to save Xls2Pdf.pdf from the localhost?” which would let me open or save the file.

I need the save functionality on my aspose.pdf edited by the PdfContentEditor. But when i save it, it directly saves on the disk. How do i get the same functionlity as the excel save?

Hi Pooja,

Thanks for using our products.

PdfContentEditor does not have any save overload method which supports the feature to save the output in Response object. However in order to accomplish your requirement, you may save the updated document into Stream object and then parse these contents in user browser, as specified below.



// specify the duration of time before a page,cached on a browser expires

Response.Expires = 0;

// Specify the property to buffer the output page

Response.Buffer = true;

// Erase any buffered HTML output


//Add a new HTML header and value to the Response sent to the client

Response.AddHeader("content-disposition", "inline; filename=" + "output.pdf");

// Specify the HTTP content type for Response as Pdf

Response.ContentType = "application/pdf";

// Write specified information of current HTTP output to Byte array


// close the output stream


//end the processing of the current page to ensure that no other HTML content is sent


Besides this, you may consider using an approach where you can save the output of PdfContentEditor to stream object, instantiate a new Document object from Stream and then try using an overload save method of Document class to render the contents in browser.


PdfContentEditor editor = new


///.... some operation ....


MemoryStream ms = new System.IO.MemoryStream();


Document doc = new Document(ms);

doc.Save(HttpContext.Current.Response, "test.pdf", ContentDisposition.Attachment, new PdfSaveOptions());


Go it. Its working fine. Thank you.

Hi Pooja,

I am glad to hear that your requirement can be accomplished with earlier stated description. In the event of any further query, please feel free to contact.