Read tables in PDF.

    Args:
        input_path (file like obj):
            File like object of tareget PDF file.
        template_path (file_like_obj):
            File like object for Tabula app template.
        pandas_options (dict, optional):
            Set pandas options like {'header': None}.
        encoding (str, optional):
            Encoding type for pandas. Default is 'utf-8'
        java_options (list, optional):
            Set java options like `-Xmx256m`.
        kwargs (dict):
            Dictionary of option for tabula-java. Details are shown in `build_options()`

    Returns:
        Extracted pandas DataFrame or list.

def read_pdf_with_template(
        input_path,
        template_path,
        pandas_options=None,
        encoding='utf-8',
        java_options=None,
        **kwargs):
    '''Read tables in PDF.

    Args:
        input_path (file like obj):
            File like object of tareget PDF file.
        template_path (file_like_obj):
            File like object for Tabula app template.
        pandas_options (dict, optional):
            Set pandas options like {'header': None}.
        encoding (str, optional):
            Encoding type for pandas. Default is 'utf-8'
        java_options (list, optional):
            Set java options like `-Xmx256m`.
        kwargs (dict):
            Dictionary of option for tabula-java. Details are shown in `build_options()`

    Returns:
        Extracted pandas DataFrame or list.
    '''

    from itertools import chain

    options = load_template(template_path)
    dataframes = []

    for option in options:
        _df = read_pdf(
            input_path, pandas_options=pandas_options,
            encoding=encoding, java_options=java_options,
            **dict(kwargs, **option))
        if isinstance(_df, list):
            dataframes.extend(_df)
        else:
            dataframes.append(_df)

    return dataframes