Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Exporting to PDF server side failure
Ephasme
Hello,
I'm Loup and I'm working on a BIRT report. My goal is to export that report server-side from client-side with an URL. I created my servlet and bound it to a servlet mapping. The servlet works, the BIRT generation works using frameset url but when it comes to export in PDF server-side the BIRT engine yields a blank page and this error into the log :
WARNING: Error.ResourceNotAccessible
Find more posts tagged with
Comments
mwilliams
So, you're not using the viewer? You wrote your own code? If so, can you attach your code?
Ephasme
Hi !<br />
<br />
Thanks for your reply.<br />
<br />
My need is to have an URL like<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>http://xxxx.com/generate?reportName=report&contractId=xx"ationId=xx</pre>
<br />
That URL should trigger the generation of a PDF BIRT report server side with no more user actions.<br />
<br />
Yesterday I managed to create a PDF with the BIRT engine but I really don't know how.<br />
<br />
I hide the names with XXXX because of confidentiality.<br />
<br />
Here's my code :<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
@SuppressWarnings("
;unchecked")
public static boolean generateXXXXXXX(String path, String reportName, Integer contractId, Integer quotationId) {
IReportEngine engine = null;
checkNotNull(path,"Path is needed.");
checkNotNull(reportName,"Report name is needed.");
checkNotNull(contractId,"ContractID is needed.");
checkNotNull(quotationId,"QuotationID is needed.");
String rootPath = "D:\\svn\\XXXXX\\trunk\\XXXXXX\\WebContent\\";
try {
EngineConfig config = new EngineConfig();
config.setLogConfig(rootPath+"report\\logs", Level.FINE);
config.setResourcePath("report");
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
engine = factory.createReportEngine(config);
engine.changeLogLevel(Level.FINE);
IReportRunnable design = engine.openReportDesign(rootPath+"report\\"+reportName+"_report.rptdesign");
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
//Set parent ClassLoader for engine
task.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, BirtGenerator.class.getClassLoader());
//Set parameter values and validate
task.setParameterValue("Contract_ID", contractId);
task.setParameterValue("Quotations_ID", quotationId.toString());
task.validateParameters();
//Setup rendering to PDF
PDFRenderOption options = new PDFRenderOption();
options.setOutputFileName(path+"\\"+reportName+"_report.pdf");
System.out.println("path = "+path+"\\"+reportName+"_report.pdf");
options.setOutputFormat("pdf");
task.setRenderOption(options);
//run and render report
task.run();
task.close();
} catch (Exception ex) {
ex.printStackTrace();
} finally {
if (engine != null)
engine.destroy();
Platform.shutdown();
RegistryProviderFactory.releaseDefault();
}
return true;
}
</pre>
<br />
So am I supposed to close this topic since my issue doesn't exist anymore ?
mwilliams
I'm glad you got it working. No need to close the post. Just let us know whenever you have questions!