Link Search Menu Expand Document

Getting Started in ASP.NET

The following sample demonstrates how to convert PDF to PNG in ASP.NET using PDF Renderer SDK

<legacyBold xmlns="">Default.aspx:</legacyBold>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="BasicExample._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">


        <legacyBold xmlns="">Default.aspx.cs:</legacyBold>
using System;
using System.Web.UI;
using Bytescout.PDFRenderer;

namespace BasicExample
    public partial class _Default : Page
        protected void Page_Load(object sender, EventArgs e)
            // Prepare a test document.
            // Multipage.pdf file will be copied to the project directory on the pre-build event (see the project properties).
            String inputDocument = Server.MapPath("multipage.pdf");

            // Create an instance of Bytescout.PDFRenderer.RasterRenderer object and register it.
            RasterRenderer renderer = new RasterRenderer();
            renderer.RegistrationName = "demo";
            renderer.RegistrationKey = "demo";

            // Load PDF document.

            // Prepare response.
            Response.ContentType = "image/png";
            Response.AddHeader("Content-Disposition", "inline;filename=result.png");

            // Render first page of the document to the output stream.
            renderer.RenderPageToStream(0, RasterOutputFormat.PNG, Response.OutputStream);