DOCUMENT TO MEMORY EXAMPLE

The following .NET application has been developed using ABCpdf, ASP.NET, and the C# language.

This ABCpdf example saves a document to memory.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Text;
using System.Net;
using System.IO;
using WebSupergoo.ABCpdf8;

namespace ABCpdfExamples
{
    public partial class test : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // ---- Saves a document to memory ----

            Doc doc = new Doc();
            doc.FontSize = 96;
            doc.AddText("Hello World");
            byte[] theData = doc.GetData();
            Response.Clear();
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", 
            "inline; filename=Output.pdf");
            Response.AddHeader("content-length", 
            theData.Length.ToString());
            Response.BinaryWrite(theData);
            Response.End();
            doc.Clear();
        }
    }
}


© 1997-2018 codehacker.com - All Rights Reserved            RapidSSL