embed documents

Stimulsoft Reports.PHP discussion
Post Reply
riskcom
Posts: 10
Joined: Tue Apr 10, 2018 6:15 am

embed documents

Post by riskcom »

Hi,

I was asked to embed PDF files into a report if possible.

If not, I could export PDF files to images. Is it possible to insert images on the fly and also change the page orientation?

Thanks
Leo
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: embed documents

Post by Lech Kulikowski »

Hello,

> I was asked to embed PDF files into a report if possible.

It is not possible.

> If not, I could export PDF files to images. Is it possible to insert images on the fly and also change the page orientation?

In PHP version, directly in the report, it is not possible, scripts are not supported. Only from code:
https://www.stimulsoft.com/en/samples/j ... -from-code

Thank you.
riskcom
Posts: 10
Joined: Tue Apr 10, 2018 6:15 am

Re: embed documents

Post by riskcom »

Thanks Lech!

How about use the "Render Events"? As we read images from JSON and can give a parameter to specify the orientation of the image.

Rendering --> this.Orientation = 'Landscape'; ???
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: embed documents

Post by Lech Kulikowski »

Hello,

In PHP version, directly in the report, it is not possible, scripts in events are not supported.

Thank you.
riskcom
Posts: 10
Joined: Tue Apr 10, 2018 6:15 am

Re: embed documents

Post by riskcom »

Hi,
I have managed to insert a page with images and also change the page orientation but cannot display a page number.
Thanks
riskcom
Posts: 10
Joined: Tue Apr 10, 2018 6:15 am

Re: embed documents

Post by riskcom »

var report = new Stimulsoft.Report.StiReport();
report.loadFile("reports/Report.mrt");
--- LOOP ---
var treport = new Stimulsoft.Report.StiReport();
var tpage = treport.pages.getByIndex(0);
tpage.orientation = 1;
--- add image component ----
--- add Page Number ----
var txt = new Stimulsoft.Report.Components.StiText();
txt.text = "{PageNumber}";
tpage.components.add(txt);
report.pages.insert(8, tpage);
--- END LOOP ---
viewer.report = report;
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: embed documents

Post by Lech Kulikowski »

Hello

Ok.
Please let us know if you need any additional help.

Thank you.
riskcom
Posts: 10
Joined: Tue Apr 10, 2018 6:15 am

Re: embed documents

Post by riskcom »

Hi,

Sorry to be a pain.

We need to update the TOC after inserting images from code.

So I added the databand with the following:
var databand1 = new Stimulsoft.Report.Components.StiDataBand();
databand1.name = "SitePlanDB";
databand1.renderingEvent.script = 'this.addAnchor("SitePlan");';
report.pages.getByIndex(8).components.add(databand1);

However, we are not able to the page number with {GetAnchorPageNumber("SitePlan")}???

Thanks
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: embed documents

Post by Lech Kulikowski »

Hello,

Please try to use the following code:
var event = new Stimulsoft.Report.Events.StiRenderingEvent();
event.script = 'this.addAnchor("SitePlan");';
databand1.renderingEvent = event;

Thank you.
Post Reply