Export to PDF


Client side code sends actual content of scale to the export, where it converted to the pdf.
So technically it works as expected. We can fix export to prevent overflow, but it will not show the same formatting as in html anyway ( as it uses only text and ignores actual html styling )

Unfortunately I don’t see a simple solution how such complex scale can be exported ( we are providing full sources of export script - so you can tweek that code to change export logic in the necessary way )


OK, I will just trim the left 5 characters as this will be the easiest fix :slight_smile:

Thank you for the quick response as always.


Would you be able to point me to the line where the the time scale is manipulated in the PHP files. There is a lot of data in the PHP files and would be good to have a heads up.

Many thanks.


pdfWrapper.php, public function drawDayWeekHeader
scroll down a bit to “draws scales on left” comment


Just an update for others, this is what I have changed on line 607:

$this->cb->Cell($sizes->dayLeftWidth, $this->colHeight, substr($rowHeader[$i],0,5), 'TR', 1, 'C', 1);

Appears to work beautifully.



I have a timeline view like in the capture2.png file attached.
When i export to pdf, i obtain the result like in capture.png file

My problem is that events are not expanded to occupy all the height of a day. There is space between each event.
Is it normal ?
It could be better that there is no space between events.


you may configure timeline event height in pdfGenerator.php:

// timeline event height
public $timelineEventHeight = 4;


Is it possible to set an option to resize it automatically to fit the section height without space ?


no, there is no way to resize event height automatically.


Ok thanks for replying.

Maybe for future update :wink:


Now whenever I try and export to pdf I get the error:

Undefined offset: -1

Can you please help.

This is the error code generated in error_report file:




i have a problem to export my matrix view to pdf.
The pdf is not the same as my scheduler data.
Look at screenshots attached.

What can i do to obtain a good pdf for matrix view ?



A new problem with the export to pdf extension.

In week view, i have set an image in the header of events with this code from the documentation :

scheduler.templates.event_header=function(start,end,event){ return (event.important?"<img src='important.gif' />":"")+scheduler.templates.hour_scale(start); }

When i export to pdf, i can’t see the image in the header.

Other problem, if i place the html code for a space (the   code) in the event header, i see a diamond on the pdf


Feature Request for Export to PDF

Would it be possible to add some extra parameters to the toPDF function?

HeaderHeight, HeaderImageUrl, FooterHeight, FooterImageURL, Orientation, PaperSize

If any parameter was not supplied, then the existing default values would be used.

The Height and ImageUrl parameters would allow us to customise the headers and footers for the different views.

The Orientation parameter would allow us to use different orientations for different views. A Day View would look best produced in portrait orientation, but a timeline view would look best produced in landscape orientation.

Papersize could be either a single parameter where we could specify an ISO paper size extended to include American “letter” size, or Papersize could be 2 parameters PaperWidth and PaperHeight.


HI guys I am still having problem with export PDF
getting this error
SimpleXMLElement::__construct() [simplexmlelement.–construct]: Entity: line 1: parser error : Start tag expected, ‘<’ not found

and when I update genrat.php code and add urldecode($xmlstring) then calendar is exporting in .php file

can any one help me regarding it


its solved its actually in chrome its downloading the .php directly


one more query it is not supporting arabic lanaguage and export pdf giving the default color for calendar i need to same theme which I am using


No solutions for my problem ?


Hi cyrakuse.
Sorry for the delay in answerring.

Please, provide a complete demo to repeat an issue at local machine.

Unfortunately there is no way to print image in pdf.

It’s incorrect behavior. Please, provide debug.xml file or complete demo.


Hi manesh.
If you problem is still actual then please replace in file pdfGenerator.php line 206:

$event['week'] = (int) $ev->attributes()->week - 1;

with the follow:

$event['week'] = (int) $ev->attributes()->week;


btex, thanks for your feedback.
Orientation and page size is hardcoded, but you may change it yourself in file pdfWrapper:

$this->cb = new TCPDFExt('P', 'mm', 'A4', true, 'UTF-8', false);

‘P’ is a page orientation,
‘A4’ is a page format.
Here is a link to TCPDF documentation which described which values may be passed in this constructor:
tcpdf.org/doc/code/classTCPD … 0af78d8a00

mtalal16, you may configure scheduler colors as you like:
docs.dhtmlx.com/doku.php?id=dhtm … erver-side
arabic language must be exported correctly, but if it doesn’t work then you may provide us a complete demo.