4

Convert JPG to PDF is throwing exception at line Document.open()

com.itextpdf.text.Document document = new com.itextpdf.text.Document();
PdfWriter.getInstance( document, new FileOutputStream(outputFile));
document.open();
Image image = Image.getInstance(updPath);
document.add(image);
document.close();

I added the itext as external jar file

rtruszk
  • 3,902
  • 13
  • 36
  • 53
  • `throwing exception at line Document.open() `. You mean document.open()? Then what has this to do with converting a jpg? – greenapps Jul 18 '15 at 10:51
  • problem solved http://stackoverflow.com/questions/10046298/android-update-17-seems-incompatible-with-external-jars/10046725#10046725 Thanks guys for voting minus it will help me for my future questions – Kamleshwer Purohit Jul 18 '15 at 10:54
  • I dont know why people rating minus. if i am new on stackoverflow what is the use of this site for me as i am not able to give answer due to some people rating me – Kamleshwer Purohit Jul 18 '15 at 11:00
  • @kamleshwerpurohit Fortunately, up votes give you more reputation than down votes. You now have two up votes and they outweigh the single down vote ;-) – Bruno Lowagie Jul 18 '15 at 16:26
  • So can we close this as an exact duplicate of http://stackoverflow.com/q/10046298/2564301? (If the answer there solved this issue for you. I can't really follow because you gave virtually no relevant info.) – Jongware Jul 18 '15 at 23:47
  • Yes We can close it thank you so much for up votes – Kamleshwer Purohit Jul 20 '15 at 05:50

1 Answers1

1

I found the answer for above problem. I just added the jar in libs folder it works for me. Please See Reference Android update 17 seems incompatible with external Jars

There may be problem with external jars,

in your project just

  • create a folder named libs.
  • Copy and paste all needed external jar files into that folder.
Community
  • 1
  • 1