How can Members download their own Membership Certificate/Card?
No custom code required! If you're on Drupal Views integration, which ships with CiviCRM - all that's required here are Drupal modules Views, Views PDF and installation of two libraries for the PDF generation: tcpdf and fpdi;

Here are the steps:


First we will create a Membership tab in your Drupal /user screen where we will display the relevant Membership details pulled from CiviCRM:




To create this Membership Tab: 

a) setup your CiviCRM - Drupal CMS integration by following the instructions here:
Administer -> System Settings -> CMS Database Integration
direct link: civicrm/admin/setting/uf?reset=1
This makes the CiviCRM tables available in your Drupal Views.

b) on the Drupal side - enable Drupal Views; and Create a new View - key elements are Relationships -> connecting CiviCRM Contact w/ Drupal user ID and Contextual Filter -> so we can create a path user/%/membership and the Menu item: Tab: Membership

c) here is a complete Views configuration for the Page:



2. Hitting the Download Membership Certificate link produces:



To create this Certificate (a PDF download):

a) you need to download and install module: Views PDF -> which requires libraries: tcpdf and fpdi -> put them in a /libraries folder that is accessible by your site - either sites/default/libraries or sites/all/libraries.

b) when installed -> add a new display in your View -> of type PDF Page. I've selected PDF fields -> in Settings you can: upload and select a background template of your choice; you can also specify an offset X and Y for each of the CiviCRM variables to position them exactly where you want them!



c) In your PDF Page View -> Note the path: 



d) Now that you've made the PDF Page display: add a Field on your user/%/membership page -> Custom text -> e.g. Download Membership Certificate. Hit Rewrite Results -> select Output this field as a link as follows: