Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Export Adhoc reports as PDF in a workflow

Avatar

Community Advisor

Hi all,

I am  trying to export adhoc reports as pdfin a workflow but i am unable to find a correct solution. This solution works for other reports but adhoc.

var reportName = "RPT10";

var path = "export/report.pdf";

var exportFormat = "PDF";

isAdHoc = true;

//originUrl = "http://XXXX.XXXXX.com/view/adHocReport";

originUrl = "http://XXXX.XXXXX.com/xtk/adHocReport.jssp";

//originUrl = "http://XXXX.XXXXX.com/xtk/jsp/exportReport.jsp";

if( document.__securitytoken ){

originUrl += "&__securitytoken=" + document.__securitytoken;

}

var reportLabel = "Tracking Logs by Category-Test";

var _ctx = <ctx _context="global" _reportContext={reportName} __universe="reports" reportId="339421"  _reportLabel ={reportLabel} _originUrl = {originUrl} />;

xtk.report.export(reportName,_ctx,exportFormat,path,isAdHoc);

I tried passing all possible originUrl(required for adhoc type) but it's not working. Anyone here who have exported adhoc reports?

Adhiyanflorentlb​?

Regards,

Amit

0 Replies

Avatar

Employee

Hi Amit,

I think we need to modify the command used to generate "export to pdf" reports which is defined in the serverconf.xml here.

You may try to add a specific command mentioning the url:{originUrl} .

<!-- Configuration of the service for converting web pages into PDF documents

         command :  Command line for running the conversion (in 'other' mode) example for phantomjs - -ignore-ssl-errors=true '$(XTK_INSTALL_DIR)/bin/htmlToPdf.js' '-out:{outPdf}' '-post:{postFile}' '-url:{originUrl}' -sessiontoken:{sessiontoken} -format:{format} -orientation:{orientation} -marginTop:{marginTop} -marginLeft:{marginLeft} -marginRight:{marginRight} -marginBottom:{marginBottom}

         maxProcessusCount :  Max. number of conversion processes allowed at a time on one machine. Default: 5

         mode :  Tool to use for the conversion (phantomjs|wkhtmltopdf|other|disabled) Default: 'phantomjs'

         timeout :  Maximum conversion time in seconds. Beyond this threshold, the conversion process is stopped and an error is raised. Default: 120

         verbose :  Start in verbose mode to diagnose possible errors. Default: false

         waitTime :  Delay in seconds, when all processes are used at the same time and when waiting for a process to free up. If this delay is exceeded, conversion is stopped and an error is raised. Default: 15 -->

    <htmlToPdf command="" maxProcessusCount="5" mode="phantomjs" timeout="120" verbose="false"

               waitTime="15"/>

Alternately , if the mode is set to phantomjs , you may try to change the mode to htmlToPdf.js and give a try.

Regards,
Adhiyan