Pdf monthly problem

Hi!
I have a problem with the monthly view in a Scheduler when I do the scheduler.toPDF with fullcolor. I’ve seen the events that begin and end the same day prints without background color! If I change the event and sets the end date tomorrow the event shows successfully with the background color.

Why is this happening? Is this normal? how I can fix it?

Thanks!

Sorry for my bad english…I’m spanish :unamused:

Normally, events exported in the same manner as they are in the html scheduler, by default non-multi-day events in the month view doesn’t have background color ( to separate them from multi-day events )

If you have custom colors defined in data and visible in html view, but not visible in export data - please provide a demo link or some kind of sample where it can be reconstructed.

This is the code of the scheduler, I can’t provide you a demo link because I’m working in a local workspace, sorry.

<a class='imprimir' href="javascript:void()" onclick="scheduler.toPDF('http://<?= $_SERVER['HTTP_HOST'] ?>/dhtmlxScheduler/server/generate.php','fullcolor')"><?= 'Imprimir' ?></a>
<div id="scheduler_here" class="dhx_cal_container" style='width:935px;height:480px;'>
  <div class="dhx_cal_navline">
    <div class="dhx_cal_prev_button">&nbsp;</div>
    <div class="dhx_cal_next_button">&nbsp;</div>
    <div class="dhx_cal_today_button"></div>
    <div class="dhx_cal_date"></div>
    <div style="right:412px;"><input type="button" id="add_event" value="<?= Nou esdeveniment ?>" /></div>
    <!--<div class="dhx_cal_tab" name="unit_tab" style="width:62px;right:280px;"></div>-->
    <div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
    <div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
    <div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
  </div>
  <div class="dhx_cal_header"></div>
  <div class="dhx_cal_data"></div>
</div>

<script type="text/javascript">

  scheduler.config.details_on_dblclick = false;
  scheduler.config.dblclick_create = false;
  scheduler.config.drag_move = false;
  scheduler.config.drag_resize = false;

  scheduler.config.xml_date="%Y-%m-%d %H:%i:%s";

  scheduler.config.multi_day = true;

  scheduler.config.icons_select=["icon_details"];

  scheduler.templates.event_class=function(start,end,event){
  	  if(event.docent_id != null)
  	  	return "docent"+event.docent_id;
  	  else
  	  	return "admin"+event.sf_guard_user_id;
  }

  scheduler.attachEvent("onBeforeLightbox", function (event_id){
	var ev = scheduler.getEvent(event_id);
	var user_id = <?= $sf_user->getAttribute('admin')->getId() ?>;

  	if(user_id == ev.sf_guard_user_id) {
		window.location="<?= url_for('calendari/detall') ?>?id="+event_id+"&back=calendari";
  	} else {
  		window.location="<?= url_for('calendari/detall') ?>?id="+event_id+"&accio=consulta&back=calendari";
  	}
	return false;
  });

  scheduler.attachEvent("onDblClick", function (event_id, native_event_object){
  	var ev = scheduler.getEvent(event_id);
  	var user_id = <?= $sf_user->getAttribute('admin')->getId() ?>;

  	if(user_id == ev.sf_guard_user_id) {
		window.location="<?= url_for('calendari/detall') ?>?id="+event_id+"&back=calendari";
  	} else {
  		window.location="<?= url_for('calendari/detall') ?>?id="+event_id+"&accio=consulta&back=calendari";
  	}
	return false;
  });

  var add_event_btn = document.getElementById('add_event');
  add_event_btn.onclick = function() {
    window.location="<?= url_for('calendari/detall') ?>";
  }

  scheduler.config.first_hour = 0;
  scheduler.config.show_loading = true;

  scheduler.templates.event_bar_text=function(start,end,event){
        return "<span title='"+event.titol+"'>"+event.text+"</span>";
  }

  var fecha=new Date();
  <? if($sf_params->get('data')) {
  		list($dia,$mes,$any) = explode("-",$sf_params->get('data'));
  		$mes = trim($mes,"0");
  		$mes = (int)$mes-1; ?>
  		scheduler.init('scheduler_here',new Date(<?= $any ?>,<?= $mes ?>,<?= $dia ?>),"week");
  <? } else { ?>
		scheduler.init('scheduler_here',new Date(fecha.getFullYear(),fecha.getMonth(),fecha.getDate()),"week");
  <? } ?>

  scheduler.setLoadMode("month");
  scheduler.load("<?= url_for('calendari/seleccionarEvents') ?>"+"?id="+scheduler.uid(),"json");

</script>

The styles css:

echo "<style type='text/css'>";
    	foreach($sf_request->getAttribute('admins') as $usuari){
    		$color_usuari = $usuari->getSfGuardUserProfile()->getFirst()->getColorCalendari();
		$color = ($color_usuari) ? $color_usuari : '#FFE763';
	    	echo ".admin".$usuari->getId()." {";
	    		echo "background-color:".$color." !important;\n";
	    		echo "background-image:none;\n";
	    	echo "}\n";
	    	echo ".dhx_cal_event.admin".$usuari->getId()." div {";
	    		echo "background-color:".$color." !important;\n";
	    		echo "background-image:none;\n";
	    	echo "}\n";
    	}
  	foreach($sf_request->getAttribute('tutors') as $tutor){
		echo ".docent".$tutor->getId()." {";
		$color = ($tutor->getColorCalendari()) ? $tutor->getColorCalendari() : '#FFE763';
			echo "border:1px solid #B7A543;\n";
			echo "background-color:".$color." !important;\n";
			echo "background-image:none;}\n";
		echo ".dhx_cal_event.docent".$tutor->getId()." div {";
			echo "background-color:".$color." !important;\n";
			echo "background-image:none;}\n";
	}
	echo "</style>";

In html looks with corresponding color of css, but in a printing month view doesn’t show the background.
Thanks!

Attached two screenshots with the problem.




Hi,
please, update export script from attachment to fix event background color.
scheduler-pdf-php.zip (630 KB)

Perfect! Thanks a lot radyno!!