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

Free Support Forum - aspose.com

Display PDF to browser without first saving to file

I wonder is it possible to open as a PDF using just the Aspose.Word dll? I know I can save it as a PDF. I am currently evaluating that product and it does 95% of what I want. If I can’t display as a PDF without using Aspose.PDF, I may just be able to use the print preview functionality instead.

Hi,


Thanks for your request.

The latest version of Aspose.Pdf supports converting PDF documents to DOC format. So you can use Aspose.Pdf to convert your PDFs to DOC and then use Aspose.Words to insert the generated DOC field into another Word document.


Ok, that isn’t really what I was asking. Let me be more clear. The Aspose.Words dll does most of what I need it to. After I finish some operations on a Word document, I would like to display the document as a PDF. Is that possible using the Words dll or do I also need the PDF? I do not want to save anything to disk, but would like to open the document as a PDF. Is this possible?

Hi


Thanks for your details. Yes, you can convert Word document to Pdf and display it in Client Browser.


var resp = System.Web.HttpContext.Current.Response;<o:p></o:p>

// Create source
document.
<o:p></o:p>

Document doc = new Document();

// Process data.....


// Create Memory Stream Object

MemoryStream stream = new MemoryStream();

doc.Save(stream, SaveFormat.Pdf);

doc.Save(resp, "Aspose.Words.Demo.Pdf", ContentDisposition.Inline, SaveOptions.CreateSaveOptions(SaveFormat.Pdf));

resp.End();


Note:

The .NET client profile excludes the System.Web assembly and therefore the HttpResponse is not available. This means that particular save overlod is not avalible. This is entirely by design. If you need to use Aspose.Words in ASP.NET application, I would recommend you use .NET 2.0 Client Profile and the following overload of Save method.


Hope this will help.


Thank you for your quick response. I am indeed using the .NET client profile. Does that mean it is not possible in an application other than ASP.NET?

Hi


Thanks for your details. Basically, i recommended you to use .NET framework 2.0 client profile rather than 3.0, 3.5 and 4.0 etc. For More details, please follow up the thread:

http://www.aspose.com/community/forums/356367/aspose.words-demo/showthread.aspx#356367


Moreover, if you are facing any problem other than ASP.NET, please share scenario along with findings.

This is NOT an ASP.NET application. I need a solution for a regular windows, non-web based .NET application.

Hi

Thank you for additional information. It is impossible to open PDF document without saving it on disk. Even when you open PDF from web in browser, the PDF document is first saved on disk in a temporary folder and then opened by the PDF plug-in in your browser.

Best regards,