Archive Browser
Download GhostScriptWebTest.zip, last updated 10/07/2012 (468.50 KB)
Download- md5: 0b163c5c6596db5940457e81286ce656
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Web;
using Cyotek.GhostScript.PdfConversion;
namespace GhostScriptWebTest
{
public class PdfImage : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string fileName;
int pageNumber;
Pdf2Image convertor;
Bitmap image;
fileName = context.Server.MapPath("~/" + context.Request.QueryString["fileName"]);
pageNumber = Convert.ToInt32(context.Request.QueryString["page"]);
// convert the image
convertor = new Pdf2Image(fileName);
image = convertor.GetImage(pageNumber);
// set the content type
context.Response.ContentType = "image/png";
// save the image directly to the response stream
image.Save(context.Response.OutputStream, ImageFormat.Png);
}
public bool IsReusable
{ get { return true; } }
}
}
Donate
This software may be used free of charge, but as with all free software there are costs involved to develop and maintain.
If this site or its services have saved you time, please consider a donation to help with running costs and timely updates.
Donate