Plots spectra into a PDF file, one spectrum per page.

    Splits into several pieces of width

    Args:
      ss: list of Spectrum objects
      pdf_filename: name of output file

def plot_spectra_pages_pdf(ss, pdf_filename='pages.pdf', setup=_default_setup):
    """
    Plots spectra into a PDF file, one spectrum per page.

    Splits into several pieces of width

    Args:
      ss: list of Spectrum objects
      pdf_filename: name of output file
    """
    logger = a99.get_python_logger()
    xmin, xmax, ymin_, ymax, xspan, yspan = calc_max_min(ss)
    ymin = ymin_ if setup.ymin is None else setup.ymin
    num_pages = len(ss)
    a99.format_BLB()
    pdf = matplotlib.backends.backend_pdf.PdfPages(pdf_filename)
    for i, s in enumerate(ss):
        title = s.title
        fig = plt.figure()
        plt.plot(s.x, s.y, c=_FAV_COLOR)
        if setup.flag_xlabel and setup.fmt_xlabel:
            _set_plot(plt.xlabel, setup.fmt_xlabel, s)
        if setup.flag_ylabel and setup.fmt_ylabel:
            _set_plot(plt.ylabel, setup.fmt_ylabel, s)
        _set_plot(plt.title, setup.fmt_title, s)
        plt.xlim([xmin-xspan*_T, xmax+xspan*_T])
        plt.ylim([ymin-yspan*_T, ymax+yspan*_T])
        plt.tight_layout()
        plt.subplots_adjust(top=0.94) # workaround for cropped title
        logger.info("Printing page {0:d}/{1:d} ('{2!s}')".format(i+1, num_pages, title))
        pdf.savefig(fig)
        plt.close()
    pdf.close()
    logger.info("File {0!s} successfully created.".format(pdf_filename))