PlexityHide

Home 

Products 

Downloads 

Our Shop 

Support 

Contact 


GTP.NET FAQ 11340


Printing from a web page Please note that this article refers to the GTP.NET
Jump to article- 2008-10-11 10:17:00 - Email plexityHide

Question

I want to print the gantt shown on a webpage.

Answer

You will need to perform the rending server side. The general idea is the same as explained in this article http://www.plexityhide.com/faqs_gen_GTPNET/10374.htm.

To be more precise this is how it is done if you want the result to returned as jpeg:

     protected void LinkButton1_Click(object sender, EventArgs e)
    {
        Bitmap bm = new Bitmap(Gantt_ASP1.Gantt.Width, 300 + Gantt_ASP1.Gantt.DateScalerHeight);
        Graphics g = Graphics.FromImage(bm);
        Rectangle r = Rectangle.FromLTRB(0, 0, Gantt_ASP1.Gantt.Width, 300 + Gantt_ASP1.Gantt.DateScalerHeight);
        g.FillRectangle(Brushes.White, r);
        bool hasMorePages = false;

        Gantt_ASP1.Gantt.PrintInit(null);
        Gantt_ASP1.Gantt.PrintPage(g, r, Gantt_ASP1.Gantt.GridWidth + 10, Gantt_ASP1.Gantt.DateScalerHeight, ref hasMorePages);
        Gantt_ASP1.Gantt.PrintEnd();

        Response.Clear();
        Response.ContentType = "image/jpeg";
        Response.AddHeader("Content-Disposition", "attachment; filename=GanttASP.jpeg");
        bm.Save(Response.OutputStream, ImageFormat.Jpeg);
        Response.End();
        bm.Dispose();
        g.Dispose();
    }

If you want to to pdf or something like that, the basic principle applies, but you will need an additional tool to render the pdf.

 

Google
WWW plexityHide GTP.NET FAQ
Support

Support intro

Knowledgebase

FAQ phGantTimePackage

FAQ GTP.NET

FAQ GTP.NET.SL and WPF

FAQ general

Testimonials

"This is too GREAT. I must say you have strong support and really good programmers at your place. Your entire team is good. Just Fantastic! – 100%"
Gaurav Patole,
WebTechDevelopers
More testimonials...




class="blk">PlexityHide.com
Grastensvagen 24, S-163 45 Spanga Sweden
E-mail: support@plexityhide.com