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

Free Support Forum - aspose.com

CONVERT a DOCX FILE TO PDF

Response.AddHeader("Content-Disposition", "attachment; filename=Result.docx");
 
Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
s.CopyTo(Response.OutputStream);
Response.End();

In the above code, i am exporting a word document. Is it possible to convert it into PDF and then export it?
I mean, before exporting the docx file, convert it into PDF and then export it?

@arun007

Yes, you can save the document to PDF and send it to client browser. Please use Document.Save(HttpResponse, String, ContentDisposition, SaveOptions) method to send the document to the client browser.

We suggest you please read following article.

Sorry, i am not able to understand how to use it for my code. Can you just write it for my code?
I have all my data in stream variable “s” [return type is doc.getStream()].

@arun007

If you are using .NET Standard, saving document to user browser is not provided, i.e. Document.Save(HttpResponse,string,ContentDescription,SaveOptions) overload is not available. Please read more detail from here:

In this case, you need to save the document to stream and send it to disk via .NET code as suggested here:


If you are using .NET Framework, you can use Document.Save(HttpResponse,string,ContentDescription,SaveOptions) method.

@arun007 It is not quite clear how you generate the document. Aspose.Words.Document class does not have method getStream(). Could you please provide a simple code you use to create a document and get it’s stream? We will check your code and provide you more information. Also, please, specify which version of Aspose.Words API do you use.