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

Free Support Forum - aspose.com

Display PDF in browser

Hi,
I have a PDF Form created using Adobe LiveCycle Designer. In the code I’m passing the stream of this form to the Form class for filling some of the fields. I want to show this filled form in the browser without saving the form in File system. Please let me know how to achieve this with a sample code.

Regards,
Ganesh

Hi Ganesh,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Please see the following sample code for reference to open a PDF Stream to Browser after filling the Form Fields. Please try it and let us know in case you face any problem.

// Create a FileStream object to read the imag file

FileStream fs = File.OpenRead(@"d:\AP Data\test2.pdf");

// Create a MemoryStream object

MemoryStream ms = new MemoryStream();

//open document

Aspose.Pdf.Facades.Form pdfForm = new Aspose.Pdf.Facades.Form(fs, ms);

//Fill the field "Name" with "Mike".

pdfForm.FillField("Name", "Mike");

pdfForm.Save();

fs.Close();

Response.Clear();

Response.ClearHeaders();

Response.ClearContent();

Response.Charset = "UTF-8";

Response.AddHeader("Content-Length", ms.Length.ToString());

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

Response.ContentType = "application/pdf";

Response.BinaryWrite(ms.ToArray());

Response.Flush();

Response.End();

Thank You & Best Regards,