Skip to content

Convert Report to PDF #23

Convert Report to PDF

Convert Report to PDF #23

Workflow file for this run

name: Convert Report to PDF
on:
workflow_dispatch:
inputs:
report:
description: 'Report to convert'
required: true
type: choice
# TODO options to be called from a script or code
options:
- Aciclovir-Mean
- Aciclovir-Mean-SVG
- Aciclovir-Population
- Raltegravir-Absorption
- Raltegravir-Mass-Balance
- Test-NO7
- Test-NO8
- Test-NO9
- Test-NO10
- Test-NO11
- Test-NO12
jobs:
report-to-pdf:
runs-on: ubuntu-latest
# Allow only authorized collaborators to trigger GA:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
# All steps in workflow:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Perform html conversion with pandoc
run: |
pandoc -f markdown -t html5 --embed-resources --standalone \
-o Reports/${{ inputs.report }}/Report.html \
Reports/${{ inputs.report }}/Report.md -c osp.css
# Run the HTML to PDF converter action
- name: HTML website to PDF converter
uses: fifsky/html-to-pdf-action@master
with:
htmlFile: ./Reports/${{ inputs.report }}/Report.html
outputFile: ./Reports/${{ inputs.report }}/Report.pdf
pdfOptions: '{"format": "A4", "margin": {"top": "10mm", "left": "10mm", "right": "10mm", "bottom": "10mm"}, "displayHeaderFooter": true, "headerTemplate": "<span></span>", "footerTemplate": "<span style="font-size: 12px"><span class="date"></span> <span class="pageNumber" style="float:right;"></span>/<span class="totalPages" style="float:right;"></span></span>"}'
- name: Save PDF file as artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.report }}-pdf
path: Reports/${{ inputs.report }}