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. Image for the cookie policy date

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

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


8 Replies

KK Karthigeyan Krishnamurthi Syncfusion Team July 31, 2017 11:35 AM UTC

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 



                                                                                      




BG Brendan Green August 29, 2017 05:27 AM UTC

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?



KK Karthigeyan Krishnamurthi Syncfusion Team August 29, 2017 05:35 PM UTC

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 



BG Brendan Green September 4, 2017 12:50 AM UTC

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.



BG Brendan Green September 4, 2017 02:26 AM UTC

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:


ALL resource owners should have the same appointments, but the last 5 owners have nothing showing (they DO have appointments in the web view).

Desperately trying to get the PDF to render the same as the web view.


Attachment: SampleUpdatedToShowIssues_b6c022ca.zip


KK Karthigeyan Krishnamurthi Syncfusion Team September 4, 2017 12:54 PM UTC

Hi Brendan, 
 
Thanks for your update. 
 
In the provided sample, no separate category field is maintained in appointment collection which is the cause for the issue “Category color is reflecting in pdf”, we have modified the sample which can be download from the below location. 
 
<Code> 
.AppointmentSettings(appt => appt.Datasource(ViewBag.Sched.Items) 
    .Id("Id") 
    .Subject("Subject") 
    .StartTime("StartTime") 
    .EndTime("EndTime") 
    .AllDay("AllDay") 
    .Categorize("CategId") 
    .Recurrence("Recurrence") 
    .RecurrenceRule("RecurrenceRule") 
    .ResourceFields("OwnerId")) 
 
items.Add(new ScheduleItem 
{ 
    Id = id++, 
    Subject = "A", 
    StartTime = new DateTime(2017, 07, 10, 8,0,0), 
    EndTime = new DateTime(2017, 07, 10, 17,0,0), 
    AllDay = true, 
    OwnerId = o.Id, 
    CategId = "A" 
}); 
</Code> 
 
We have created an incident for your appointment exporting query and we request you to have a follow up with the below incident link for further update on this. 
 
 
Regards, 
Karthigeyan 




BG Brendan Green September 5, 2017 04:35 AM UTC

Hi Karthigeyan,

Just confirming that the appointment colourisation via categories is now working as expected in the PDF output.

I look forward to the bug fix for the multi-page export on the 8th.

Cheers,

Brendan



KK Karthigeyan Krishnamurthi Syncfusion Team September 6, 2017 12:12 PM UTC

Hi Brendan, 
 
We are happy to hear the categorize issue is resolved at your end. 
 
Kindly have a follow-up the incident link provided in our previous update for further details regarding appointment exporting query. 
 
Regards, 
Karthigeyan 



Loader.
Live Chat Icon For mobile
Up arrow icon