<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def view_pdf(name=None):
 """Render a pdf file based on the given page. .. note:: this is a bottle view Keyword Arguments: :name: (str) -- name of the rest file (without the .rst extension) MANDATORY """

    if name is None:
        return view_meta_index()

    files = glob.glob("{0}.rst".format(name))
    if len(files) > 0:
        file_handle = open(files[0], 'r')
        dest_filename = name + '.pdf'
        doctree = publish_doctree(file_handle.read())
        try:
            produce_pdf(doctree_content=doctree,
                        filename=dest_filename)
        except:
            raise
        else:
            return static_file(dest_filename,
                               root='',
                               download=True)
    else:
        return abort(404)