on 2005 Apr 26 9:04 PM
Hi,
I have created a JSPDynpage with a tableview and a button when pressed converts this tableview to pdf file but when I load and try to run this par file I get the following error.
Portal Runtime Error An exception occurred while processing a request for : iView : N/A Component Name : N/A com/lowagie/text/Document. Exception id: 03:57_26/04/05_0130_6435050
Any advice would be appreciated.
~ NAC
Hi NAC,
Put the put the itext-1.2.jar in PORTAL-INF->lib folder. You shouldn't get that error. The reason why you have to do that is because it is external to portal. The library doesn't exist on portal.
prakash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am developing in JSPDynpages and am trying to create a PDF file. When I click a button on a page I call the following function.
public void ConvertDefaultTableViewToPDF( IPortalComponentResponse response, IPortalComponentRequest request)
{
try
{
com.lowagie.text.Document document = new com.lowagie.text.Document( PageSize.A4);
HttpServletResponse res = request.getServletResponse(true);
res.setContentType( "application/pdf");
PdfWriter.getInstance( document, res.getOutputStream());
document.open();
document.add(new Paragraph("Hello World"));
document.close();
}
catch( Exception ex)
{
response.write( "ERROR: " + ex);
}
return;
}
but nothing happens instead I get Portal Runtime error. Do I need to add any code on the new page that I am opening for the PDF file to show within.
Any help would be appreciated.
~NAC
at TestSession.TestProjectSession$TestProjectSessionDynPage.doProcessAfterInput(TestProjectSession.java:125)
at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:101)
at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:646)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:232)
at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)
at java.security.AccessController.doPrivileged(Native Method)
at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:153)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
Hi,
I developed a abstract class which is doing the output for me incl. the right header and son on...
may You can use it:
....
public void doProcessBeforeOutput() throws PageException {
this.init();
HttpServletResponse servletResponse =
componentRequest.getServletResponse(true);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try {
OutputStream outputStream = servletResponse.getOutputStream();
this.makePDF(byteArrayOutputStream);
servletResponse.setContentType("application/pdf");
servletResponse.setHeader(
"Content-Disposition",
"inline;filename=tmp.pdf");
servletResponse.setContentLength(byteArrayOutputStream.size());
servletResponse.setHeader("Expires", "0");
servletResponse.setHeader(
"Cache-Control",
"must-revalidate, post-check=0, pre-check=0");
servletResponse.setHeader("Pragma", "public");
byteArrayOutputStream.writeTo(outputStream);
outputStream.flush();
} catch (IOException e) {
log(
VerzahnungsvorrichtungenPDFFileController.class,
e.getLocalizedMessage(),
IEPPLogger.SEVERE);
}
}
/**
* To be implemented!!
* @param outputStream which includes the PDF
*/
protected abstract void makePDF(OutputStream outputStream);
so all You have to is to implemet the makePDF() method.
Within here You can handle Your document
...
try {
Document document = new Document();
PdfWriter.getInstance(document, outputStream);
....
You can check this
Walter
User | Count |
---|---|
70 | |
10 | |
10 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.