Hello,
1) Can i export a PDF File with the colour selected? This is the UI of Scheduler,
For this single user scheduler, PDF is exporting with given Flat Azure Theme, Not with selected Colour. (Question 3 Code)
I'm assigning the colour for this default calendar from 'QueryCellInfo',
PDF is getting exported like this (Question 2 Image).
2) Can i change the cell height of this PDF Export File?
3) Can i recognise which view is selected in the Server side? Ex- An if condition, to check if its the month view?
Thank you
Hi Kavishka,
Q1: Can I export a PDF File with the color selected?
For a single-user Schedule. We suggest you use the resources property of the Schedule without groping with the user color as shown in the below code snippet.
[Default.aspx]
|
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<div> <ej:Schedule ID="Schedule2" StartHour="8" EndHour="18"> <resources> <ej:Resources Field="Owner" Name="Owner" Title="Users" AllowMultiple="true"> <resourcesettings color="color" id="id" text="text"> </resourcesettings> </ej:Resources> </resources> <appointmentsettings id="Id" resourcefields="UserId" subject="Subject" allday="AllDay" priority="Priority" starttime="StartTime" endtime="EndTime" description="Description" recurrence="Recurrence" recurrencerule="RecurrenceRule" starttimezone="StartTimeZone" endtimezone="EndTimeZone" /> </ej:Schedule> </div>
</asp:Content> |
[Default.aspx.cs]
|
protected void Page_Load(object sender, EventArgs e) { List<Resource> users = new List<Resource>(); users.Add(new Resource { text = "Kari Zook", id = "1", color = "#51d94a" });
Schedule2.Resources[0].ResourceSettings.DataSource = users; } |
Output:
Q2: Can I change the cell height of this PDF Export File?
Q3: Can I recognize which view is selected on the Server side? Ex- An if condition, to check if it's the month view?
No, it’s not feasible to change the height of the cell in the exported PDF. You can customize the cell height on PDF export before exporting as shown in the below code snippet. Yes, you can find the currently selected view is Month or not on the server side while exporting the PDF as shown in the below code snippet. With the below code snippet we have increased the cell height if the current view is Month.
[Default.aspx.cs]
|
protected void Schedule2_OnServerExportPDF(object sender, Syncfusion.JavaScript.Web.ScheduleEventArgs e) { ScheduleProperties scheduleObject = new SchedulePDFExport().ScheduleSerializeModel(e.Arguments["model"].ToString()); if(scheduleObject != null && scheduleObject.CurrentView == Syncfusion.JavaScript.CurrentView.Month) { scheduleObject.CellHeight = "120px"; } scheduleObject.BlockoutSettings.DataSource = (IEnumerable)new JavaScriptSerializer().Deserialize(e.Arguments["blockedApp"].ToString(), typeof(IEnumerable)); IEnumerable scheduleAppointments = (IEnumerable)new JavaScriptSerializer().Deserialize(e.Arguments["processedApp"].ToString(), typeof(IEnumerable)); PdfPageSettings pageSettings = new PdfPageSettings(50f) { Orientation = PdfPageOrientation.Landscape }; PdfDocument document = new PdfExport().Export(scheduleObject, scheduleAppointments, ExportTheme.FlatLime, Request.Form["locale"], pageSettings); document.Save("Schedule.pdf", Response, HttpReadType.Save); } |
Output:
Kindly try the shared sample and let us know if you need any further assistance on this.
Regards,
Ravikumar Venkatesan
If this post is helpful, kindly consider accepting it as the solution so that other members can locate it more quickly.