search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

"Printing Calendar" is not printable

Asked by Anonymous
12 years ago.
Hi, I'm using your product to print a calendar through the code provided on your website. I can export a calendar to an image, but if you do a print (or print preview) the image is not printed/visible. I'm using IE7 for this. protected void ButtonExport_Click(object sender, EventArgs e) { int hourHeight = DayPilotCalendar1.CellsPerHour * DayPilotCalendar1.CellHeight; Response.Clear(); Response.ContentType = "image/png"; MemoryStream img = DayPilotCalendar1.Export(ImageFormat.Png, 9 * hourHeight); img.WriteTo(Response.OutputStream); Response.End(); } Any solution to this problem? Kind regards, Koen
Comment posted by Dan Letecky
12 years ago.

IE has problems with processing the image returned from a PostBack.

See also:

The workaround is to add the following header to the response:

Response.AddHeader("Content-Disposition", "attachment;filename=print.png");

This will force an external handling of the image - that might be either download or opening in an image viewer, depending on user browser settings.

In Windows XP, Vista, and 7, there is a default image viewer installed. It can be opened directly from the browser and allows image printing.

See also:

Another option would be to redirect the user to a special printing page using a <a href="Print.aspx?yourParams">Print</a> link, or using Response.Redirect() call in the Button.Click handler. That page would use the printing code right in Page_Load().

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.