Can we export reports dashboard in to an PDF?

Product/components used and version/fix level:

10.18

Detailed explanation of the problem:

I have a dashboard inside a report. Do we have any option to export the whole dashboard into an PDF ?

I have tried one option to get the HTML of the dashboard by hitting an endpoint (https://tenant.com/apps/guardtec/#/reports/{reportId}/dashboard/{dashboardId}) by passing dashboard id and report id. The idea behind to get HTML is if we are able to get HTML of dashboard along with CSS we can convert it into PDF by using libraries but not able to get the whole HTML code of the dashboard. Any inputs ?

Error messages / full error message screenshot / log file:

Report Dashboard

Question related to a free trial, or to a production (customer) instance?

Production

Regards
Mohan

Hi Mohan,

can you elaborate a bit more on what exactly you are missing?

Which parts of the HTML of the dashboard were there and which were missing?

You would have to perform the login and would need to wait until the dashboard has been fully loaded.

I have a report. Inside a report I have dashboard along with two widgets. I want whole dashboard needs to be convert into PDF file along with widgets on button event handle.

While I hit the end point (https://tenant.com/apps/guardtec/#/reports/{reportId}/dashboard/{dashboardId}) I was not able to see the whole HTML code of the dashboard I am getting below HTML code.

<!doctype html><html><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/><meta name="description" content=""><meta name="viewport" content="width=device-width,initial-scale=1"><style>[ng:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {display: none !important;}
      body {
        background: #F2F3F2;
      }

      .init-load{
        max-width: 320px;
        height: 100vh;
        margin: 0 auto;
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
            -ms-flex-direction: column;
                flex-direction: column;
        -webkit-box-pack: center;
            -ms-flex-pack: center;
                justify-content: center;
      }

      .spinner-snake {
        color: #d9d9d9;
        text-indent: -99999em;
        margin: 16px auto;
        position: relative;
        width: 4em;
        height: 4em;
        border-radius: 50%;
        -webkit-box-shadow: inset 0 0 0 .6em;
                box-shadow: inset 0 0 0 .6em;
        -webkit-transform: translateZ(0) rotate(180deg);
                transform: translateZ(0) rotate(180deg);
        -webkit-animation: rotator 1.95s infinite linear;
                animation: rotator 1.95s infinite linear;
      }

      .spinner-snake:before {
        width: 2.2em;
        height: 4.2em;
        border-radius: 2.2em 0 0em 2.2em;
        top: -0.1em;
        left: -0.1em;
        -webkit-transform-origin: 2.2em 2.1em;
                transform-origin: 2.2em 2.1em;
        -webkit-animation: rotator 1s infinite ease 0.75s;
                animation: rotator 1s infinite ease 0.75s;
      }

      .spinner-snake:before, .spinner-snake:after {
        position: absolute;
        content: '';
        background: #F2F3F2;
      }

      .spinner-snake:after {
        width: 2.2em;
        height: 4.2em;
        border-radius: 0 2.2em 2.2em 0;
        top: -0.1em;
        left: 2.1em;
        -webkit-transform-origin: 0 2.1em;
                transform-origin: 0 2.1em;
        -webkit-animation: rotator 1s infinite ease;
                animation: rotator 1s infinite ease;
      }

      @-webkit-keyframes rotator {
        0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); }
      100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
      }

      @keyframes rotator {
        0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); }
      100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
      }</style><title>guardtec</title><script defer="defer" src="bootstrap.2e9157db98609d00c809.js"></script><meta http-equiv="Content-Security-Policy" content="base-uri 'none'; default-src 'self' 'unsafe-inline' http: https: ws: wss:; connect-src 'self' http: https: ws: wss:; script-src 'self' *.mapquestapi.com *.twitter.com *.twimg.com *.aptrinsic.com 'unsafe-inline' 'unsafe-eval' data:; style-src * 'unsafe-inline' blob:; font-src * data:; frame-src *; worker-src 'self' blob:; img-src 'self' blob: data:;"><link rel="preload" href="app.60446c973acbd5f1a1b4.js" as="script"><link rel="preload" href="branding.3e5a77066302f39357d0.css" as="style">
<link rel="preload" href="branding.e98e448cb9f57eb2303d.js" as="script">
</head>
<body>
<div class="init-load">
<div class="spinner-snake"></div><img class="mainlogo"></div>
<c8y-ui-root class="ng-cloak" id="app"></c8y-ui-root>
<script type="data" id="static-options">{"modules":[],"languages":{"de":{"name":"German","nativeName":"Deutsch","url":"./de.json"},"en":{"name":"English","nativeName":"English","url":"./en.json"},"es":{"name":"Spanish","nativeName":"Español","url":"./es.json"},"fr":{"name":"French","nativeName":"Français","url":"./fr.json"},"ja_JP":{"name":"Japanese","nativeName":"日本語","url":"./ja_JP.json"},"ko":{"name":"Korean","nativeName":"한국어 (韓國語)","url":"./ko.json"},"nl":{"name":"Dutch","nativeName":"Nederlands","url":"./nl.json"},"pl":{"name":"Polish","nativeName":"polski","url":"./pl.json"},"pt_BR":{"name":"Portuguese (Brazil)","nativeName":"Português (Brasil)","url":"./pt_BR.json"},"ru":{"name":"Russian","nativeName":"русский язык","url":"./ru.json"},"zh_CN":{"name":"Chinese (simplified)","nativeName":"汉语","url":"./zh_CN.json"},"zh_TW":{"name":"Chinese (traditional)","nativeName":"漢語","url":"./zh_TW.json"}},"core_path":"assets/","data_path":"c8ydata","author":"","name":"guardtec","version":"1.0.0","description":"","license":"ISC","keywords":[],"contextPath":"guardtec","key":"guardtec-application-key","brandingEntry":"/home/runner/work/IoT-CPI-Guardtec-UI/IoT-CPI-Guardtec-UI/branding/branding.less","tabsHorizontal":true,"hidePowered":true,"upgrade":true,"rightDrawer":false,"breadcrumbs":true,"sensorAppOneLink":"http://onelink.to/pca6qe","sensorPhone":true,"contentSecurityPolicy":"base-uri 'none'; default-src 'self' 'unsafe-inline' http: https: ws: wss:; connect-src 'self' http: https: ws: wss:;  script-src 'self' *.mapquestapi.com *.twitter.com *.twimg.com *.aptrinsic.com 'unsafe-inline' 'unsafe-eval' data:; style-src * 'unsafe-inline' blob:;  font-src * data:; frame-src *; worker-src 'self' blob:; img-src 'self' blob: data:;","dynamicOptionsUrl":"/apps/public/public-options/options.json","contextHelp":false,"globalTitle":"Cumulocity"}</script></body></html>

Preview the above HTML is below it shows only spinner icon loading

Regards
Mohan P

Hi Mohan,

as stated in my previous comment you will only find the HTML of the dashboard there after the login and when the page is fully loaded. The HTML for the dashboard will be added via javascript and is not part of the initial HTML.

Regards,
Tristan

Thanks for your reply @Tristan_Bastian . In general I am asking do we have any option to export whole reports dashboard as PDF file in cumulocity 10.18 or lower version ?

Regards
Mohan

Hi Mohan,

Cumulocity does not offer such a feature by default. The option that you have is to implement this functionality on your own.

You could e.g. write an electron app that visits the page, performs the login and either extracts the HTML of the dashboard or just use the built in functionality to print the page to a PDF.
When printing the page to a PDF, you could add some custom CSS, that hides the header, navigation and other stuff you might not be interested in.

See our example. Maybe we can help:

we have build our own PDF Export Widget in an own Cockpit Application.

that is not a standalone widget but if you like, i will find out how to make a widget from the Cockpit App Widget.

171257118264311.pdf (426.9 KB)

Mirko

2 Likes

Thanks for the information @Tristan_Bastian

Thanks for the information @Mirko_Stange1 . My requirement is to export whole dashboard as PDF not only as single widget.

Regards
Mohan