If Crystal Reports is installed on another computer, you can use this code to copy the file from your Crystal Reports server to the Public Files of a process on your ProcessMaker server. For example:
Code: Select all$username = 'johndoe';
$password = 'pAsSw0rD';
$sqlServer = 'acmeSql';
$cmd = "C:\path\crexport.exe -F \"C:\path\CustList.rpt\" -U \"$username\" -P \"$password\" -S\"$sqlServer\" -D\"clientdb\" -O \"C:CustList.pdf\" -Epdf -XFile -N1";
$connection = ssh2_connect('crystal_machine.example.com', 22);
ssh2_auth_password($connection, $username, $password);
$stream = ssh2_exec($connection, $cmd);
ssh2_scp_recv($connection, 'C:\CustList.pdf', '/opt/processmaker/shared/sites/workflow/public/3713073734d824385011f94010814136/customerList.pdf');
@@reportUrl = "http://example.com/sysworkflow/en/neoclassic/3713073734d824385011f94010814136/customerList.pdf";
Where "reportUrl" is the variable for a hidden field.
If you copy the file to the Public Files for a process, then then you can display the PDF inside a panel control inside a Dynaform with <embed> or <iframe>:
<embed src="
http://example.com/sysworkflow/en/neocl ... erList.pdf" width="800px" height="2100px" />
or:
<iframe src="
http://example.com/sysworkflow/en/neocl ... erList.pdf" style="width: 100%;height: 100%;border: none;"></iframe>
To open in a new tab/window, use this javascript code in your DynaForm:
Code: Select all$("#openReport").find("button").click(function() {
var url = $("#reportUrl").getValue();
window.open(url, '_blank');
});
Where "openReport" is the ID of a button and "reportUrl" is the ID of a hidden field which holds the URL.