From 6dad23f6a369fbe201fda4ba9da790dd4890ac55 Mon Sep 17 00:00:00 2001 From: thenav56 Date: Wed, 13 Dec 2023 14:41:43 +0545 Subject: [PATCH] Add custom header with APT message --- app/pdf/utils.py | 14 +++++++++++++- docker-compose.yml | 5 +++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/pdf/utils.py b/app/pdf/utils.py index 5e8bd855..8f434a7e 100644 --- a/app/pdf/utils.py +++ b/app/pdf/utils.py @@ -95,8 +95,20 @@ def make_pdf( f"to S3 at path: {screenshot_filepath}" ) + header_template = """ + + This ATBD was downloaded from the NASA Algorithm Publication Tool (APT) Manuscript submitted to Earth and Space Science. + + """ + page.wait_for_selector("#pdf-preview-ready", state="attached") - page.pdf(path=local_path, format="A4") + page.pdf( + path=local_path, + format="A4", + header_template=header_template, + footer_template="", + display_header_footer=True, + ) browser.close() logger.info(f"PDF generated at path: {local_path}") if journal: diff --git a/docker-compose.yml b/docker-compose.yml index d621a9cf..1d324e53 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,6 +38,7 @@ services: depends_on: - db-ready - localstack-ready + mail: image: namshi/smtp restart: always @@ -115,7 +116,7 @@ services: AWS_DEFAULT_REGION: us-east-1 PROJECT_NAME: nasa-apt-api-local API_VERSION_STRING: /v2 - AWS_RESOURCES_ENDPOINT: http://localstack:4566 + AWS_RESOURCES_ENDPOINT: ${AWS_RESOURCES_ENDPOINT:-http://localstack:4566} S3_BUCKET: nasa-apt-dev-files POSTGRES_ADMIN_CREDENTIALS_ARN: mocked_credentials_arn # This URL omits the "http://" in order to remain consistent @@ -156,7 +157,7 @@ services: AWS_DEFAULT_REGION: us-east-1 PROJECT_NAME: nasa-apt-api-local API_VERSION_STRING: /v2 - AWS_RESOURCES_ENDPOINT: http://localstack:4566 + AWS_RESOURCES_ENDPOINT: ${AWS_RESOURCES_ENDPOINT:-http://localstack:4566} S3_BUCKET: nasa-apt-dev-files POSTGRES_ADMIN_CREDENTIALS_ARN: mocked_credentials_arn # This URL omits the "http://" in order to remain consistent