schedule-net , expoert topdf error

I am trying to implement a export-topdf, one page, server side code.
I have ALL my reference

using DHTMLX.Scheduler; using DHTMLX.Scheduler.Data; using DHTMLX.Common; using DHTMLX.Scheduler.Controls; using DHTMLX.Export.PDF;

And have included the

<script src="../../Scripts/dhtmlxScheduler_debug/ext/dhtmlxscheduler_pdf.js" type="text/javascript"></script>

I am sure that all is well linked and loaded,
Still, the following line in my .cshtml view

scheduler.toPDF(new Url("Export", "ProviderScheduler"), ExportColorScheme.Gray);

give me a toPdf not defined JS error !

Can someone please help, or provide a working sample of a mvc4 razor engine export-to-pdf in dhtmlxscheduler

regards

Hi,
usually you don’t need to include js sources manually. Instead of[code]

[/code]try using DHXScheduler.Extensions.Add(SchedulerExtensions.Extension.PDF);

Hello Aliaksandr,
thank you.
I moved now to adding afooter image and a header image.
I assumed that these should work by adding the code inot to generator object in the export function in the controller. As such[code]
public ActionResult Export()
{
SchedulerPDFWriter generator = new SchedulerPDFWriter();
var xml = this.Server.UrlDecode(this.Request.Form[“mycoolxmlbody”]);

        generator.setWatermark("Acme inc");
        generator.HeaderImgPath = "C:\\dev\\cpm\\Development\\cpm_web\\Content\\images\\icons\\helpdesk-Mobile.png";

        MemoryStream pdf = generator.Generate(xml);
        
        return File(pdf.ToArray(), generator.ContentType);
    }[/code]

But that does not seem to work !
How should I go by adding a header/footer in the genrated pdf when I am in shceduler.net MVC ?

regards

Hello,
currently like server-side scheduler doesn’t have config options to add header/footer to the rendered pdf, we’ll fix it on one of upcoming updates.
You can use client-side toPDF function, which allows such setting:
docs.dhtmlx.com/doku.php?id=dhtm … lient-side
js: scheduler.toPDF('url', 'gray', true);//gray color scheme, render header

Can you give us code snippet what exactly we need to do to enable client export pdf in MVC.Net? I mean all the content that need to go on MVC razor view. Not for aspx view.

The link you suggested to refer is for php but what if we are using MVC.Net. what we need to write for ‘url’. Because when i download asp.net pdf version it doesnt have generate.php.

Hello,
have you checked following example from dhtmlxScheduler.Net package?
Scheduler.MVC4\Views\ExportToPDF\index.cshtml

Export tool for .net contains example of controller(GeneratorController.cs), you can use it.

i have following code in my controller

using DHTMLX.Export.PDF;

//PDF export
scheduler.Extensions.Add(SchedulerExtensions.Extension.PDF);

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);
    }

and following in my razor view

<input type=“button” value=“PDF” class=“dhx_cal_today_button”
onclick="@Model.Scheduler.ToPDF(Url.Action(“Export”, “Calendar”), DHTMLX.Scheduler.ExportColorScheme.Color)" />

above all is pretty much what you suggested or written in documentation. But my question is how do I set header and footer image.

I tried following but its not working.
generator.HeaderImgPath
generator.FooterImgPath

Any help?

Hi,
header and footer must be enabled by configs that are currently not present in server side API.
Try specifying export call with a client side code
docs.dhtmlx.com/doku.php?id=dhtm … lient-side

It will look like following:

two questions

  1. when i set watermark, it only appearing on the month view export. Why its not showing on day/week view export?

generator.setWatermark(GlobalResources.FooterText);

  1. when I set full path it works but its not accepting relative path

generator.HeaderImgPath = “c:\fullpath\sample.png”;

generator.HeaderImgPath = Url.Content(@"~/content/images/sample.png");

also I renamed the header/footer image with name “header.png” and “footer.png” and put inside the “Scripts\dhtmlxScheduler\imgs” folder but its not showing anything.

I have set the header footer true in the view

Is there anyway to put any dynamic content in either header or footer?

say like,
Export Date time: xxx
Site #: xxx

Hello,

  1. watermark should be displayed in all views
  2. You need to specify filesystem path, not the URL.
    Following should work:
    generator.HeaderImgPath = Server.MapPath(@"~/content/images/sample.png");

Is there anyway to put any dynamic content in either header or footer?
I think ‘.SetWatermark’ is the only option here

And here is the latest version of the export tool(above functionality shouldn’t have been changed, but just in case)
s3.amazonaws.com/uploads.hipcha … 130408.zip