19
Views
6
Comments
header and footer pdf

 have a context where I have a espace to generate pdfs. Im using the HtmlToPdfConverter.

I have a web screen that receives a Id and a prepartion and I have a aggregate "GetInfo" to get some information to show in the pdf based on the Id.

In this webscreen I have a webblock inside a ListRecords that has as Source Record List the "GetInfo. The webblock receives a SectionId and in the perpation I have an aggregate "GetSectionInfo" to get the section details that will appear in the pdf, the pdf will have information about several sections.

Then I have a server action GenerateProcessPDF that has a server action "GeneratePdf", this GeneratePDF receives an url "https://localhost/Project_PDFs/GeneratePDF.aspx?ID="+ProcessId and then I have an assign with:


ResultOk = True
ErrorMessage= ""
PDFFile = GeneratePDF.PDFBinary

For now I have a screen that has a web block to show some sections id the pdf. My doubt is how to add a header and a footer to each page. The header has a logo the footer is just a horizontal bar with page number.

Hi @Jake B. , you can had a header and footer by adding the following to the action generatePDF in OtherArgs:

Headers And Footer Options:
      --footer-center <text>          Centered footer text
      --footer-font-name <name>       Set footer font name (default Arial)
      --footer-font-size <size>       Set footer font size (default 12)
      --footer-html <url>             Adds a html footer
      --footer-left <text>            Left aligned footer text
      --footer-line                   Display line above the footer
      --no-footer-line                Do not display line above the footer
                                      (default)
      --footer-right <text>           Right aligned footer text
      --footer-spacing <real>         Spacing between footer and content in mm
                                      (default 0)
      --header-center <text>          Centered header text
      --header-font-name <name>       Set header font name (default Arial)
      --header-font-size <size>       Set header font size (default 12)
      --header-html <url>             Adds a html header
      --header-left <text>            Left aligned header text
      --header-line                   Display line below the header
      --no-header-line                Do not display line below the header
                                      (default)
      --header-right <text>           Right aligned header text
      --header-spacing <real>         Spacing between header and content in mm
                                      (default 0)
      --replace <name> <value>        Replace [name] with value in header and
                                      footer (repeatable)

See: https://www.outsystems.com/forums/discussion/64165/not-to-add-header-on-first-page-but-needed-for-the-rest-of-the-pages/ and https://wkhtmltopdf.org/usage/wkhtmltopdf.txt for more info

Champion
Rank: #40

Hi Jake,
If above will not work then please try below.
https://www.outsystems.com/forge/component-overview/1242/pdf-header-and-footer