summaryrefslogtreecommitdiffstats
path: root/README.md
blob: 65aee711ef1911391f6f20b55d72d7215f9ecd31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
dhtmlxScheduler v4.x to PDF print tool for .NET
----------------------------------------------------------

This project can be used to print dhtmlxScheduler to PDF using legacy export extension 

Docs :

  - http://docs.dhtmlx.com/scheduler/pdf_v4.html

Demo:

  - http://docs.dhtmlx.com/scheduler/samples/04_export/05_standalone_export.html

### Disclaimer
This version of the export tool won't be actively developed. We encourage you to use the new version of the export tool instead: 

 - https://dhtmlx.com/docs/products/dhtmlxGantt/export.shtml
 - http://docs.dhtmlx.com/scheduler/pdf.html


### Usage

- Add DHTMLX.Export.PDF project to the solution. 
- Add reference to it from your web project and create a backend handler.
- Call the handler using client side extension of dhtmlxScheduler http://docs.dhtmlx.com/scheduler/pdf_v4.html#triggeringtheexport

### Sample backend implementation 

#### ASP.NET WebForms

~~~cs
//Generate.ashx

using System.Web;
using DHTMLX.Export.PDF;
using System.Web.Configuration;

public class Generate : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {           
        PagesSection pageSection = new PagesSection();
        pageSection.ValidateRequest = false;

        var generator = new SchedulerPDFWriter();
        var xml = context.Server.UrlDecode(context.Request.Form["mycoolxmlbody"]);
        generator.Generate(xml, context.Response);
    }

    public bool IsReusable { get { return false; } }
}
~~~

#### ASP.NET MVC

~~~cs
using System.IO;
using System.Web;
using System.Web.Mvc;
using DHTMLX.Export.PDF;

namespace scheduler2pdf.Controllers
{
    [HandleError]
    public class GeneratorController : Controller
    {
        [ValidateInput(false)]
        public ActionResult Export()
        {
            var generator = new SchedulerPDFWriter();
            var xml = this.Server.UrlDecode(this.Request.Form["mycoolxmlbody"]);           
            MemoryStream pdf = generator.Generate(xml);         
            return File(pdf.ToArray(), generator.ContentType);            
        }
    }
}

~~~

### License

Distributed under the MIT software license  
Copyright (c) 2017 Dinamenta UAB