DayPilot Month control supports PNG/JPG/GIF export (and printing, indirectly).

month export 405x257

It is possible to export the control to several image formats:

  • BMP
  • GIF
  • JPEG
  • PNG
  • TIFF

Usage

Call DayPilotMonth.Export() method:

MemoryStream img = DayPilotMonth1.Export(ImageFormat.Png);

Applications

  • Print the exported image reliably.
  • Save the exported image to a file.
  • Non-web applications:
    • Show a read-only calendar in WebForm applications
    • Include a Month snapshot in PDF files generated on the server
    • Include a Month snapshot in generated e-mails

Limitations

Some limitations apply:

  • The related CSS classes are ignored (CssClassPrefix)
  • It's not possible to use HTML in Before*Render events. You can detect the export by checking DayPilotMonth.IsExport property and set e.InnerHTML to plain text during export.

Example

This example returns the current Month view as PNG image (it forces the Open/Download dialog box by setting "content-disposition" HTTP header).

protected void ButtonExport_Click(object sender, EventArgs e)
{
  setDataSourceAndBind();
 
  Response.Clear();
  Response.ContentType = "image/png";
  Response.AddHeader("content-disposition", "attachment;filename=print.png");
  MemoryStream img = DayPilotMonth1.Export(ImageFormat.Png);
  img.WriteTo(Response.OutputStream);
  Response.End();
}

Demo

See Also