Create the report pdf file filling the LaTeX templates with the figs and data for the report

        :return:

def create_pdf(self):
        """
        Create the report pdf file filling the LaTeX templates with the figs and data for the report

        :return:
        """

        logger.info("Generating PDF report")

        # First step is to create the report dir from the template
        report_path = self.data_dir
        templates_path = os.path.join(os.path.dirname(__file__),
                                      "latex_template")

        # Copy the data generated to be used in LaTeX template
        copy_tree(templates_path, report_path)

        # if user specified a logo then replace it with default logo
        if self.logo:
            os.remove(os.path.join(report_path, "logo.eps"))
            os.remove(os.path.join(report_path, "logo-eps-converted-to.pdf"))
            print(copy_file(self.logo, os.path.join(report_path, "logo." + self.logo.split('/')[-1].split('.')[-1])))

        # Change the project global name
        project_replace = self.report_name.replace(' ', r'\ ')
        self.replace_text_dir(report_path, 'PROJECT-NAME', project_replace)
        self.replace_text_dir(os.path.join(report_path, 'overview'), 'PROJECT-NAME', project_replace)

        # Change the quarter subtitle
        if self.interval == "quarter":
            build_period_name = self.build_period_name(self.end, self.interval, self.offset)
        else:
            build_period_name = self.start.strftime("%y-%m") + "-" + self.end.strftime("%y-%m")
        period_replace = build_period_name.replace(' ', r'\ ')
        self.replace_text_dir(report_path, '2016-QUARTER', period_replace)
        self.replace_text_dir(os.path.join(report_path, 'overview'), '2016-QUARTER', period_replace)

        # Report date frame
        quarter_start = self.end - relativedelta.relativedelta(months=3)
        quarter_start += relativedelta.relativedelta(days=1)
        dateframe = (quarter_start.strftime('%Y-%m-%d') + " to " + self.end.strftime('%Y-%m-%d')).replace(' ', r'\ ')
        self.replace_text_dir(os.path.join(report_path, 'overview'), 'DATEFRAME', dateframe)

        # Change the date Copyright
        self.replace_text_dir(report_path, '(cc) 2016', '(cc) ' + datetime.now().strftime('%Y'))

        # Fix LaTeX special chars
        self.replace_text_dir(report_path, '&', '\&', 'data/git_top_organizations_*')
        self.replace_text_dir(report_path, '^#', '', 'data/git_top_organizations_*')

        # Activity section
        activity = ''
        for activity_ds in ['git', 'github', 'gerrit', 'mls']:
            if activity_ds in self.data_sources:
                activity += r"\input{activity/" + activity_ds + ".tex}"

        with open(os.path.join(report_path, "activity.tex"), "w") as flatex:
            flatex.write(activity)

        # Community section
        community = ''
        for community_ds in ['git', 'mls']:
            if community_ds in self.data_sources:
                community += r"\input{community/" + community_ds + ".tex}"

        with open(os.path.join(report_path, "community.tex"), "w") as flatex:
            flatex.write(community)

        # Overview section
        overview = r'\input{overview/summary.tex}'
        for overview_ds in ['github', 'gerrit']:
            if overview_ds in self.data_sources:
                overview += r"\input{overview/efficiency-" + overview_ds + ".tex}"

        with open(os.path.join(report_path, "overview.tex"), "w") as flatex:
            flatex.write(overview)

        # Process section
        process = ''
        for process_ds in ['github_prs', 'gerrit']:
            if process_ds in self.data_sources:
                process += r"\input{process/" + process_ds + ".tex}"

        if not process:
            process = "Unfortunately, this section is empty because there are no supported sources available to perform this kind of analysis."

        with open(os.path.join(report_path, "process.tex"), "w") as flatex:
            flatex.write(process)

        # Time to generate the pdf report
        res = subprocess.call("pdflatex report.tex", shell=True, cwd=report_path)
        if res > 0:
            logger.error("Error generating PDF")
            return
        # A second time so the TOC is generated
        subprocess.call("pdflatex report.tex", shell=True, cwd=report_path)

        logger.info("PDF report done %s", report_path + "/report.pdf")