@bottle.get('/api/v3/report/<report_uuid>/pdf')
def export_report_as_pdf(report_uuid: ReportId):
    'Download the report as pdf.'
    renderer_host = os.environ.get('RENDERER_HOST', 'renderer')
    renderer_port = os.environ.get('RENDERER_PORT', '9000')
    render_url = f'http://{renderer_host}:{renderer_port}/api/render'
    proxy_host = os.environ.get('PROXY_HOST', 'www')
    proxy_port = os.environ.get('PROXY_PORT', '80')
    query_string = (f'?{bottle.request.query_string}' if bottle.request.query_string else '')
    report_url = parse.quote(f'http://{proxy_host}:{proxy_port}/{report_uuid}{query_string}')
    margins = '&'.join([f'pdf.margin.{side}=25' for side in ('top', 'bottom', 'left', 'right')])
    options = f'emulateScreenMedia=false&goto.timeout=60000&pdf.scale=0.7&{margins}'
    response = requests.get(f'{render_url}?url={report_url}&{options}')
    response.raise_for_status()
    bottle.response.content_type = 'application/pdf'
    return response.content
Download the report as pdf.
@bottle.get('/api/v3/report/<report_uuid>/pdf')
def export_report_as_pdf(report_uuid: ReportId):
    
    renderer_host = os.environ.get('RENDERER_HOST', 'renderer')
    renderer_port = os.environ.get('RENDERER_PORT', '9000')
    render_url = f'http://{renderer_host}:{renderer_port}/api/render'
    proxy_host = os.environ.get('PROXY_HOST', 'www')
    proxy_port = os.environ.get('PROXY_PORT', '80')
    query_string = (f'?{bottle.request.query_string}' if bottle.request.query_string else )
    report_url = parse.quote(f'http://{proxy_host}:{proxy_port}/{report_uuid}{query_string}')
    margins = '&'.join([f'pdf.margin.{side}=25' for side in ('top', 'bottom', 'left', 'right')])
    options = f'emulateScreenMedia=false&goto.timeout=60000&pdf.scale=0.7&{margins}'
    response = requests.get(f'{render_url}?url={report_url}&{options}')
    response.raise_for_status()
    bottle.response.content_type = 'application/pdf'
    return response.content