2005 IR Help Posted August 23, 2006 Share Posted August 23, 2006 By: Nishant Miglani - nishantm Cannot Export To PDF! 2004-03-05 08:04 Hello, I am trying to export a report to a PDF stream. It gave me some trouble as part of my application. So I wrote the following simple class to test it on its own. It still gives me the same problem. I have included all the required libraries for Jasper and Itext in the IDE. I have no idea what to do. I have included the code and the error message down below: Here is the code: import dori.jasper.engine.*; import dori.jasper.engine.base.*; import java.io.*; import java.awt.*; public class TestPDF { static FileOutputStream fos; public static void main(String args[]) { System.out.println("Okay class, let's test some Jasper PDFs!"); try{ File file = new File("C:\randomreport.pdf"); if (!file.exists()) { file.createNewFile(); } fos = new FileOutputStream(file); JasperPrint jp = new JasperPrint(); JRBasePrintText jrpe = new JRBasePrintText(); jrpe.setText("Hello World"); jrpe.setTextHeight(20); jrpe.setX(50); jrpe.setY(50); jrpe.setWidth(100); jrpe.setHeight(20); jrpe.setForecolor(Color.BLUE); JRBasePrintPage jrbpp = new JRBasePrintPage(); jrbpp.addElement(jrpe); jp.addPage(jrbpp); jp.setPageHeight(200); jp.setPageWidth(100); JasperExportManager.exportReportToPdfStream(jp, fos); fos.close(); System.out.println("Done"); } catch(Exception e) {e.printStackTrace();} finally { closeAll(); System.out.println("What just happened??"); } } private static void closeAll() { try { fos.close(); } catch (IOException e){} } } Here is the error: Okay class, let's test some Jasper PDFs! What just happened?? java.lang.NoSuchMethodError: com.lowagie.text.pdf.PdfContentByte.transform(Ljava/awt/geom/AffineTransform;)V at dori.jasper.engine.export.JRPdfExporter.exportText(JRPdfExporter.java:1178) at dori.jasper.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:401) at dori.jasper.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:342) at dori.jasper.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:209) at dori.jasper.engine.JasperExportManager.exportReportToPdfStream(JasperExportManager.java:171) at TestPDF.main(TestPDF.java:54) Exception in thread "main" Any help will be appreciated. Thanks By: Gregory A. Swarthout - gswarthout RE: Cannot Export To PDF! 2004-03-05 09:12 What operating system and JVM version are you using? By: Nishant Miglani - nishantm RE: Cannot Export To PDF! 2004-03-05 10:26 I'm using Windows 2000 (5.00.2195) and my JVM (or Java) version is: java version "1.4.2_03" Java 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02) Java HotSpot Client VM (build 1.4.2_03-b02, mixed mode) Thanks By: Gregory A. Swarthout - gswarthout RE: Cannot Export To PDF! 2004-03-05 10:53 The version of iText in your classpath is older than the version (1.01) that comes with the current distributions of JasperReports and iReports. v0.96 doesn't contain this method. Greg By: Teodor Danciu - teodord RE: Cannot Export To PDF! 2004-03-05 11:14 Hi, Sorry, my mistake, I should have updated the "Requirements" page after releasing the 0.5.2. Thank you, Teodor By: Nishant Miglani - nishantm RE: Cannot Export To PDF! 2004-03-05 11:35 Greg, I downloaded the iText1.0.1 version, and its working fine. Thanks so much for your help. Nishant By: Nishant Miglani - nishantm RE: Cannot Export To PDF! 2004-03-05 11:36 Thanks Teodor Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now