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

Free Support Forum - aspose.com

Simple PDF for .NET example?

Hi all:

I am trying out PDF for .NET, and downloaded the examples but all inherit from each other and it's a bit of a mess. Can anyone tell me where I can find a simple example that, in a standalone ASPX page, creates a PDF file, adds content like tables, and then sends the file back to the user? So in the browser the file should either display, or the user should get an "open or save" prompt. I tried the very simple method shown below, but it did not work…

Thanks in advance for any and all help.

John.

using Aspose.Pdf;

protected void Button1_Click1(object sender, EventArgs e)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

{

//Create pdf document

Pdf pdf1 = new Pdf();

//Add a section into the pdf document

Aspose.Pdf.Section sec1 = pdf1.Sections.Add();

//Add a text paragraph into the section

sec1.Paragraphs.Add(new Text("Hello World"));

//Save the document

pdf1.Save("HelloWorld.pdf");

}

pdf1.Save(“HelloWorld.pdf”, SaveType.OpenInAcrobat, this.Response);

this.Response.End();

Hello John,

Thanks for considering Aspose.

As Jed have mentioned, you can use the public void Save(string,SaveType,HttpResponse); of Pdf class to display the resultant PDF in user browser.

I would also recommend you to visit the following link in order to have better understanding of Aspose.Pdf for .NET Document Object Model (DOM).

As per your query, you can also check the following link for information on how to start Working with Tables

In case it does not satisfy your requirements or you've any further query, please feel free to contact.