This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Error when exportReportToPdfFile

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have used the code fragment mentioned below to view the report and export to PDFfile in NetBeans 6.1 (the report is originally generated and compiled using iReport 3.6.0),my requirement is to export in to pdf using jsp application ,i have used the latest iText2.1.0 jar file in my application ,still i getting the exception , please help me .


code:

public class ReportServlet extends HttpServlet {
Connection con;
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
System.out.println("bb");

ServletOutputStream servletOutputStream = response.getOutputStream();

try {
Class.forName("org.postgresql.Driver");
con = DriverManager.getConnection("jdbc:postgresql://localhost:5444/das", "postgres" , "postgres");

} catch (Exception e) {
}




try {

System.out.println("Calling .....");

String home_path=System.getProperty("user.home");
ServletContext ctx = getServletContext();
String realpath_paydts=ctx.getRealPath("/Jasper");

System.out.println("path :::"+realpath_paydts);
Map parameters = new HashMap();


parameters.put("fdate", new java.util.Date(10/10/2004));
parameters.put("tdate", new java.util.Date(11/11/2009));
parameters.put("cc_code", new String("1"));
parameters.put("fqty",new java.lang.Double(1.0d));
parameters.put("tqty", new java.lang.Double(9.0d));

JasperReport jasperReport;
JasperPrint jasperPrint;
JasperDesign jasperDesign;



try{
jasperDesign =JRXmlLoader.load(realpath_paydts+"/Datewisecollection.jrxml");

jasperReport =JasperCompileManager.compileReport(jasperDesign);


jasperPrint = JasperFillManager.fillReport(jasperReport,parameters, con );
JasperViewer.viewReport(jasperPrint, false);

JasperExportManager.exportReportToPdfFile(jasperPrint,home_path+"/Datewisecollection.pdf");


} catch(Exception ex) { }

servletOutputStream.flush();
servletOutputStream.close();

}catch(Exception ex)
{
ex.printStackTrace();
}
}




Exception:

javax.servlet.ServletException: Servlet execution threw an exception

java.lang.NoSuchMethodError: com.lowagie.text.pdf.PdfWriter.setRgbTransparencyBlending(Z)V
net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:480)
net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:379)
net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfFile(JasperExportManager.java:122)
ReportServlet.processRequest(ReportServlet.java:104)
ReportServlet.doGet(ReportServlet.java:142)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 
Sheriff
Posts: 9643
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vasu please Use Code Tags when you post a source code. You can edit your message using button and then add code tags to it.

There seems to be a method named setRgbTransparencyBlending as given here. Are you using two sets of libraries?? If yes, make sure that they are compatible with each other. Also make sure that the library is getting packaged in your application so that it's available at runtime...
 
CLUCK LIKE A CHICKEN! Now look at this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!