'Use LaTeX to compile a Pgf generated figure to PDF.'

def print_pdf(self, fname_or_fh, *args, **kwargs):

    if kwargs.get(u'dryrun', False):
        self._print_pgf_to_fh(None, *args, **kwargs)
        return
    if isinstance(fname_or_fh, six.string_types):
        with open(fname_or_fh, u'wb') as fh:
            self._print_pdf_to_fh(fh, *args, **kwargs)
    elif is_writable_file_like(fname_or_fh):
        self._print_pdf_to_fh(fname_or_fh, *args, **kwargs)
    else:
        raise ValueError(u'filename    must    be    a    path    or    a    file-like    object')
