The scheduler is printed using a simple aspx page. The print page contains:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Print.aspx.cs" Inherits="_Print" MasterPageFile="~/Site.master" Title="Event Calendar with Day/Week/Month Views" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script> <link href='css/main.css' type="text/css" rel="stylesheet" /> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2>Print</h2> <div> <asp:Image runat="server" ID="ImageScheduler" /> </div> <script type="text/javascript"> window.print(); </script> </asp:Content>
Include the scheduler image using <asp:Image> control.
<asp:Image runat="server" ID="ImageScheduler" />
Set the image URL in the code behind:
C#
protected void Page_Load(object sender, EventArgs e) { DateTime start = Convert.ToDateTime(Request.QueryString["start"]); int scrollX = Convert.ToInt32(Request.QueryString["scrollx"]); int scrollY = Convert.ToInt32(Request.QueryString["scrolly"]); ImageScheduler.ImageUrl = "Png.aspx?start=" + start.ToString("s") + "&scrollx=" + scrollX + "&scrolly=" + scrollY; }
VB
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Dim start As Date = Convert.ToDateTime(Request.QueryString("start")) Dim scrollX As Integer = Convert.ToInt32(Request.QueryString("scrollx")) Dim scrollY As Integer = Convert.ToInt32(Request.QueryString("scrolly")) ImageScheduler.ImageUrl = "Png.aspx?start=" & start.ToString("s") & "&scrollx=" & scrollX & "&scrolly=" & scrollY End Sub
You can invoke the browser print dialog using window.print() JavaScript method.
The sample project (Visual Studio 2012) including VB.NET and C# source code is available for download.