generate to pdf using tcpdf error

n2nx15 - July 2, 2009 - 04:56
Project:Printer, e-mail and PDF versions
Version:5.x-4.7
Component:User interface
Category:support request
Priority:critical
Assigned:Unassigned
Status:closed
Description

Hi i use Gmap modules and Printer, e-mail and PDF versions modules

when i generate the pdf files to print the gmap in the pdf, it didn't show any map, and a message appear in the pdf replace the map,
it says like this: "javascript is required to view this map."

is there is something wrong about this? plz help me

Gmap modules:
this to add the java script :

<?php
   drupal_add_css
( drupal_get_path('module', 'nodehierarchy') .'/nodehierarchy.css');
  
drupal_add_js( drupal_get_path('theme', 'driving_vacation') . '/pdmarker.js', 'theme');
  
drupal_add_js( drupal_get_path('theme', 'driving_vacation') . '/dvmap.js', 'theme');
?>

i put this code to generate the map (line 75):
print theme('gmap', array('#map' => $mapid, '#settings' => $map));

this code start in line 164

<?php

           $children
= nodehierarchy_get_node_children_list($nid);
          
$i = 1;
    
$in =0;
      
$mapid = gmap_get_auto_mapid();
         
$map = gmap_parse_macro('[gmap]');
         
$map['width'] = '400px;';
         
$map['height'] = '410px';
         
$map['controltype'] = 'Small';
   
$map['latitude'] = $latitude;
           
$map['longitude'] = $longitude;
           while(
$in <count($children)) {
    
?>

<?php
$temporary = $children[$in]['node']->nid;

$sql = "select lid from drupal5_location_instance where nid like '".$temporary."'";
$rs = mysql_query($sql);
$result = mysql_fetch_array($rs);
$lid = $result[0];
$sql = "select latitude,longitude from drupal5_location where lid like '".$lid."'";
$rs = mysql_query($sql);
$result = mysql_fetch_array($rs);
$latitude = $result[0];
$longitude =$result[1];
$map['markers'][] = array(
'markername' => 'dv flag' . $i,
'latitude' => $latitude,
'longitude' => longitude
);

i entered those code in print.tpl.php,
you can see the error message in the picture that i attached

AttachmentSize
javascript error.JPG151.95 KB

#1

jcnventura - July 2, 2009 - 08:30
Status:active» postponed (maintainer needs more info)

Check #372533: Gmap & PDF for a possible solution.

#2

n2nx15 - July 2, 2009 - 11:31

i tried the print friendly, but the gmap not appear same like in the pdf,
but what this sentence mean "creating a page, loading a node, formatting my content, and then using a template to make it printer friendly"? i'm still new in drupal

#3

jcnventura - July 2, 2009 - 22:57

Where have you read that sentence?

From what I see, what you're trying to do is advanced enough that you should seek someone who knows what he's doing.. It certainly isn't a problem with the module, so I can't really help you more.

João

#4

JaredAM - July 3, 2009 - 00:14

I also couldn't get the js to work right but you can do this with a little tweeking.

Basically, just create a static gmap using google's static map thingy:

$gmap_key = variable_get('googlemap_api_key', "insert_default_key_here");

$staticmap_image = "<p align=center><img border='0' class='gmapimg'
                            alt='Map' src='http://maps.google.com/staticmap?center=" .
                            $node->location['lat'] . "," . $node->location['lon'] .
                            "&zoom=14&size=500x300&markers=" . $node->location['lat'] . "," .
                            $node->location['lon'] . ",blue&sensor=false&key=" . $gmap_key .
                            "' width=500px height=300px/></p>";

The static map function will return an image for you to use so just print it out in your print_pdf.node-mynodetype.tpl.php file.

If you want your pdf's to look good, include whatever css you might need in the head section of your file (I don't think you can call an external stylesheet).

Let me know if you need more help.

#5

n2nx15 - July 3, 2009 - 04:23

@João
i see it in:
http://drupal.org/node/217439
okay thanks.

@JaredAM
thanks jared, it's help, the map is appear in the pdf right now, but it is a litle bit different from the gmap haha,
do you know how to make it same(by taking the zoom lvl, and another setting)? and do you know how to change the marker into my own marker?

#6

JaredAM - July 3, 2009 - 20:33

To make the gmap look the way you want, just modify the google string ("zoom=14", "size=500x300", "markers=lat,lon,bluemarker"):

http://maps.google.com/staticmap?center=" .
$node->location['lat'] . "," . $node->location['lon'] .
"&zoom=14&size=500x300&markers=" . $node->location['lat'] . "," .
$node->location['lon'] . ",blue&sensor=false&key=" . $gmap_key

#7

jcnventura - July 17, 2009 - 23:33
Status:postponed (maintainer needs more info)» closed

No comments in the last two weeks. Closing the issue.

 
 

Drupal is a registered trademark of Dries Buytaert.