Download the PDF

When you click the button below, the PDF will download to your computer. This is just one way you can use the PDF, for example you could email it to a customer, display it in the browser, or save it to a file for later use.

 


Example Code

The code (without error handling) that will download the PDF to your computer is:

// theDoc references the current PDF document object byte[] theData = theDoc.GetData(); // Get the PDF data Response.ClearHeaders(); Response.ClearContent(); Response.Expires = -1000; Response.ContentType = "application/pdf"; Response.AddHeader("content-length", theData.Length.ToString()); Response.AddHeader("content-disposition", "attachment; filename=ExampleSite.pdf"); // Send the PDF as an attachment, ie. download Response.BinaryWrite(theData); HttpContext.Current.ApplicationInstance.CompleteRequest();