Desing from Viewer

Stimulsoft Reports.PHP discussion
gegar
Posts: 31
Joined: Thu Dec 27, 2018 5:12 pm

Desing from Viewer

Post by gegar »

Hello

In PHP, I can see the layout icon, but I can't get it to work. And here, I was able to easily export the PDf to the server side.

The same thing in JS, I can see the layout icon and it works fine, but I can't export pdf to the server side.

If I can solve any of the 2 or the, 2 would be great.
Some example. It's been one week and I've solved everything. I'm missing this.

I use the code in github https://github.com/stimulsoft/Samples-JS-PHP

Thank you
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: Desing from Viewer

Post by Lech Kulikowski »

Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more detail?

Thank you.
gegar
Posts: 31
Joined: Thu Dec 27, 2018 5:12 pm

Re: Desing from Viewer

Post by gegar »

Hello,

In index.php I add three parts, the first and third are working:

1- $options->toolbar->showDesignButton = true; This part is working

2- ?>
viewer.onDesignReport = function (args) {
// alert("Design button presed.");
window.open("SimpleList.php","_self");
}
<?PHP

3- Stimulsoft.StiOptions.WebServer.url = "handler.php"; This part is working

Next to the complete code:
<script type="text/javascript">
<?php
$handler = new \Stimulsoft\StiHandler();
//$handler->license->setKey('6vJhGtLLLz2GNviWmUTrhSqnO...');
//$handler->license->setFile('license.key');
$handler->renderHtml();

/** https://www.stimulsoft.com/en/documenta ... ttings.htm */
$options = new \Stimulsoft\Viewer\StiViewerOptions();
$options->appearance->fullScreenMode = true;
$options->appearance->scrollbarsMode = true;
$options->height = '600px'; // Height for non-fullscreen mode
$options->toolbar->showDesignButton = true;
/** https://www.stimulsoft.com/en/documenta ... oyment.htm */
$viewer = new \Stimulsoft\Viewer\StiViewer($options);

/** https://www.stimulsoft.com/en/documenta ... report.htm */
$report = new \Stimulsoft\Report\StiReport();
$report->loadFile('reports/SimpleList.mrt');
?>
viewer.onDesignReport = function (args) {
// alert("Design button presed.");
window.open("SimpleList.php","_self");
}
<?PHP
$viewer->report = $report;
?>
Stimulsoft.StiOptions.WebServer.url = "handler.php";
function onLoad() {
<?php
$viewer->renderHtml('viewerContent');
?>
}

Thanks for your answer
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: Desing from Viewer

Post by Lech Kulikowski »

Hello,

You can set
$viewer->onEndExportReport = true;
sample:
https://github.com/stimulsoft/Samples-J ... r-Side.php

And in the handler.php add code:

Code: Select all

/** @var $args StiExportEventArgs */
$handler->onEndExportReport = function ($args)
{
    // Getting the file name with the extension.
    $reportName = $args->fileName . '.' . $args->fileExtension;

    // By default, the exported file is saved to the 'reports' folder.
    // You can change this behavior if required.
    file_put_contents('reports/' . $reportName, base64_decode($args->data));

    //return StiResult::success();
    return StiResult::success("The exported report is saved successfully as $reportName");
    //return StiResult::error('An error occurred while exporting the report.');
};
sample:
https://github.com/stimulsoft/Samples-J ... andler.php

Thank you.
gegar
Posts: 31
Joined: Thu Dec 27, 2018 5:12 pm

Re: Desing from Viewer

Post by gegar »

Hello,

Yes for php is easy export to side-server or local.

I add the next code in Showing a Report in the Viewer.php

1- $options->toolbar->showDesignButton = true; /// This options show the icon design is working

2- When click in icon design this part not is working

viewer.onDesignReport = function (args) {
// alert("Design button presed.");
window.open("SimpleList.php","_self");
}

Js is easy
https://www.stimulsoft.com/en/documenta ... signer.htm

I want to php code too.

Thank you for you answer.
Max Shamanov
Posts: 768
Joined: Tue Sep 07, 2021 10:11 am

Re: Desing from Viewer

Post by Max Shamanov »

Hello,

Please use the following code:

Code: Select all

viewer.php

<?php
$options = new \Stimulsoft\Viewer\StiViewerOptions();
$options->toolbar->showDesignButton = true;

$viewer = new \Stimulsoft\Viewer\StiViewer();
$viewer->onDesignReport = 'onDesignReport';
$viewer->renderHtml();
?>

function onDesignReport(args) {
window.open("designer.php?fileName=" + args.fileName);
}
Thank you.
gegar
Posts: 31
Joined: Thu Dec 27, 2018 5:12 pm

Re: Desing from Viewer

Post by gegar »

Hello,

Right now it is working, but there is a bug in the back.

Error Unknown event [DesignReport] stimulsoft.reports.js:28:15179



$handler = new \Stimulsoft\StiHandler();
//$handler->license->setKey('6vJhGtLLLz2GNviWmUTrhSqnO...');
//$handler->license->setFile('license.key');
$handler->renderHtml();

/** https://www.stimulsoft.com/en/documenta ... ttings.htm */
$options = new \Stimulsoft\Viewer\StiViewerOptions();
$options->appearance->fullScreenMode = true;
$options->appearance->scrollbarsMode = true;
$options->height = '600px'; // Height for non-fullscreen mode
$options->toolbar->showDesignButton = true;
/** https://www.stimulsoft.com/en/documenta ... oyment.htm */
$viewer = new \Stimulsoft\Viewer\StiViewer($options);
$viewer->onDesignReport = 'onDesignReport';
$viewer->renderHtml();
/** https://www.stimulsoft.com/en/documenta ... report.htm */
$report = new \Stimulsoft\Report\StiReport();
$report->loadFile('reports/SimpleList.mrt');
?>

function onDesignReport(args) {
// alert("Design button presed.");
window.open("Editing a Report Template in the Designer.php?SimpleList.php","_self");
}
<?php
$viewer->report = $report;
?>
Stimulsoft.StiOptions.WebServer.url = "handler.php";
function onLoad() {
<?php
$viewer->renderHtml('viewerContent');
?>
}

Thank you for help.
Max Shamanov
Posts: 768
Joined: Tue Sep 07, 2021 10:11 am

Re: Desing from Viewer

Post by Max Shamanov »

Hello,

Ok.
We need some additional time to investigate the issue, we will let you know about the result.
#9682

Thank you.
Max Shamanov
Posts: 768
Joined: Tue Sep 07, 2021 10:11 am

Re: Desing from Viewer

Post by Max Shamanov »

Hello,

Issues with Error Unknown event [DesignReport] are fixed.
The fix will be available in the next release build.

Thank you.
gegar
Posts: 31
Joined: Thu Dec 27, 2018 5:12 pm

Re: Desing from Viewer

Post by gegar »

Hello,

Thank you, for your help.
Post Reply