Problem with PDFexport Add-on

Hello,

I am trying to use the PDFExport add-on for exporting a table to pdf file though Print button. When i press the button , on it appear red !.

I’ve added the .jar file in WEB-INF/lib folder. I’ve added also the following code in ivy/ivysettings:

Here it is also the button code the same as on the example shown on the add-on page:

[code]
print.addClickListener(new Button.ClickListener() {

         @Override
         public void buttonClick(Button.ClickEvent event) {
                 PdfFromComponent factory = new PdfFromComponent();
                 factory.export(listTaskLayout);
                 
         }
 });

[/code]The layout is VerticalLayout.
What is wrong?

Thank you!
BR,
Elena

Hi,

obviously some exception is happening (thus the error indicator). Please also post the full stacktrace of the exception from the server log and it will be much easier to help you.

-tepi

Hi
Thank you for the fast respond!

The server log :



SEVERE:
com.vaadin.server.ServerRpcManager$RpcInvocationException: Unable to invoke method click in com.vaadin.shared.ui.button.ButtonServerRpc
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:170)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:118)
at com.vaadin.server.communication.ServerRpcHandler.handleBurst(ServerRpcHandler.java:207)
at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:111)
at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:91)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:37)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1390)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:168)
… 27 more
Caused by: com.vaadin.event.ListenerMethod$MethodException: Invocation of method buttonClick in com.example.taskmanager.TaskmanagerUI$6 failed.
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:528)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:198)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:161)
at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:969)
at com.vaadin.ui.Button.fireClick(Button.java:368)
at com.vaadin.ui.Button$1.click(Button.java:57)
… 32 more
Caused by: java.lang.NoClassDefFoundError: com/itextpdf/text/DocumentException
at com.example.taskmanager.TaskmanagerUI$6.buttonClick(TaskmanagerUI.java:270)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:508)
… 37 more
Caused by: java.lang.ClassNotFoundException: com.itextpdf.text.DocumentException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
… 43 more


Thanks.
Elena

Hi again,

seems that the add-on does not reference its itext dependency. You should add the following dependency to your ivy.xml:

<dependency org="com.itextpdf" name="itextpdf" rev="5.3.4"/>

This is not the latest version (latest is 5.5.0), but 5.3.4 is the one the author of PDFExport uses in his example application.

-tepi

P.S. If you use ivy for dependencies, you do not need to (and should not) add the JARs manually to WEB-INF/lib.

Hello again,

I added the dependency you suggested and i removed the JAR file from WEB-INF/lib.

I still have the same problem.

Thank you,
Elena

I just noticed that the PDFExport add-on only support Vaadin 6, but you seem to be using Vaadin 7, so I’d say this is a no-go from the start up. You should consider some other option.

-tepi

Thank you!

If someone would like to export to PDF while using vaadin 7 i would recommend to use PdfExporter. It works perfect for me! PdfExporter pdfExporter = new PdfExporter(Table);
BR,
Elena