Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Eclipse RCP WebViewer PDF broken
Stague
<p>I have an RCP application that uses the BIRT WebViewer to launch birt reports and all seems to be working for HTML, DOC, and XLS reports, but PDF launches the window and only shows a black icon with an X in it. If I launch my report as HTML and then export it to PDF it works, and if I right click the window --> properties and grab the URL and paste that into IE or Chrome then the report loads.</p><p> </p><p>I am using BIRT 4.3.1 through Eclipse RCP Kepler. I already had problems with IE11 and viewing the other reports but that was solved by adding the following to the launch configuration of my product:</p><pre class="_prettyXprint">-Dorg.eclipse.swt.browser.DefaultType=ie,mozilla-Dorg.eclipse.swt.browser.IEVersion=7000</pre><div>We are (essentially) launching the report like this:</div><div> </div><div><pre class="_prettyXprint">String reportPath = getValidReportPath(reportParentDir, reportName);HashMap<String, Serializable> viewerParameters = new HashMap<String, Serializable>();viewerParameters.put(WebViewer.SERVLET_NAME_KEY, WebViewer.VIEWER_FRAMESET);viewerParameters.put(WebViewer.FORMAT_KEY, WebViewer.PDF);Display display = new Display();Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setText("BIRT Report: ");shell.setLayout(new FillLayout());Browser browser = new Browser(shell, SWT.NONE);// Launch reportWebViewer.display(reportPath, browser, viewerParameters);shell.open();</pre></div><div> </div><div> </div>
Find more posts tagged with
Comments
Stague
<div>A bit more info on this issue:</div><div> </div><div>It turns out that this issue is present in Internet Explorer 10/11 but does not manifest in IE9. I tried setting the <pre class="_prettyXprint">-Dorg.eclipse.swt.browser.IEVersion=9000</pre> OR <pre class="_prettyXprint">-Dorg.eclipse.swt.browser.IEVersion=9999</pre><p> in the program arguments under the launching tab of my .product file to no avail. It seems to persist beyond this setting which indicates that either those settings don't work on IE11 or something else is not allowing the PDF through.</p></div><div> </div><div>I tried turning off the "Enhanced Protection Mode" in the Internet Options --> Advanced tab, but the problem seems to persist.</div><div> </div><div>I tried turning off the "Enable Protected Mode" in the Internet Options --> Security tab, but the problem seems to persist.</div><div> </div><div>I made sure that the "Do not save encrypted pages to disk" setting was not checked in the Internet Options --> Advanced tab, but the problem seems to persist.</div>
Stague
<p>Is this the correct forum for this issue? Should I be logging a bug with the BIRT team? The silence is deafening.</p>
Stague
<p>Bump.</p>
Stague
<p>Bump.</p>
Stague
<p>Update: The only solution I could find to this problem is to use the BIRT Engine to generate and open the files. Here is what I ended up with (which may not be totally correct):</p><p> </p><div><p>In my Activator class I create an instance of the birt engine.</p><pre class="_prettyXprint">private final EngineConfig birtEngineConfig;private final IReportEngine birtEngine;/*** The constructor*/public Activator(){birtEngineConfig = new EngineConfig();IPlatformContext context = new PlatformFileContext();birtEngineConfig.setPlatformContext(context);HashMap<Object, Object> appContext = birtEngineConfig.getAppContext();appContext.put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY,Thread.currentThread().getContextClassLoader());birtEngineConfig.setAppContext((HashMap<?, ?>) new BirtAppContext().getAppContext(appContext));IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);birtEngine = factory.createReportEngine(birtEngineConfig);birtEngine.changeLogLevel(java.util.logging.Level.FINE); }</pre><p>Then I have a static method to launch reports:</p><p> </p><div><pre class="_prettyXprint">try {Activator plugin = Activator.getDefault();IReportEngine engine = plugin.getBirtEngine();String outputFileName = engine.getConfig().getTempDir() + reportName + "_" + dateTimeString + "."+ webViewerDocType;IReportRunnable runnable = engine.openReportDesign(reportPath);IRunAndRenderTask task = engine.createRunAndRenderTask(runnable);ByteArrayOutputStream fso = new ByteArrayOutputStream();IRenderOption options = null;if (WebViewer.PDF.equals(webViewerDocType)) { options = new PDFRenderOption(); options.setOutputFormat(PDFRenderOption.OUTPUT_FORMAT_PDF);} else if (WebViewer.DOC.equals(webViewerDocType)) { options = new DocxRenderOption(); options.setOutputFormat(WebViewer.DOC);}else if (DOC_TYPE_XLS.equals(webViewerDocType)) { options = new EXCELRenderOption(); options.setOutputFormat(DOC_TYPE_XLS);}options.setOutputFileName(outputFileName);options.setOutputStream(fso);task.setRenderOption(options);task.setParameterValues(reportParameterMap);task.run();Program.launch(outputFileName);task.close();} catch (Exception e) {e.printStackTrace();}</pre><p>Hope this helps.</p></div></div>