We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Export to PDF for Schedule Control, that has 100 resources is unreadable

Thread ID:

Created:

Updated:

Platform:

Replies:

131844 Jul 30,2017 10:31 PM Sep 6,2017 08:12 AM ASP.NET Core 8
loading
Tags: Schedule
Brendan Green
Asked On July 30, 2017 10:31 PM

I am setting up a Schedule control to show planned leave for resources for a business.

As we have quite a large number of resources, we page 100 resources at a time (otherwise the browser will lockup).

This works very well, and is performs well in the browser.  An example of our output is here:



Using the example code to export this now to a PDF document, the controller action looks like this (based on samples): 

[HttpPost]
        public void SchedulePdfExport(string scheduleModel)
        {
            try
            {
                PdfExport exp = new PdfExport();
                PdfPageSettings ps = new PdfPageSettings(50f)
                {
                    Orientation = PdfPageOrientation.Landscape
                };

                JavaScriptSerializer serializer = new JavaScriptSerializer();
                SchedulePDFExport convert = new SchedulePDFExport();
                // Here calling the public method to convert the model values to ScheduleProperties type from string type
                ScheduleProperties scheduleObject = convert.ScheduleSerializeModel(scheduleModel);
                // Here converting the schedule appointments data into enumerable object by deserializing              
                IEnumerable scheduleAppointments = (IEnumerable)serializer.Deserialize(Request.Form["ScheduleProcesedApps"], typeof(IEnumerable));
                // Here passing the theme values from enum collection

                PdfDocument document = exp.Export(scheduleObject, scheduleAppointments, ExportTheme.FlatAzure, Request.Form["locale"], ps);
                document.Save("PlannedLeave.pdf", HttpContext.ApplicationInstance.Response, HttpReadType.Save);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

The resultant PDF looks like this:



My question is this: I presume that it's trying to drop all 100 resources onto a single page?  If so, is there a way to get this to export to multiple pages?

If not, what other workarounds / methods should we look at using?  I could always change the page size to something really small (say 20), but then we'd have to export 5 pdfs to get the same result.

Cheers,
Brendan


Karthigeyan Krishnamurthi [Syncfusion]
Replied On July 31, 2017 07:35 AM

Hi Brendan, 
 
Thank you for contacting Syncfusion support. 
 
The known issue “Scheduler is not exporting correctly with many resources” is fixed in our latest version 15.2.0.46 and kindly upgrade your build version to avail the fix. We have attached the below exported PDF where Scheduler has more number of resources for your reference.  
 
Regards, 
Karthigeyan 



                                                                                      



Brendan Green
Replied On August 29, 2017 01:27 AM

Thanks Karthigeyan - I've made the update, and the export is now mostly working.

Ok while the chart export is working well, I am noticing an additional issue.  Please see the following screenshot:

To the left, we have the schedule control rendered on the webpage.

To the right, we have the exported PDF

I am seeing that with multiple pages, the output starts to get out of alignment with the resource.

To illustrate:

  • Highlight #1 - resource DWYER is the last resource on Page 3 of the PDF.  Their schedule matches the web control, so this is CORRECT.
  • Highlight #2 - resource EBBETT should be the first resource on Page 4 of the PDF.  While that is the case, you'll see that his appointment on the 6th March is missing from the PDF.  In fact, his 6th March appointment looks to be floating at Highlight #3
  • Continuing on it appears that further appointment detail for each resource is coming from the resource below (e.g. an off by one error)
How do we ensure that the PDF export matches the web control properly?

Update: my other issue is that the appointment colouring that we've setup in the web view (each appointment subject type has a set color) is not carried over to the PDF?


Karthigeyan Krishnamurthi [Syncfusion]
Replied On August 29, 2017 01:35 PM

Hi Brendan, 
 
Thanks for your update. 
 
We have checked the reported scenario at our end and the appointments are exporting correctly. We have prepared the sample for your reference which can be download from the below location. 
 
Kindly try the sample and if the issue persists, try to reproduce the error in a sample and revert it back to us. Or else share the script version used, code example/runnable sample (if possible) to proceed further 

Regards, 
Karthigeyan 


Brendan Green
Replied On September 3, 2017 08:50 PM

Ok I tested out your sample, and it is still doing the same thing.

The difference is that I want to apply the colouring to the appointments via the subject, not the resource.

I am altering your sample to demonstrate the issue, and will post an update.

Also, your export function is still leaving some appointments hanging off the bottom of each page, and all subsequent resources are then out of alignment.


Brendan Green
Replied On September 3, 2017 10:26 PM

Hi Karthigeyan,

I have updated your sample to show the issue.

I have altered the data model to use my internal model, and updated the schedule control to perform the categorization:

@(Html.EJ().Schedule("ProjectsSchedule")

      .Width("100%")

      .Height("580px")

      .Orientation(Orientation.Horizontal)

      .CurrentDate(new DateTime(2017, 07, 1))

      .CurrentView(CurrentView.Month)

      .ShowLocationField(true)

      .ShowOverflowButton(false)

      .ReadOnly(true)

      .Resources(res =>

      {


          res.Field("OwnerId").Title("Owner").Name("Owners").AllowMultiple(true)

              .ResourceSettings(flds => flds.Datasource((System.Collections.IEnumerable)ViewBag.Sched.Owners).Text("Text").Id("Id").Color("Color")).Add();

      })

      .CategorizeSettings(fields => fields.Datasource(ViewBag.Sched.Categories).Enable(true).AllowMultiple(true).Id("Id").Color("Color").FontColor("FontColor"))

      .Group(gr =>

      {

          gr.Resources(Group);

      })

      .AppointmentSettings(appt => appt.Datasource(ViewBag.Sched.Items)

          .Id("Id")

          .Subject("Subject")

          .StartTime("StartTime")

          .EndTime("EndTime")

          .AllDay("AllDay")

          .Categorize("Subject")

          .Recurrence("Recurrence")

          .RecurrenceRule("RecurrenceRule")

          .ResourceFields("OwnerId"))

      )

I've populated about 200 odd owners, and added some appointments to them for sample data.

Here's a screenshot of the two different outputs:


On the left, the web view is rendering the appointments correctly, and the colouring is correct as per the categorization that has been setup.

On the right, the PDF is rendering the appointments with the WRONG color.  It's picking up the owener resource colour, instead of the categorization colours.  The expectation is that all the A, S and PH appointments are the same colour.

Additionally, if I scroll down to page three of the PDF:


We have appointments that are floating below a resource - i.e they are not aligned with anyone.

We can see that everything is way out of alignment by going to the last page, which shows this: