Print Maps (Google Map) in PrintPDF

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • esforim
    Active Community Member
    • Jan 2020
    • 2204

    Print Maps (Google Map) in PrintPDF

    Want to print the Map in my PDF, is it possible? I don't quite see it as a field and Document docs.espocrm.com/ make no mention of it either.

    (PS: Purposely used Maps and PrintPDF because forum can't search 3 letter words)
  • eymen-elkum
    Active Community Member
    • Nov 2014
    • 472

    #2
    The map is not storable field, it is calculated on the fly by quring the Google map service, to print it you will need to hire a developer, or may Espo team interest in applying this feature.

    CEO of Eblasoft
    EspoCRM Expert since 2014
    Full Stack Web Developer since 2008
    Creator of Numerous Successful Extensions & Projects​

    Comment

    • esforim
      Active Community Member
      • Jan 2020
      • 2204

      #3
      Thank you @ayam.alkom. Hmm I wonder if there is a workaround to it that is more simplified. I suppose at this stage I should just "Take a Screenshot", copy/paste it in a WYSIWYG field and print that field but that is quite a manually process. I guess for now I just skip it, save on Colors Printer toner.

      Comment

      • yuri
        Member
        • Mar 2014
        • 8442

        #4
        I added a helper: https://github.com/espocrm/espocrm/issues/1714
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • esforim
          Active Community Member
          • Jan 2020
          • 2204

          #5
          Awesome! The coding look simply enough to do a "manual" patch, I guess I will start using this early without patiently waiting for 5.9.2.

          ---

          Reporting back after I did the manual patch. Working good. Took me some issue before I manage to get it to work.

          Basically my issue was with this commit: https://github.com/espocrm/espocrm/c...4ecc3cf7dcffeb

          I didn't notice there was a "2nd" file, and only did the first file create/edit. For this to work, there is 3 files you need to change. 1 file in Commit: https://github.com/espocrm/espocrm/c...fb659838249219
          and 2 files in the https://github.com/espocrm/espocrm/c...4ecc3cf7dcffeb

          After that your PDF will now have the map!

          I will play around with the available options and report back if there is an issue, if there isn't then all is good.

          ---

          Update: After playing around for about 1 hr and many test later I have finally made it to a satisfactory result. Some issue and highlight is below for anyone that planning to use it.
          1. Maps image quality is quite bad, blurry text and image.
          2. Look like all the Options is working;
          3. Zoom function, higher = 'bigger map', ie. you can see street name, lower value you see city, state, country size;
          4. For Street level, I believe zoom of 16-20 is ideal. For City wide, an 13 is good. But test it for your EspoCRM.
          5. For the size, I believe a 600x225 is a pretty good size for an A4 (size) paper. The 600 is the width and 225 is the height.
          6. Size is: width x height
          7. Did not test the language option so I'm not sure.
          8. When you are not using the "address" field, if you were to use Country, City, State as a field then you don't use the ' '. It took me quite long to figure this out. For example:
          9. {{_googleMapsImage city='New York' country='United States'}} is fine to use the ' '. BUT if you want to do this:
          10. {{_googleMapsImage city='addressCity' country='addressCountry'}} will not work. You must do THIS:
          11. {{_googleMapsImage city=addressCity country=addressCountry}}
          Anyway that the end of my finding. Here is the final code I decide to use. Overall quite happy. Please feel free to copy/paste and edit as necessary.

          ---

          Property Map
          {{_googleMapsImage field='address' size='600x225' zoom='18'}}
          City Profile
          {{_googleMapsImage city=addressCity state=addressState postalCode=addressPostalCode country=addressCountry zoom='13' size='250x200'}} {{_googleMapsImage city=addressCity state=addressState postalCode=addressPostalCode country=addressCountry zoom='8' size='250x200'}}
          ---

          And the same above in a <> code.
          Code:
          <p><b>Property Map</b><br>{{_googleMapsImage field='address' size='600x225' zoom='18'}}<br><b>Suburb Profile<br></b></p><table class="table table-bordered"><tbody><tr><td align="center">{{_googleMapsImage city=addressCity state=addressState postalCode=addressPostalCode country=addressCountry zoom='13' size='250x200'}}</td><td align="center">{{_googleMapsImage city=addressCity state=addressState
          postalCode=addressPostalCode country=addressCountry zoom='8'
          size='250x200'}}</td></tr></tbody></table>
          Last edited by esforim; 05-25-2020, 05:21 AM.

          Comment

          • yuri
            Member
            • Mar 2014
            • 8442

            #6
            Helper is renamed to {{googleMapsImage}] https://github.com/espocrm/espocrm/c...374982e16703fc
            If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

            Comment

            Working...