asp.net scheduler png export

JavaScript

Not supported yet.

ASP.NET WebForms

It is possible to export the Scheduler into several image formats:

  • BMP
  • GIF
  • JPEG
  • PNG
  • TIFF

See also scheduler PDF export.

Usage

Call DayPilotScheduler.Export() method:

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

You can also get the scheduler image as Bitmap object for further processing (inserting into a PDF file, merging with other images, writing to the image):

Bitmap bmp= DayPilotScheduler1.ExportBitmap();

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 Scheduler snapshot in PDF files generated on the server
    • Include a Scheduler snapshot in generated e-mails

Default styles

Since DayPilot Pro 7.7 the CssOnly mode is enabled by default. In order to apply the new default styles to the exported image please call LoadStylesDefaultTheme() before export.

DayPilotScheduler1.LoadStylesDefaultTheme();
// ...
Bitmap bmp = DayPilotScheduler1.ExportBitmap();

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 DayPilotScheduler.IsExport property and set e.InnerHTML to plain text during export.

Example

This example returns the current Scheduler 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 = DayPilotScheduler1.Export(ImageFormat.Png);
  img.WriteTo(Response.OutputStream);
  Response.End();
}

See Also

scheduler 100pc cut

The full width of the image exported from the Scheduler is calculated automatically if you use Width="100%".

ASP.NET MVC

Not supported yet.

Java

Not supported yet.