PDF: Set page number dynamically using footer section

  • Aditya
    Participant
      Has successfully completed the online course Introduction
      Has successfully completed the online course Basics (100)
    2 years, 5 months ago #35404

    Hi,

    We have to show the page number in the footer of every page in the format “Page x of y”. I tried to implement this using the config JSON, but somehow using the same is not visible on the PDF because we have used the header section of the plugin. And now I was trying to implement the footer section of the plugin, but was not able to get the value of page number. Please let me know how we can achieve this using the footer section.

    Thanks in advance !!

    Jennifer Häfner
    Moderator
      Has successfully completed the online course Intermediate (200)
      Has successfully completed the online course Advanced (300)
      Has successfully completed the online course Basics (100)
      Has successfully completed the online course Advanced (310)
      Has successfully completed the online course Advanced (320)
      Has successfully completed the Intermediate Certification
      Has successfully completed the Advanced Certification
    2 years, 5 months ago #35416
    Up
    1
    Down
    ::

    If you want to add HTML to the header, you need to implement a workaround and also adapt the footer, unfortunately. Follow these steps to add an HTML header AND a page indicator in the footer:

    • Create two HTML files: one for the header, one for the footer
    • I have attached examples for both HTML files. The footer HTML file shows the page numbers. Adapt the header HTML file to your liking
    • Upload both HTML files inside your application (in the section ‘Assets’)
    • Adapt your PDF config object, so that you use the parameters ‘header-html’/’footer-html’ instead of ‘header-center’/’footer-center’. In these parameters, you need to specifiy the path to the location where the HTML files are stored on the appserver. For example, in my case, my app is called ‘test_JH’, so the paths are like that:
      {
      "header-html": "/opt/simplifier/data/storage/appDirect/test_JH/data/header.html",
      "footer-html": "/opt/simplifier/data/storage/appDirect/test_JH/data/footer.html"
      }

      Caution, the paths may vary depending on your instance setup. You can ask an administrator to get you the correct paths if you do not have access to the server.

    • Deploy your app and test the PDF. You should now see the PDF file with the header/footer HTML

    I know this process is quite cumbersome. I have created a ticket so that hopefully in the future, the PDF config and the header section can be used together.

    Attachments:
    You must be logged in to view attached files.
    Vitali Kurdasov
    Moderator
      Has successfully completed the online course Intermediate (200)
      Has successfully completed the online course Basics (100)
      Has successfully completed the online course Advanced (310)
      Has successfully completed the Intermediate Certification
    2 years, 5 months ago #35437
    Up
    1
    Down
    ::

    Hi Aditya,

    you only need to upload the html files to Assets in your Application, the paths above is a reference where simplifier stores them internal so the plugin can read them.

    Jennifer Häfner
    Moderator
      Has successfully completed the online course Intermediate (200)
      Has successfully completed the online course Advanced (300)
      Has successfully completed the online course Basics (100)
      Has successfully completed the online course Advanced (310)
      Has successfully completed the online course Advanced (320)
      Has successfully completed the Intermediate Certification
      Has successfully completed the Advanced Certification
    2 years, 5 months ago #35408
    Up
    0
    Down
    ::

    Hi Aditya,

    You’re right, it’s currently not possible to use a header in the template and the ‘footer’ parameter in the config object.

    To set both header and footer, you can use a config object like this:

    {
    "header-center": "The header",
    "footer-center": "[page] / [toPage]"
    }
    Aditya
    Participant
      Has successfully completed the online course Introduction
      Has successfully completed the online course Basics (100)
    2 years, 5 months ago #35410
    Up
    0
    Down
    ::

    Thanks for the suggestion Jennifer, can we add html content in the header ?

    My header needs to have logos, table and some other information, that I have implemented in the header section. Can this HTML content be added to the config JSON ?

    Aditya
    Participant
      Has successfully completed the online course Introduction
      Has successfully completed the online course Basics (100)
    2 years, 5 months ago #35421
    Up
    0
    Down
    ::

    HI Jennifer,

    Please correct me if I am wrong, you are suggesting that we need to store the html files in Assets and in the application folder …. Is that correct ?

    Regards,
    Aditya Shukla

    Aditya
    Participant
      Has successfully completed the online course Introduction
      Has successfully completed the online course Basics (100)
    2 years, 5 months ago #35438
    Up
    0
    Down
    ::

    Thanks Vitali for the confirmation. We will try this.

    Satish
    Participant
      2 years, 4 months ago #35746
      Up
      0
      Down
      ::

      Hi Jennifer,

      How we can pass JSON data from Simplifier to files in Assets like I want to change content based on language. How I can achieve this.

      Thnaks !!

      Jennifer Häfner
      Moderator
        Has successfully completed the online course Intermediate (200)
        Has successfully completed the online course Advanced (300)
        Has successfully completed the online course Basics (100)
        Has successfully completed the online course Advanced (310)
        Has successfully completed the online course Advanced (320)
        Has successfully completed the Intermediate Certification
        Has successfully completed the Advanced Certification
      2 years, 4 months ago #35819
      Up
      0
      Down
      ::

      Hi Satish,

      You cannot directly pass JSON data to the files in the assets section. What you can do is to upload separate files to the assets section, one file for each language. Then, in the process designer, check which language is currently used (e.g., with the CSBO function ‘ITIZ_Utilities’ – ‘getLanguage’) and load the respective file from the assets according to the current language.

      Jennifer Häfner
      Moderator
        Has successfully completed the online course Intermediate (200)
        Has successfully completed the online course Advanced (300)
        Has successfully completed the online course Basics (100)
        Has successfully completed the online course Advanced (310)
        Has successfully completed the online course Advanced (320)
        Has successfully completed the Intermediate Certification
        Has successfully completed the Advanced Certification
      2 years, 4 months ago #35827
      Up
      0
      Down
      ::

      Hi Aditya,

      After some testing, I found that you can also insert the content of the HTML header/footer files into the header/footer section of the PDF template. This means you do not need the PDF config object anymore. Also, in the header/footer section, you have access to the JSON data that is given as input for the PDF template, so I think this approach is more flexible.

      Satish
      Participant
        2 years, 2 months ago #37677
        Up
        0
        Down
        ::

        Hi,

        How can we create a pdf with dynamic index (clickable index by which user can navigate to particular topic ) and get the page number of particular topic.

      Viewing 11 posts - 1 through 11 (of 11 total)

      You must be logged in to reply to this topic.