|
using System;
using System.Collections.Specialized;
using System.Web;
using Cyotek.GhostScript.PdfConversion;
namespace GhostScriptWebTest
{
public partial class _Default : System.Web.UI.Page
{
protected void previousLinkButton_Click(object sender, EventArgs e)
{
this.IncrementPage(-1);
}
protected void nextLinkButton_Click(object sender, EventArgs e)
{
this.IncrementPage(1);
}
private void IncrementPage(int increment)
{
NameValueCollection queryString;
int pageNumber;
string pdfFileName;
Pdf2Image converter;
queryString = HttpUtility.ParseQueryString(pdfImage.ImageUrl.Substring(pdfImage.ImageUrl.IndexOf("?")));
pdfFileName = queryString["fileName"];
pageNumber = Convert.ToInt32(queryString["page"]) + increment;
converter = new Pdf2Image(this.Server.MapPath("~/" + pdfFileName));
if (pageNumber > 0 && pageNumber <= converter.PageCount)
pdfImage.ImageUrl = string.Format("~/PdfImage.ashx?fileName={0}&page={1}", pdfFileName, pageNumber);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.