Page 1 of 1
headless report generation
Posted: Thu Feb 16, 2012 12:48 pm
by brianj774
Hi,
I've been asked to look into some kind of automated reporting with this product.
What I'd like to be able to do is procedurally generate a document, and save it as a pdf. I'm pretty sure this cannot be done client side, but is it possible on server side ?
headless report generation
Posted: Fri Feb 17, 2012 3:55 am
by Vladimir
Hello,
You can use the following code to generate a PDF file on the server side:
Code: Select all
StiPdfExportSettings settings = new StiPdfExportSettings();
settings.PageRange = pageRange;
settings.ImageQuality = imageQuality;
.....
MemoryStream stream = new MemoryStream();
StiPdfExportService export = new StiPdfExportService();
export.ExportPdf(report, stream, settings);
Thank you.
headless report generation
Posted: Fri Feb 17, 2012 12:46 pm
by brianj774
excellent, thanks.
headless report generation
Posted: Sat Feb 18, 2012 1:12 am
by Andrew
Hello,
As usually, we are happy to help you.
Thank you.
headless report generation
Posted: Wed May 16, 2012 3:15 pm
by brianj774
I am planning on implementing this idea as an internal webservice. The plan will be that the 'service' will take a parameter (say, an ID), and using it, populate a dataset. From there, I will Export the PDF, and return to the caller a success/fail code, or perhaps a file path, etc...
Can you suggest a 'best' design for this. I'm looking over the WebDemo files from 'Ultimate', and they appear to be page based. As I'm hoping to reduce this to a simple service, I would like to be able to do without a viewer object (StiWebViewer), but I'm not sure it can be done that way.
Is it possible to make this completely headless
Please advise. Thanks!
headless report generation
Posted: Thu May 17, 2012 7:59 am
by Vladimir
Hello,
WebViewer is not required to generate and export reports on the server side. You can use the following code to load and generate report:
Code: Select all
// Load report template
StiRpeort report = new StiReport();
report.Load(...);
// Set some report parameters
report["Param1"] = value;
// Render report
report.Render(false);
// Export report
StiPdfExportSettings settings = new StiPdfExportSettings();
settings.PageRange = pageRange;
settings.ImageQuality = imageQuality;
.....
MemoryStream stream = new MemoryStream();
StiPdfExportService export = new StiPdfExportService();
export.ExportPdf(report, stream, settings);
Thank you.