Printing capabilities. Part 3. Grid-to-PDF Improvements.

| Comments (19)

UPD: Download the most recent Grid-to-PDF packages for PHP, ASP.NET, and Java here.

As we were developing printing functionality for dhtmlxScheduler, it made sense to incorporate all the new advantages into the existing Grid-to-PDF service, so here we go with Grid-to-PDF v0.2.

The new version of the Grid-to-PDF solution supports Unicode, which means that printing functionality will work for the majority of languages. Other new features include:

  • Support for multiline text
  • Support for complex headers in grid
  • Support for images (column type “img”)

With the updated Grid-to-PDF service, even tables with a complex structure like this:

Grid-to-PDF. HTML page.

Grid-to-PDF. HTML page.

…can be exported to the PDF format, which will look like:

Grid-to-PDF. PDF document.

Grid-to-PDF. PDF document.

Now to the practical part. To try the new Grid-to-PDF service, download the new version here. Installation of Grid-to-PDF v0.2 is the same as for the previous version. You’ll find two folders in the downloaded package:

./server – put this folder on the server (PHP 5.x required).
./client – copy files from this folder to the codebase of the grid.

Add extra script on the page:

<script src=”./codebase/dhtmlxgrid_export.js”>

And use the toPDF command on the page as:

grid.toPDF (“”);

You’ll find the detailed settings of the printing service (colors, sizes, fonts, etc.) in the documentation.


  1. Harsh Choudhary April 28, 2010 at 9:43 am

    Hi I am getting following message output to the browser while trying to run the sample provided in Export to PDF grid_text.html. Please help

    Warning: date() []: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/New_York’ for ‘-4.0/DST’ instead in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\server\generate.php on line 27

  2. Harsh Choudhary April 28, 2010 at 9:44 am

    I am running PHP 5.3.2 on apache.

    • ivan April 30, 2010 at 2:18 pm

      You need to configure your php installation correctly, just add a line similar to the next in the php.ini of your server:
      date.timezone = America/New_York

  3. Harsh Choudhary April 30, 2010 at 8:09 pm

    its already added , please see below

    ;date.timezone =America/New_York

    • ivan May 4, 2010 at 1:48 pm

      Harsh, we couldn’t reproduce this problem. Please open a support ticket (if you have the PRO license) or post this question to the Forum.

  4. John Erazo May 6, 2010 at 5:43 am


    I have a grid which has an attachFooter (Grand totals for some columns). When exported to PDF, the grid is fine, but the footer part is not included in the exported PDF.

    Your help is much appreciated.

    • ivan May 6, 2010 at 4:43 pm

      John, this is expected behavior, only headers are supported in current version. We are working on the next version, which will allow to include grid footers as well.

  5. hopsy May 6, 2010 at 2:20 pm

    hi, it works fine, but the row after the headline in my generated pdf looks so:

    R01E1S1E1R99V9E0E3L0L1I1N9G9E90R3/T15IS1C99H9N0E4R12F1U9C9H90S5F0U1H19R …

    with the older version grid-to-pdf i had not this problem, by the same grid.

    xml debug:

    caused by grid.attachHeader(”#text_filter, #select_filter …”)

    any idea how to fix this mistake?

    • ivan May 6, 2010 at 4:44 pm

      The issue can be caused by using filters in grid headers, we are working on the updated version, which will recognize and exclude filter row from the print view.

  6. hopsy May 6, 2010 at 2:22 pm

    xml debug again …

    [![CDATA[ 1112131415161721505152535455566061626364656667686971727374758182838491929496979899POXXX

  7. Bob June 23, 2010 at 8:18 pm

    In order for errors to be recorded, it is necessary to ensure the browser users (e.g., IUSR_xxx in Windows) have write permission to the directory that has gegenrate.php.

  8. Tahir September 27, 2011 at 6:25 pm

    does this grid library works i believe one needs to buy it first is that the case because i have downloaded it and followed the instructions and its not working,
    any one plz reply

    • Ivan September 28, 2011 at 3:59 pm

      Export to PDF should work with dhtmlxGrid Standard. If you have any problems with the export functionality, you can use our forum to get help (registration is free):

  9. Mario Granados May 16, 2012 at 11:16 pm

    I don’t know if is only me, but when I try to download the zip package, it only have the following archives:

    – Folder imgs
    – folder tcpdf
    – generate.php
    – gridPdfGenerator.php
    – gridPdWrapper.php

    I can’t find the folders you mention in the documentation (./server and ./client)

    • Paul May 24, 2012 at 4:26 pm

      Mario, we’ve changed the package structure. Now it includes only server-side part of export functionality. The client-side JavaScript part is already included in the .js files of the components (grid, scheduler). The documentation will be updated soon. Sorry for the confusion.

  10. Hari May 21, 2013 at 6:33 pm

    I have 16 columns in my grid.But i want to export some columns to PDF. How can i do this. I can’t do this. Please help me to do this..

    • Inga K. May 22, 2013 at 3:11 pm

      Hari, the only way to implement it is to set hidden state for columns which must be ignored and make them visible after export. But this may cause some visual effects because the grid will be rendered two times. If you have further questions, please post them to our forum (registration is free).

  11. claudio nuñez January 28, 2014 at 6:29 pm

    realmente no se como utilizar la exportacion a excel.
    me pueden ayudar y mensionar los pasos?

Leave a Reply