Print to PDF in wordpress

Hello,

I have tried the latest version of Event Calendar / Scheduler plugin in wordpress. I have enabled the Print to PDF feature but I can’t find any print button on the calendar. Where can I print it to a PDF??

Thank you very much.

Currently you will need to install scheduler-to-pdf conversion script, as it is described here
dhtmlx.com/blog/?p=306

I have installed all of the Print to PDF files, and the basic functionality works, but when I print a calendar, I see tags rather than event titles:

Also, when trying to use this function in Chrome/Safari, you see this error:

  • Undefined index: mycoolxmlbody

I did some checking and notice that $_POST[‘mycoolxmlbody’] is coming up null in generate.php, but only in those browsers.

If you have a fix for this, I’d love to hear about it.

Thanks.

I decided to post this in a seperate message to keep it out of my questions…

Here is how I chose to add this functionality to the plugin, as an icon on the main nav bar:

1. Add this graphic to your images folder:

2. Add this class to dhtmlscheduler.css:
.dhx_cal_navline .printicon{width:16px;height:16px;top:4px; left:3px; cursor:pointer;background-image:url(./imgs/icon_pdf2.gif);}

3. Replace code in dhtmlxSchedulerConfigurator.php starting around line 552:

$scheduler .= "</script>
  <div id=\"scheduler_here\" class=\"dhx_cal_container\" style='width:".$settings['settings_width']."; height:".$settings['settings_height'].";'>
  <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>";

with this :

$scheduler .= "</script>
	<div id=\"scheduler_here\" class=\"dhx_cal_container\" style='width:".$settings['settings_width']."; height:".$settings['settings_height'].";'>
	<div class=\"dhx_cal_navline\">";

//---add PDF print button				
if ($settings['settings_print'] == 'true') {
	$sPathToApp = $_SERVER['HTTP_HOST']; // edit for your app if needed
	$scheduler .= "<div class=\"printicon\" id=\"printicon\" title=\"Print to PDF\" onclick=\"scheduler.toPDF('http://". $sPathToApp ."/wp-content/plugins/event-calendar-scheduler/codebase/server/generate.php')\">&nbsp;</div>";
}
//--- end add ---
	
$scheduler .= "<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>";

which will add the PDF icon on to the left of the main calendar navigation icons :

In generate.php, of scheduler2pdf script, replace

$scPDF = new schedulerPDF();

with

$scPDF = new schedulerPDF(); $scPDF->strip_tags = true;

Perfect! Thanks!

Any comment on the Chrome/Safari Issue?

Issue in chrome must not occur with latest scheduler_pdf.js
Try to update the existing one ( in the plugin|component folder ) with the attached one.
dhtmlxscheduler_pdf.zip (2.47 KB)

Stanislav,

I also got the tags appearing on my PDF output.

I changed $scPDF = new schedulerPDF();

to:

$scPDF = new schedulerPDF();
$scPDF->strip_tags = true;

in generate.php but the tags still appear when I hit Print.

jake

can you set “$debug = true;” and provide the debug xml file ( will be saved in the same folder ) for investigation ( you can attach file here, or send it directly to support@dhtmlx.com )

Hi, it’s possible to make printable also the timeline view?
At the moment i get this error:
Invalid argument supplied for foreach()

thanks

Hello,

Try using attached version.

Best regards,
Ilya
dhtmlxscheduler_pdf.zip (1.98 KB)

Whit your file i get no more error, but the pdf have just the first line filled, while in the other there’s the name, but the line it’s empty.

Open generate.php and enable debug mode:

$debug = true;

Then generate your scheduler and attach here files debug_xx_xx_xx.xml (it will appear in directory with generate.php after generation) and generated PDF.