I have come across a runtime exception. I wanted to create a PDF document from android device. For that I used iText library.
This my code for creating PDF
Document document = new Document();
PdfWriter.getInstance(document, outStream);
document.open();
document.add(new Paragraph(data));
document.close();
The code works fine. It is creating PDF successfully. but it gives me exception on runtime saying
06-14 10:09:20.491: W/dalvikvm(764): Unable to resolve superclass of Lcom/itextpdf/awt/PdfGraphics2D; (1251)
06-14 10:09:20.491: W/dalvikvm(764): Link of class 'Lcom/itextpdf/awt/PdfGraphics2D;' failed
06-14 10:09:20.491: E/dalvikvm(764): Could not find class 'com.itextpdf.awt.PdfGraphics2D', referenced from method com.itextpdf.text.pdf.PdfContentByte.createGraphics
06-14 10:09:20.491: W/dalvikvm(764): VFY: unable to resolve new-instance 480 (Lcom/itextpdf/awt/PdfGraphics2D;) in Lcom/itextpdf/text/pdf/PdfContentByte;
06-14 10:09:25.280: E/dalvikvm(764): Could not find class 'org.bouncycastle.cert.X509CertificateHolder', referenced from method com.itextpdf.text.pdf.PdfReader.readDecryptedDocObj
06-14 10:09:25.280: W/dalvikvm(764): VFY: unable to resolve new-instance 1612 (Lorg/bouncycastle/cert/X509CertificateHolder;) in Lcom/itextpdf/text/pdf/PdfReader;
I have done clean and build, added jar to libs folder and make it selected on order and export and i done lot of research for past 2 days. but nothing helped me. Based upon my knowledge there should be these possibilities.
- The external jar does not loaded properly
- The class PdfGraphics2D extends java.awt.Graphics2D which is not available in android
any help would be appreciable.